pixelize-design-library 2.4.2-beta.59 → 2.4.2-beta.60
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 +78 -9
- package/COMPONENT-GOTCHAS.md +118 -17
- package/DESIGN-GUIDE.md +17 -6
- package/dist/Components/AudioRecorder/AudioRecorder.d.ts +8 -0
- package/dist/Components/AudioRecorder/AudioRecorder.js +169 -0
- package/dist/Components/AudioRecorder/AudioRecorderProps.d.ts +20 -0
- package/dist/Components/AudioRecorder/AudioRecorderProps.js +2 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBar.d.ts +3 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBar.js +43 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBarProps.d.ts +35 -0
- package/dist/Components/BulkSelectionBar/BulkSelectionBarProps.js +2 -0
- package/dist/Components/BulkSelectionBar/index.d.ts +2 -0
- package/dist/Components/BulkSelectionBar/index.js +8 -0
- package/dist/Components/CalendarGrid/CalendarGrid.d.ts +3 -0
- package/dist/Components/CalendarGrid/CalendarGrid.js +173 -0
- package/dist/Components/CalendarGrid/CalendarGridProps.d.ts +54 -0
- package/dist/Components/CalendarGrid/CalendarGridProps.js +2 -0
- package/dist/Components/CalendarGrid/calendarMath.d.ts +49 -0
- package/dist/Components/CalendarGrid/calendarMath.js +178 -0
- package/dist/Components/CircularProgress/CircularProgress.d.ts +4 -0
- package/dist/Components/CircularProgress/CircularProgress.js +39 -0
- package/dist/Components/CircularProgress/CircularProgressProps.d.ts +22 -0
- package/dist/Components/CircularProgress/CircularProgressProps.js +2 -0
- package/dist/Components/CircularProgress/arc.d.ts +12 -0
- package/dist/Components/CircularProgress/arc.js +16 -0
- package/dist/Components/Common/fieldStyles.d.ts +1 -0
- package/dist/Components/Common/fieldStyles.js +2 -1
- package/dist/Components/Drawer/Drawer.d.ts +1 -1
- package/dist/Components/Drawer/Drawer.js +4 -2
- package/dist/Components/Drawer/DrawerProps.d.ts +3 -1
- package/dist/Components/EmptyState/EmptyState.js +2 -1
- package/dist/Components/EmptyState/EmptyStateProps.d.ts +2 -2
- package/dist/Components/FormDrawer/FormDrawer.d.ts +2 -0
- package/dist/Components/FormDrawer/FormDrawer.js +97 -0
- package/dist/Components/FormDrawer/FormDrawerProps.d.ts +55 -0
- package/dist/Components/FormDrawer/FormDrawerProps.js +2 -0
- package/dist/Components/LauncherTrigger/LauncherTrigger.d.ts +1 -1
- package/dist/Components/LauncherTrigger/LauncherTrigger.js +8 -1
- package/dist/Components/LauncherTrigger/LauncherTriggerProps.d.ts +2 -0
- package/dist/Components/Modal/Modal.d.ts +1 -1
- package/dist/Components/Modal/Modal.js +4 -2
- package/dist/Components/Modal/ModalProps.d.ts +3 -1
- package/dist/Components/Modal/warnDroppedSlotChildren.d.ts +2 -0
- package/dist/Components/Modal/warnDroppedSlotChildren.js +45 -0
- package/dist/Components/NavLauncher/NavLauncher.js +83 -26
- package/dist/Components/NavLauncher/NavLauncherProps.d.ts +6 -6
- package/dist/Components/NavLauncher/launcherParts.d.ts +60 -1
- package/dist/Components/NavLauncher/launcherParts.js +93 -11
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +5 -0
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.d.ts +1 -1
- package/dist/Components/QueryState/QueryStateBoundary.d.ts +2 -2
- package/dist/Components/QueryState/QueryStateBoundary.js +9 -3
- package/dist/Components/QueryState/QueryStateProps.d.ts +19 -2
- package/dist/Components/SectionRail/SectionRail.d.ts +3 -0
- package/dist/Components/SectionRail/SectionRail.js +49 -0
- package/dist/Components/SectionRail/SectionRailProps.d.ts +23 -0
- package/dist/Components/SectionRail/SectionRailProps.js +2 -0
- package/dist/Components/SectionRail/index.d.ts +2 -0
- package/dist/Components/SectionRail/index.js +8 -0
- package/dist/Components/SegmentedControl/SegmentedControl.js +9 -14
- package/dist/Components/SegmentedControl/segmentedInk.d.ts +0 -2
- package/dist/Components/SegmentedControl/segmentedInk.js +1 -5
- package/dist/Components/StatCard/StatCard.d.ts +1 -1
- package/dist/Components/StatCard/StatCard.js +6 -2
- package/dist/Components/StatCard/StatCardProps.d.ts +3 -0
- package/dist/Components/StatusTag/StatusTag.d.ts +4 -0
- package/dist/Components/StatusTag/StatusTag.js +24 -0
- package/dist/Components/StatusTag/StatusTagProps.d.ts +20 -0
- package/dist/Components/StatusTag/StatusTagProps.js +2 -0
- package/dist/Components/Table/Table.d.ts +1 -1
- package/dist/Components/Table/Table.js +6 -2
- package/dist/Components/Table/TableProps.d.ts +20 -0
- package/dist/Components/Table/components/TableBody.d.ts +1 -1
- package/dist/Components/Table/components/TableBody.js +43 -18
- package/dist/Components/Table/components/TableHeader.d.ts +1 -1
- package/dist/Components/Table/components/TableHeader.js +7 -5
- package/dist/Components/Table/components/rowDetail.d.ts +32 -0
- package/dist/Components/Table/components/rowDetail.js +20 -0
- package/dist/Components/Table/hooks/useRowExpansion.d.ts +7 -0
- package/dist/Components/Table/hooks/useRowExpansion.js +27 -0
- package/dist/Components/Tabs/Tabs.d.ts +1 -1
- package/dist/Components/Tabs/Tabs.js +15 -2
- package/dist/Components/Tabs/TabsProps.d.ts +6 -2
- package/dist/Components/Tabs/components/Tab.js +4 -33
- package/dist/Components/Tabs/components/TabLinkList.d.ts +7 -0
- package/dist/Components/Tabs/components/TabLinkList.js +34 -0
- package/dist/Components/Tabs/useTabAppearance.d.ts +17 -0
- package/dist/Components/Tabs/useTabAppearance.js +67 -0
- package/dist/Components/Tag/Tag.js +11 -1
- package/dist/Components/Tag/TagProps.d.ts +4 -0
- package/dist/Components/Tag/tagDot.d.ts +3 -0
- package/dist/Components/Tag/tagDot.js +21 -0
- package/dist/esm/Components/AudioRecorder/AudioRecorder.js +161 -0
- package/dist/esm/Components/AudioRecorder/AudioRecorderProps.js +1 -0
- package/dist/esm/Components/BulkSelectionBar/BulkSelectionBar.js +38 -0
- package/dist/esm/Components/BulkSelectionBar/BulkSelectionBarProps.js +1 -0
- package/dist/esm/Components/BulkSelectionBar/index.js +1 -0
- package/dist/esm/Components/CalendarGrid/CalendarGrid.js +168 -0
- package/dist/esm/Components/CalendarGrid/CalendarGridProps.js +1 -0
- package/dist/esm/Components/CalendarGrid/calendarMath.js +155 -0
- package/dist/esm/Components/CircularProgress/CircularProgress.js +37 -0
- package/dist/esm/Components/CircularProgress/CircularProgressProps.js +1 -0
- package/dist/esm/Components/CircularProgress/arc.js +11 -0
- package/dist/esm/Components/Common/fieldStyles.js +2 -1
- package/dist/esm/Components/Drawer/Drawer.js +4 -2
- package/dist/esm/Components/EmptyState/EmptyState.js +2 -1
- package/dist/esm/Components/FormDrawer/FormDrawer.js +58 -0
- package/dist/esm/Components/FormDrawer/FormDrawerProps.js +1 -0
- package/dist/esm/Components/LauncherTrigger/LauncherTrigger.js +5 -1
- package/dist/esm/Components/Modal/Modal.js +4 -2
- package/dist/esm/Components/Modal/warnDroppedSlotChildren.js +38 -0
- package/dist/esm/Components/NavLauncher/NavLauncher.js +85 -28
- package/dist/esm/Components/NavLauncher/launcherParts.js +88 -11
- package/dist/esm/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +5 -0
- package/dist/esm/Components/QueryState/QueryStateBoundary.js +10 -4
- package/dist/esm/Components/SectionRail/SectionRail.js +44 -0
- package/dist/esm/Components/SectionRail/SectionRailProps.js +1 -0
- package/dist/esm/Components/SectionRail/index.js +1 -0
- package/dist/esm/Components/SegmentedControl/SegmentedControl.js +11 -16
- package/dist/esm/Components/SegmentedControl/segmentedInk.js +0 -3
- package/dist/esm/Components/StatCard/StatCard.js +6 -2
- package/dist/esm/Components/StatusTag/StatusTag.js +19 -0
- package/dist/esm/Components/StatusTag/StatusTagProps.js +1 -0
- package/dist/esm/Components/Table/Table.js +7 -3
- package/dist/esm/Components/Table/components/TableBody.js +43 -18
- package/dist/esm/Components/Table/components/TableHeader.js +7 -5
- package/dist/esm/Components/Table/components/rowDetail.js +14 -0
- package/dist/esm/Components/Table/hooks/useRowExpansion.js +23 -0
- package/dist/esm/Components/Tabs/Tabs.js +15 -2
- package/dist/esm/Components/Tabs/components/Tab.js +4 -33
- package/dist/esm/Components/Tabs/components/TabLinkList.js +29 -0
- package/dist/esm/Components/Tabs/useTabAppearance.js +63 -0
- package/dist/esm/Components/Tag/Tag.js +12 -2
- package/dist/esm/Components/Tag/tagDot.js +17 -0
- package/dist/esm/index.js +7 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +18 -4
- package/package.json +1 -1
|
@@ -52,7 +52,10 @@ const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
|
52
52
|
const AppMark_1 = require("../AppSwitcher/AppMark");
|
|
53
53
|
const Drawer_1 = __importStar(require("../Drawer/Drawer"));
|
|
54
54
|
const EmptyState_1 = __importDefault(require("../EmptyState/EmptyState"));
|
|
55
|
-
const Kbd_1 =
|
|
55
|
+
const Kbd_1 = __importStar(require("../Kbd/Kbd"));
|
|
56
|
+
const ToolTip_1 = __importDefault(require("../ToolTip/ToolTip"));
|
|
57
|
+
const useIsTruncated_1 = require("../../Hooks/useIsTruncated");
|
|
58
|
+
const AppSwitcherProps_1 = require("../AppSwitcher/AppSwitcherProps");
|
|
56
59
|
const Skeletons_1 = __importDefault(require("../Skeletons/Skeletons"));
|
|
57
60
|
const launcherParts_1 = require("./launcherParts");
|
|
58
61
|
const match_1 = require("./match");
|
|
@@ -62,6 +65,11 @@ const NO_APPS = [];
|
|
|
62
65
|
const MD_QUERY = "(min-width: 48em)";
|
|
63
66
|
const XL_QUERY = "(min-width: 80em)";
|
|
64
67
|
const CELL_SELECTOR = "[data-nav-cell]";
|
|
68
|
+
const RAIL_WIDTH = "clamp(20rem, 30%, 26rem)";
|
|
69
|
+
const PINNED_COLUMNS = 2;
|
|
70
|
+
const ENTER_CHIP_WIDTH = 50;
|
|
71
|
+
const ARROW_KEYS = ["↑", "↓", "←", "→"];
|
|
72
|
+
const ENTER_KEY = (0, AppSwitcherProps_1.shortcutKeys)("enter")[0];
|
|
65
73
|
const DEFAULT_LABELS = {
|
|
66
74
|
title: "Menu",
|
|
67
75
|
searchPlaceholder: "Search menus and screens",
|
|
@@ -98,8 +106,6 @@ const DEFAULT_LABELS = {
|
|
|
98
106
|
footerNote: "Pins follow your account",
|
|
99
107
|
suggestionsHint: "Try one of these",
|
|
100
108
|
};
|
|
101
|
-
const isApplePlatform = () => typeof navigator !== "undefined" &&
|
|
102
|
-
/Mac|iPhone|iPad/.test(navigator.platform);
|
|
103
109
|
const visibleSections = (sections) => sections
|
|
104
110
|
.map((section) => ({
|
|
105
111
|
...section,
|
|
@@ -122,15 +128,15 @@ const GRID_COLUMNS = {
|
|
|
122
128
|
md: "repeat(2, minmax(0, 1fr))",
|
|
123
129
|
xl: "repeat(3, minmax(0, 1fr))",
|
|
124
130
|
};
|
|
125
|
-
function ItemGrid({ children }) {
|
|
126
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Box, { "data-nav-grid": true, display: "grid", gridTemplateColumns: GRID_COLUMNS, gap: "1px 8px", alignItems: "start", children: children }));
|
|
131
|
+
function ItemGrid({ children, columns, }) {
|
|
132
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Box, { "data-nav-grid": true, "data-nav-columns": columns, display: "grid", gridTemplateColumns: GRID_COLUMNS, gap: "1px 8px", alignItems: "start", children: children }));
|
|
127
133
|
}
|
|
128
134
|
function Pane({ children }) {
|
|
129
135
|
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { direction: "column", gap: "14px", flex: 1, minW: 0, px: "18px", pt: "12px", pb: "16px", overflowY: { base: "visible", lg: "auto" }, children: children }));
|
|
130
136
|
}
|
|
131
137
|
function Rail({ label, children }) {
|
|
132
138
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
133
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { as: "aside", "aria-label": label, direction: "column", gap: "16px", w: { base: "100%", lg:
|
|
139
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { as: "aside", "aria-label": label, direction: "column", gap: "16px", w: { base: "100%", lg: RAIL_WIDTH }, flexShrink: 0, px: "14px", pt: "12px", pb: "16px", bg: colors.backgroundColor.subtle, borderTopWidth: { base: "1px", lg: 0 }, borderLeftWidth: { base: 0, lg: "1px" }, borderColor: colors.boxborder[200], overflowY: { base: "visible", lg: "auto" }, children: children }));
|
|
134
140
|
}
|
|
135
141
|
function SkeletonLayout({ label }) {
|
|
136
142
|
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))) })] }));
|
|
@@ -149,13 +155,25 @@ function SearchRow({ item, query, isActive, link, labels, optionId, isPinned, ca
|
|
|
149
155
|
const hasStar = Boolean(item.screenId) && canPin;
|
|
150
156
|
const base = item.badge ? 24 : 0;
|
|
151
157
|
const open = base + (hasStar ? 46 : item.href ? 24 : 0);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
const fullLabel = isScreen ? `${item.label} — ${item.context}` : item.label;
|
|
159
|
+
const title = (0, useIsTruncated_1.useIsTruncated)(fullLabel);
|
|
160
|
+
const context = (0, useIsTruncated_1.useIsTruncated)(item.context);
|
|
161
|
+
const titleRef = title.ref;
|
|
162
|
+
const contextRef = context.ref;
|
|
163
|
+
const tipLabel = isScreen || !item.context ? fullLabel : `${fullLabel} · ${item.context}`;
|
|
164
|
+
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: "34px", pl: "8px", pr: "4px", pt: "7px", pb: "5px", borderRadius: "8px", transition: (0, motion_1.transitionFor)(["background-color"]), onMouseMove: onHover, sx: isActive
|
|
165
|
+
? { ...launcherParts_1.ROW_CONTAINER, ...(0, launcherParts_1.activeRowSurface)(colors) }
|
|
166
|
+
: 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: () => {
|
|
167
|
+
if (!item.href)
|
|
168
|
+
onOpen();
|
|
169
|
+
}, 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: {
|
|
170
|
+
display: "none",
|
|
171
|
+
[launcherParts_1.WIDE_ROW]: { display: "inline-flex" },
|
|
172
|
+
"@media (hover: none)": { display: "none" },
|
|
173
|
+
}, 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), linkAs: link.linkAs, tabIndex: -1 })) : null] }) }), hasStar ? ((0, jsx_runtime_1.jsx)(launcherParts_1.RowTip, { text: isPinned ? labels.unpinTip : labels.pinTip })) : null] }) }));
|
|
156
174
|
}
|
|
157
175
|
/** Left-drawer navigation launcher: browse every module, pins, Frequent, Recent, search and (compact) the suite's apps. */
|
|
158
|
-
function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, frequentIds, recentIds, onTogglePin, onNavigate, linkAs = "a", actions, extraResults, query: controlledQuery, onQueryChange, isSearching = false, isLoading = false, keyScreenLimit = 3, frequentLimit = 4, suggestions, searchHint, openShortcutHint, modKeyLabel, maxWidth = "
|
|
176
|
+
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 = "1080px", labels: labelOverrides, apps, currentAppId, onAppSelect, appsVisibility = "apps-on-compact", "data-testid": testId, }) {
|
|
159
177
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
160
178
|
const { colors } = theme;
|
|
161
179
|
const inputRef = (0, react_2.useRef)(null);
|
|
@@ -206,6 +224,7 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
206
224
|
const results = (0, react_2.useMemo)(() => groups.flatMap((g) => g.items), [groups]);
|
|
207
225
|
const groupStarts = (0, react_2.useMemo)(() => groups.map((_, i) => groups.slice(0, i).reduce((n, g) => n + g.items.length, 0)), [groups]);
|
|
208
226
|
const isSearchView = query.trim().length > 0;
|
|
227
|
+
const active = Math.min(activeIndex, Math.max(results.length - 1, 0));
|
|
209
228
|
const link = (0, react_2.useMemo)(() => ({
|
|
210
229
|
linkAs,
|
|
211
230
|
onPlainClick: (event) => {
|
|
@@ -226,16 +245,20 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
226
245
|
onNavigate(item.href, { newTab });
|
|
227
246
|
}, [onClose, onNavigate]);
|
|
228
247
|
const moveFocus = (delta) => {
|
|
229
|
-
var _a, _b;
|
|
248
|
+
var _a, _b, _c;
|
|
230
249
|
const items = Array.from((_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(launcherParts_1.ITEM_SELECTOR)) !== null && _b !== void 0 ? _b : []);
|
|
231
250
|
if (items.length === 0)
|
|
232
251
|
return;
|
|
233
252
|
const current = items.indexOf(document.activeElement);
|
|
253
|
+
if (typeof delta === "number" && current + delta < 0) {
|
|
254
|
+
(_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
234
257
|
const next = delta === "first"
|
|
235
258
|
? 0
|
|
236
259
|
: delta === "last"
|
|
237
260
|
? items.length - 1
|
|
238
|
-
: Math.min(items.length - 1,
|
|
261
|
+
: Math.min(items.length - 1, current + delta);
|
|
239
262
|
items[next].focus();
|
|
240
263
|
};
|
|
241
264
|
const onInputKeyDown = (event) => {
|
|
@@ -250,15 +273,15 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
250
273
|
return;
|
|
251
274
|
if (event.key === "ArrowDown") {
|
|
252
275
|
event.preventDefault();
|
|
253
|
-
setActiveIndex((
|
|
276
|
+
setActiveIndex((active + 1) % results.length);
|
|
254
277
|
}
|
|
255
278
|
else if (event.key === "ArrowUp") {
|
|
256
279
|
event.preventDefault();
|
|
257
|
-
setActiveIndex((
|
|
280
|
+
setActiveIndex((active - 1 + results.length) % results.length);
|
|
258
281
|
}
|
|
259
|
-
else if (event.key === "Enter") {
|
|
282
|
+
else if (event.key === "Enter" && !event.nativeEvent.isComposing) {
|
|
260
283
|
event.preventDefault();
|
|
261
|
-
open(results[
|
|
284
|
+
open(results[active], event.metaKey || event.ctrlKey);
|
|
262
285
|
}
|
|
263
286
|
};
|
|
264
287
|
const moveInGrid = (event, cell) => {
|
|
@@ -272,6 +295,7 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
272
295
|
return;
|
|
273
296
|
}
|
|
274
297
|
const down = event.key === "ArrowDown";
|
|
298
|
+
const columns = Number(grid === null || grid === void 0 ? void 0 : grid.dataset.navColumns);
|
|
275
299
|
const within = cells[index + (down ? columns : -columns)];
|
|
276
300
|
if (within)
|
|
277
301
|
return focusCell(within);
|
|
@@ -310,8 +334,8 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
310
334
|
return true;
|
|
311
335
|
};
|
|
312
336
|
const onBodyKeyDown = (event) => {
|
|
313
|
-
var _a;
|
|
314
|
-
if (
|
|
337
|
+
var _a, _b;
|
|
338
|
+
if (event.target === inputRef.current)
|
|
315
339
|
return;
|
|
316
340
|
const isArrow = event.key.startsWith("Arrow");
|
|
317
341
|
const cell = event.target.closest(CELL_SELECTOR);
|
|
@@ -327,6 +351,11 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
327
351
|
event.preventDefault();
|
|
328
352
|
moveFocus(event.key === "Home" ? "first" : "last");
|
|
329
353
|
}
|
|
354
|
+
else if (event.key === "Backspace" && query) {
|
|
355
|
+
event.preventDefault();
|
|
356
|
+
setQuery(query.slice(0, -1));
|
|
357
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
358
|
+
}
|
|
330
359
|
else if (event.key.length === 1 &&
|
|
331
360
|
!event.metaKey &&
|
|
332
361
|
!event.ctrlKey &&
|
|
@@ -336,14 +365,42 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
336
365
|
return;
|
|
337
366
|
event.preventDefault();
|
|
338
367
|
setQuery(query + event.key);
|
|
339
|
-
(
|
|
368
|
+
(_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
340
369
|
}
|
|
341
370
|
};
|
|
342
371
|
(0, react_2.useEffect)(() => {
|
|
343
372
|
var _a, _b, _c;
|
|
344
373
|
(_c = (_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[data-active="true"]')) === null || _b === void 0 ? void 0 : _b.scrollIntoView) === null || _c === void 0 ? void 0 : _c.call(_b, { block: "nearest" });
|
|
345
|
-
}, [
|
|
374
|
+
}, [active, results]);
|
|
375
|
+
const lastItemIndex = (0, react_2.useRef)(-1);
|
|
376
|
+
(0, react_2.useEffect)(() => {
|
|
377
|
+
if (!isOpen)
|
|
378
|
+
return undefined;
|
|
379
|
+
const remember = (event) => {
|
|
380
|
+
var _a, _b;
|
|
381
|
+
const items = Array.from((_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(launcherParts_1.ITEM_SELECTOR)) !== null && _b !== void 0 ? _b : []);
|
|
382
|
+
lastItemIndex.current = items.indexOf(event.target);
|
|
383
|
+
};
|
|
384
|
+
const forget = () => {
|
|
385
|
+
lastItemIndex.current = -1;
|
|
386
|
+
};
|
|
387
|
+
document.addEventListener("focusin", remember);
|
|
388
|
+
document.addEventListener("pointerdown", forget);
|
|
389
|
+
return () => {
|
|
390
|
+
document.removeEventListener("focusin", remember);
|
|
391
|
+
document.removeEventListener("pointerdown", forget);
|
|
392
|
+
};
|
|
393
|
+
}, [isOpen]);
|
|
346
394
|
const appList = apps !== null && apps !== void 0 ? apps : NO_APPS;
|
|
395
|
+
(0, react_2.useEffect)(() => {
|
|
396
|
+
var _a, _b;
|
|
397
|
+
if (lastItemIndex.current < 0 || document.activeElement !== document.body)
|
|
398
|
+
return;
|
|
399
|
+
const items = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(launcherParts_1.ITEM_SELECTOR);
|
|
400
|
+
if (!(items === null || items === void 0 ? void 0 : items.length))
|
|
401
|
+
return (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
402
|
+
items[Math.min(lastItemIndex.current, items.length - 1)].focus();
|
|
403
|
+
}, [appList]);
|
|
347
404
|
const hues = (0, react_2.useMemo)(() => (0, AppMark_1.assignAppHues)(appList, (0, chartColorsFromTheme_1.chartMode)(colors)), [appList, colors]);
|
|
348
405
|
const showApps = appList.some((app) => app.id !== currentAppId) &&
|
|
349
406
|
(appsVisibility === "always" || !isDesktop);
|
|
@@ -361,8 +418,8 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
361
418
|
const railFrequent = frequentItems
|
|
362
419
|
.filter(({ screen }) => !pinned.has(screen.id))
|
|
363
420
|
.slice(0, frequentLimit);
|
|
364
|
-
const rail = ((0, jsx_runtime_1.jsxs)(Rail, { label: labels.quickAccess, 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, { display: "grid", gridTemplateColumns:
|
|
365
|
-
const browsePane = sections.length === 0 ? ((0, jsx_runtime_1.jsx)(EmptyState_1.default, { title: labels.empty, titleAs: "h3", size: "sm" })) : (sections.map((section) => ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "section", "aria-label": section.label, direction: "column", gap: "3px", children: [(0, jsx_runtime_1.jsx)(launcherParts_1.SectionHeader, { label: section.label, meta: `(${section.modules.length})` }), (0, jsx_runtime_1.jsx)(ItemGrid, { children: section.modules.map((module) => {
|
|
421
|
+
const rail = ((0, jsx_runtime_1.jsxs)(Rail, { label: labels.quickAccess, 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": PINNED_COLUMNS, display: "grid", gridTemplateColumns: `repeat(${PINNED_COLUMNS}, 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), 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), linkAs: link.linkAs }) }, screen.id)))] })) : null, appsBlock] }));
|
|
422
|
+
const browsePane = sections.length === 0 ? ((0, jsx_runtime_1.jsx)(EmptyState_1.default, { title: labels.empty, titleAs: "h3", size: "sm" })) : (sections.map((section) => ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "section", "aria-label": section.label, direction: "column", gap: "3px", children: [(0, jsx_runtime_1.jsx)(launcherParts_1.SectionHeader, { label: section.label, meta: `(${section.modules.length})` }), (0, jsx_runtime_1.jsx)(ItemGrid, { columns: columns, children: section.modules.map((module) => {
|
|
366
423
|
const pinId = module.screens[0].id;
|
|
367
424
|
return ((0, jsx_runtime_1.jsx)(launcherParts_1.ModuleRow, { module: module, keyScreens: module.screens
|
|
368
425
|
.filter((s) => s.isKey && s.href !== module.href)
|
|
@@ -376,9 +433,9 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
376
433
|
const noResults = ((0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", align: "center", gap: "12px", py: "48px", px: "20px", textAlign: "center", role: "status", children: [(0, jsx_runtime_1.jsx)(react_1.Flex, { boxSize: "40px", borderRadius: "12px", bg: colors.backgroundColor.subtle, color: colors.textMuted, align: "center", justify: "center", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Search, { size: 18, strokeWidth: 2, "aria-hidden": true }) }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { direction: "column", gap: "3px", children: [(0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "14px", fontWeight: 600, color: colors.text[900], children: isSearching ? labels.searching : labels.noResults(trimmed) }), isSearching ? null : ((0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "12.5px", color: colors.textMuted, children: (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length)
|
|
377
434
|
? labels.suggestionsHint
|
|
378
435
|
: labels.noResultsHint }))] }), !isSearching && (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) ? ((0, jsx_runtime_1.jsx)(react_1.Flex, { wrap: "wrap", justify: "center", gap: "6px", children: suggestions.map((suggestion) => ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "button", type: "button", onClick: () => pickSuggestion(suggestion), h: "28px", px: "11px", borderRadius: "full", borderWidth: "1px", borderColor: colors.boxborder[200], bg: colors.surfaceRaised, fontSize: "12.5px", fontWeight: 500, color: colors.text[900], transition: (0, motion_1.transitionFor)(["background-color"]), _hover: { bg: (0, rowStates_1.listRowBackgrounds)(colors).active }, sx: (0, focusRing_styles_1.focusVisibleStyles)(colors), children: suggestion }, suggestion))) })) : null] }));
|
|
379
|
-
const searchPane = hasResults ? ((0, jsx_runtime_1.jsx)(react_1.Flex, { role: "listbox", id: listboxId, "aria-label": labels.title, "aria-busy": isSearching || undefined, direction: "column", gap: "14px", children: groups.map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Flex, { role: "group", "aria-label": group.meta ? `${group.label}, ${group.meta}` : group.label, direction: "column", gap: "3px", children: [(0, jsx_runtime_1.jsx)(launcherParts_1.SectionHeader, { label: group.label, meta: group.meta ? `(${group.meta})` : undefined, isDecorative: true }), (0, jsx_runtime_1.jsx)(ItemGrid, { children: group.items.map((item, itemIndex) => {
|
|
436
|
+
const searchPane = hasResults ? ((0, jsx_runtime_1.jsx)(react_1.Flex, { role: "listbox", id: listboxId, "aria-label": labels.title, "aria-busy": isSearching || undefined, direction: "column", gap: "14px", children: groups.map((group, groupIndex) => ((0, jsx_runtime_1.jsxs)(react_1.Flex, { role: "group", "aria-label": group.meta ? `${group.label}, ${group.meta}` : group.label, direction: "column", gap: "3px", children: [(0, jsx_runtime_1.jsx)(launcherParts_1.SectionHeader, { label: group.label, meta: group.meta ? `(${group.meta})` : undefined, isDecorative: true }), (0, jsx_runtime_1.jsx)(ItemGrid, { columns: columns, children: group.items.map((item, itemIndex) => {
|
|
380
437
|
const index = groupStarts[groupIndex] + itemIndex;
|
|
381
|
-
return ((0, jsx_runtime_1.jsx)(SearchRow, { item: item, query: query, isActive: index ===
|
|
438
|
+
return ((0, jsx_runtime_1.jsx)(SearchRow, { item: item, query: query, isActive: index === active, link: link, labels: labels, optionId: optionId(index), isPinned: item.screenId ? pinned.has(item.screenId) : false, canPin: Boolean(onTogglePin) && item.kind === "module", onPin: () => item.screenId && (onTogglePin === null || onTogglePin === void 0 ? void 0 : onTogglePin(item.screenId)), onOpen: () => open(item, false), onHover: () => setActiveIndex(index) }, item.id));
|
|
382
439
|
}) })] }, group.id))) })) : (noResults);
|
|
383
440
|
const body = isLoading ? ((0, jsx_runtime_1.jsx)(SkeletonLayout, { label: labels.loading })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Pane, { children: isSearchView ? searchPane : browsePane }), rail] }));
|
|
384
441
|
const pill = (0, filledSurface_1.resolveFilledSurface)(colors.primary, colors);
|
|
@@ -391,5 +448,5 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
391
448
|
boxShadow: colors.boxShadow.default,
|
|
392
449
|
overflow: "hidden",
|
|
393
450
|
...{ "data-testid": testId },
|
|
394
|
-
}, children: [(0, jsx_runtime_1.jsx)(Drawer_1.DrawerHeader, { p: 0, flexShrink: 0, children: (0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: "12px", h: "60px", pl: "18px", pr: "12px", children: [(0, jsx_runtime_1.jsxs)(react_1.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: [(0, jsx_runtime_1.jsx)(lucide_react_1.Compass, { size: 16, strokeWidth: 2, "aria-hidden": true }), labels.title] }), (0, jsx_runtime_1.jsx)(SearchField, { inputRef: inputRef, value: query, onChange: setQuery, onKeyDown: onInputKeyDown, labels: labels, hint: searchHint, listboxId: listboxId, activeId: isSearchView && hasResults ? optionId(
|
|
451
|
+
}, children: [(0, jsx_runtime_1.jsx)(Drawer_1.DrawerHeader, { p: 0, flexShrink: 0, children: (0, jsx_runtime_1.jsxs)(react_1.Flex, { align: "center", gap: "12px", h: "60px", pl: "18px", pr: "12px", children: [(0, jsx_runtime_1.jsxs)(react_1.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: [(0, jsx_runtime_1.jsx)(lucide_react_1.Compass, { size: 16, strokeWidth: 2, "aria-hidden": true }), labels.title] }), (0, jsx_runtime_1.jsx)(SearchField, { inputRef: inputRef, value: query, onChange: setQuery, onKeyDown: onInputKeyDown, labels: labels, hint: searchHint, listboxId: listboxId, activeId: isSearchView && hasResults ? optionId(active) : undefined, isExpanded: isSearchView, hasResults: hasResults }), (0, jsx_runtime_1.jsx)(react_1.IconButton, { "aria-label": labels.close, icon: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: 18, "aria-hidden": true }), variant: "ghost", boxSize: "34px", minW: "34px", borderRadius: "9px", color: colors.textMuted, ml: "auto", onClick: onClose })] }) }), (0, jsx_runtime_1.jsx)(Drawer_1.DrawerBody, { p: 0, display: "flex", flexDirection: { base: "column", lg: "row" }, overflowY: { base: "auto", lg: "hidden" }, minH: 0, children: (0, jsx_runtime_1.jsx)(react_1.Flex, { ref: bodyRef, onKeyDown: onBodyKeyDown, direction: { base: "column", lg: "row" }, flex: 1, minH: 0, minW: 0, children: body }) }), (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: [openShortcutHint ? ((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: openShortcutHint }), labels.hintOpenMenu] })) : null, (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] }), onTogglePin ? ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: "5px", children: [(0, jsx_runtime_1.jsx)(Kbd_1.default, { size: "xs", children: "P" }), labels.hintPin] })) : null, (0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "span", align: "center", gap: "5px", children: [(0, jsx_runtime_1.jsx)(Kbd_1.KbdShortcut, { shortcut: "esc", size: "xs" }), labels.hintClose] })] }), (0, jsx_runtime_1.jsx)(react_1.Text, { as: "span", ml: "auto", children: labels.footerNote })] })] }));
|
|
395
452
|
}
|
|
@@ -74,15 +74,15 @@ export type LauncherLabels = {
|
|
|
74
74
|
loading: string;
|
|
75
75
|
/** Heading of the empty state shown when `sections` has nothing to render. */
|
|
76
76
|
empty: string;
|
|
77
|
-
/** Footer hint after the
|
|
77
|
+
/** Footer hint after the four arrow key caps. */
|
|
78
78
|
hintMove: string;
|
|
79
|
-
/** Footer hint after the
|
|
79
|
+
/** Footer hint after the ENTER key cap. */
|
|
80
80
|
hintOpen: string;
|
|
81
|
-
/** Footer hint after the mod
|
|
81
|
+
/** Footer hint after the mod + ENTER key caps. */
|
|
82
82
|
hintNewTab: string;
|
|
83
83
|
/** Footer hint after the P key cap. */
|
|
84
84
|
hintPin: string;
|
|
85
|
-
/** Footer hint after the
|
|
85
|
+
/** Footer hint after the ESC key cap. */
|
|
86
86
|
hintClose: string;
|
|
87
87
|
/** Footer hint after `openShortcutHint`; only rendered when that prop is set. */
|
|
88
88
|
hintOpenMenu: string;
|
|
@@ -148,9 +148,9 @@ export interface NavLauncherProps {
|
|
|
148
148
|
searchHint?: string;
|
|
149
149
|
/** Chord that opens the launcher in the host app, e.g. "⌘K or /"; shown as the first footer hint. Omit when the app does not own one. */
|
|
150
150
|
openShortcutHint?: string;
|
|
151
|
-
/**
|
|
151
|
+
/** Replaces the modifier cap of the mod+Enter hint; defaults to "⌘" on Apple platforms, "Ctrl" elsewhere. */
|
|
152
152
|
modKeyLabel?: string;
|
|
153
|
-
/** Panel width at `lg`+; always full width below `lg`. Defaults to "
|
|
153
|
+
/** Panel width at `lg`+; always full width below `lg`. Defaults to "1080px". */
|
|
154
154
|
maxWidth?: string;
|
|
155
155
|
labels?: Partial<LauncherLabels>;
|
|
156
156
|
/** Other Pixelize apps, shown as an "Apps" section at the bottom of the right rail. Same shape as AppSwitcher. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ElementType, type KeyboardEvent, type MouseEvent, type ReactNode } from "react";
|
|
1
|
+
import { type ElementType, type FocusEvent, type KeyboardEvent, type MouseEvent, type ReactNode } from "react";
|
|
2
|
+
import type { PaletteProps } from "../../Theme/tokens/types";
|
|
2
3
|
import type { AppOption } from "../AppSwitcher/AppSwitcherProps";
|
|
3
4
|
import type { LauncherLabels, LauncherModule, LauncherScreen } from "./NavLauncherProps";
|
|
4
5
|
export declare const ITEM_SELECTOR = "[data-launcher-item]";
|
|
@@ -7,6 +8,64 @@ export type LinkCtx = {
|
|
|
7
8
|
linkAs: ElementType;
|
|
8
9
|
onPlainClick: (event: MouseEvent) => void;
|
|
9
10
|
};
|
|
11
|
+
export declare const WIDE_ROW = "@container launcher-row (min-width: 300px)";
|
|
12
|
+
export declare const ROW_CONTAINER: {
|
|
13
|
+
containerType: string;
|
|
14
|
+
containerName: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const activeRowStyle: (colors: PaletteProps) => {
|
|
17
|
+
edge: string;
|
|
18
|
+
fill: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const activeRowSurface: (colors: PaletteProps) => {
|
|
21
|
+
backgroundColor: string;
|
|
22
|
+
boxShadow: string;
|
|
23
|
+
outline: string;
|
|
24
|
+
outlineOffset: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const titleInset: (base: number, open: number, chip?: number) => {
|
|
27
|
+
"@container launcher-row (max-width: 219px)": {
|
|
28
|
+
"[data-group]:hover &, [data-group]:focus-within &, [data-group][data-reveal=true] &": {
|
|
29
|
+
"--row-pr": string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
"@container launcher-row (min-width: 300px)"?: {
|
|
33
|
+
"[data-group][data-reveal=true] &": {
|
|
34
|
+
"--row-pr": string;
|
|
35
|
+
};
|
|
36
|
+
} | undefined;
|
|
37
|
+
paddingRight: string;
|
|
38
|
+
"--row-pr": string;
|
|
39
|
+
"[data-group]:hover &, [data-group]:focus-within &, [data-group][data-reveal=true] &": {
|
|
40
|
+
"--row-pr": string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare const useRowFocus: (isBordered?: boolean) => {
|
|
44
|
+
sx: {
|
|
45
|
+
"&[data-row-focus]": {
|
|
46
|
+
backgroundColor: string;
|
|
47
|
+
boxShadow: string;
|
|
48
|
+
outline: string;
|
|
49
|
+
outlineOffset: string;
|
|
50
|
+
} | {
|
|
51
|
+
backgroundColor: string;
|
|
52
|
+
borderColor: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
primary: {
|
|
56
|
+
onFocus: (event: FocusEvent<HTMLElement>) => boolean | undefined;
|
|
57
|
+
onBlur: (event: FocusEvent<HTMLElement>) => boolean | undefined;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export declare const stretchedLink: (radius: string) => {
|
|
61
|
+
outline: string;
|
|
62
|
+
_after: {
|
|
63
|
+
content: string;
|
|
64
|
+
position: string;
|
|
65
|
+
inset: number;
|
|
66
|
+
borderRadius: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
10
69
|
export declare const useRowHover: () => {
|
|
11
70
|
bg: string;
|
|
12
71
|
_hover: {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useRowHover = exports.isPlainClick = exports.ITEM_SELECTOR = void 0;
|
|
6
|
+
exports.useRowHover = exports.stretchedLink = exports.useRowFocus = exports.titleInset = exports.activeRowSurface = exports.activeRowStyle = exports.ROW_CONTAINER = exports.WIDE_ROW = exports.isPlainClick = exports.ITEM_SELECTOR = void 0;
|
|
7
7
|
exports.CountBadge = CountBadge;
|
|
8
8
|
exports.NewTag = NewTag;
|
|
9
9
|
exports.SectionHeader = SectionHeader;
|
|
@@ -22,9 +22,11 @@ const lucide_react_1 = require("lucide-react");
|
|
|
22
22
|
const react_2 = require("react");
|
|
23
23
|
const focusRing_styles_1 = require("../../Theme/chakra/focusRing.styles");
|
|
24
24
|
const filledSurface_1 = require("../../Theme/tokens/builders/filledSurface");
|
|
25
|
+
const outlineRung_1 = require("../../Theme/tokens/builders/outlineRung");
|
|
25
26
|
const rowStates_1 = require("../../Theme/tokens/builders/rowStates");
|
|
26
27
|
const motion_1 = require("../../Theme/tokens/primitives/motion");
|
|
27
28
|
const useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
29
|
+
const OverflowToolTip_1 = __importDefault(require("../ToolTip/OverflowToolTip"));
|
|
28
30
|
const AppMark_1 = __importDefault(require("../AppSwitcher/AppMark"));
|
|
29
31
|
const match_1 = require("./match");
|
|
30
32
|
const NewTabLink_1 = __importDefault(require("./NewTabLink"));
|
|
@@ -37,6 +39,71 @@ const isPlainClick = (event) => event.button === 0 &&
|
|
|
37
39
|
!event.shiftKey &&
|
|
38
40
|
!event.altKey;
|
|
39
41
|
exports.isPlainClick = isPlainClick;
|
|
42
|
+
const ROW_FOCUS = "data-row-focus";
|
|
43
|
+
const ROW_PR = "--row-pr";
|
|
44
|
+
const REVEALED = "[data-group]:hover &, [data-group]:focus-within &, [data-group][data-reveal=true] &";
|
|
45
|
+
const NARROW_ROW = "@container launcher-row (max-width: 219px)";
|
|
46
|
+
exports.WIDE_ROW = "@container launcher-row (min-width: 300px)";
|
|
47
|
+
exports.ROW_CONTAINER = {
|
|
48
|
+
containerType: "inline-size",
|
|
49
|
+
containerName: "launcher-row",
|
|
50
|
+
};
|
|
51
|
+
const activeRowStyle = (colors) => {
|
|
52
|
+
const fill = (0, rowStates_1.listRowBackgrounds)(colors).active;
|
|
53
|
+
const edge = (0, outlineRung_1.liftToContrast)((0, outlineRung_1.liftToContrast)(colors.primary[500], fill, outlineRung_1.AA_NON_TEXT), colors.surfaceRaised, outlineRung_1.AA_NON_TEXT);
|
|
54
|
+
return { edge, fill };
|
|
55
|
+
};
|
|
56
|
+
exports.activeRowStyle = activeRowStyle;
|
|
57
|
+
const activeRowSurface = (colors) => {
|
|
58
|
+
const { edge, fill } = (0, exports.activeRowStyle)(colors);
|
|
59
|
+
return {
|
|
60
|
+
backgroundColor: fill,
|
|
61
|
+
boxShadow: `inset 0 0 0 1px ${edge}`,
|
|
62
|
+
outline: "2px solid transparent",
|
|
63
|
+
outlineOffset: "-2px",
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
exports.activeRowSurface = activeRowSurface;
|
|
67
|
+
const titleInset = (base, open, chip = 0) => ({
|
|
68
|
+
paddingRight: `var(${ROW_PR})`,
|
|
69
|
+
[ROW_PR]: `${base}px`,
|
|
70
|
+
[REVEALED]: { [ROW_PR]: `${open}px` },
|
|
71
|
+
...(chip
|
|
72
|
+
? {
|
|
73
|
+
[exports.WIDE_ROW]: {
|
|
74
|
+
"[data-group][data-reveal=true] &": { [ROW_PR]: `${open + chip}px` },
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
: {}),
|
|
78
|
+
[NARROW_ROW]: { [REVEALED]: { [ROW_PR]: `${base}px` } },
|
|
79
|
+
});
|
|
80
|
+
exports.titleInset = titleInset;
|
|
81
|
+
const markRowFocus = (event, isOn) => { var _a; return (_a = event.currentTarget.closest("[data-group]")) === null || _a === void 0 ? void 0 : _a.toggleAttribute(ROW_FOCUS, isOn); };
|
|
82
|
+
const useRowFocus = (isBordered = false) => {
|
|
83
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
84
|
+
const { edge, fill } = (0, exports.activeRowStyle)(colors);
|
|
85
|
+
const lit = isBordered
|
|
86
|
+
? { backgroundColor: fill, borderColor: edge }
|
|
87
|
+
: (0, exports.activeRowSurface)(colors);
|
|
88
|
+
return {
|
|
89
|
+
sx: { [`&[${ROW_FOCUS}]`]: lit },
|
|
90
|
+
primary: {
|
|
91
|
+
onFocus: (event) => markRowFocus(event, event.currentTarget.matches(":focus-visible")),
|
|
92
|
+
onBlur: (event) => markRowFocus(event, false),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
exports.useRowFocus = useRowFocus;
|
|
97
|
+
const stretchedLink = (radius) => ({
|
|
98
|
+
outline: "none",
|
|
99
|
+
_after: {
|
|
100
|
+
content: '""',
|
|
101
|
+
position: "absolute",
|
|
102
|
+
inset: 0,
|
|
103
|
+
borderRadius: radius,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
exports.stretchedLink = stretchedLink;
|
|
40
107
|
const useRowHover = () => {
|
|
41
108
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
42
109
|
const hover = (0, rowStates_1.listRowBackgrounds)(colors).active;
|
|
@@ -67,10 +134,19 @@ function RowIcon({ icon: Icon, size, stroke = 1.75, mt }) {
|
|
|
67
134
|
}
|
|
68
135
|
function Highlight({ text, query }) {
|
|
69
136
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
70
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, match_1.highlightSegments)(text, query).map((segment, i) => segment.isMatch ? ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "mark", bg:
|
|
137
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, match_1.highlightSegments)(text, query).map((segment, i) => segment.isMatch ? ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "mark", bg: "transparent", color: "inherit", fontWeight: 650, textDecoration: "underline", textDecorationColor: colors.primary.opacity[48], textDecorationThickness: "1.5px", textUnderlineOffset: "2px", children: segment.text }, i)) : ((0, jsx_runtime_1.jsx)(react_2.Fragment, { children: segment.text }, i))) }));
|
|
71
138
|
}
|
|
72
139
|
function RowActions({ children }) {
|
|
73
|
-
|
|
140
|
+
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
141
|
+
const revealed = REVEALED.replace(/ &/g, " > &");
|
|
142
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { sx: {
|
|
143
|
+
[NARROW_ROW]: {
|
|
144
|
+
[revealed]: {
|
|
145
|
+
backgroundColor: (0, exports.activeRowStyle)(colors).fill,
|
|
146
|
+
borderRadius: "6px",
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
}, position: "absolute", top: "7px", right: "4px", h: "19px", align: "center", gap: "2px", zIndex: 1, children: children }));
|
|
74
150
|
}
|
|
75
151
|
function RowTip({ text }) {
|
|
76
152
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
@@ -79,19 +155,21 @@ function RowTip({ text }) {
|
|
|
79
155
|
function ModuleRow({ module, keyScreens, isPinned, onTogglePin, pinId, labels, link, }) {
|
|
80
156
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
81
157
|
const hover = (0, exports.useRowHover)();
|
|
158
|
+
const focus = (0, exports.useRowFocus)();
|
|
82
159
|
const ring = (0, focusRing_styles_1.focusVisibleStyles)(colors);
|
|
83
160
|
const base = typeof module.badge === "number" || module.badge ? 24 : 0;
|
|
84
161
|
const open = base + (onTogglePin ? 46 : 24);
|
|
85
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.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: (0, motion_1.transitionFor)(["background-color"]), _hover: hover._hover, _focusWithin: hover._focusWithin, children: [(0, jsx_runtime_1.jsx)(RowIcon, { icon: module.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", h: "19px", minW: 0,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
162
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.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: (0, motion_1.transitionFor)(["background-color"]), _hover: hover._hover, _focusWithin: hover._focusWithin, sx: { ...focus.sx, ...exports.ROW_CONTAINER }, children: [(0, jsx_runtime_1.jsx)(RowIcon, { icon: module.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", h: "19px", minW: 0, sx: (0, exports.titleInset)(base, open), children: [(0, jsx_runtime_1.jsx)(OverflowToolTip_1.default, { label: module.label, placement: "top-start", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: link.linkAs, href: module.href, "data-launcher-item": true, ...focus.primary, "data-pin-id": onTogglePin ? pinId : undefined, onClick: link.onPlainClick, minW: 0, fontSize: "13.5px", fontWeight: 500, color: colors.text[900], noOfLines: 1, borderRadius: "sm", sx: (0, exports.stretchedLink)("8px"), children: module.label }) }), module.isNew ? (0, jsx_runtime_1.jsx)(NewTag, { label: labels.newBadge }) : null] }), keyScreens.length ? ((0, jsx_runtime_1.jsx)(OverflowToolTip_1.default, { label: keyScreens.map((screen) => screen.label).join(" · "), placement: "bottom-start", children: (0, jsx_runtime_1.jsx)(react_1.Box, { role: "group", "aria-label": `${module.label} ${labels.screens}`, position: "relative", zIndex: 1, w: "fit-content", maxW: "100%", fontSize: "11.5px", lineHeight: "15px", color: colors.textMuted, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", children: keyScreens.map((screen, i) => ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [i > 0 ? ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", "aria-hidden": true, mx: "5px", opacity: 0.7, children: "\u00B7" })) : null, (0, jsx_runtime_1.jsx)(react_1.Box, { as: link.linkAs, href: screen.href, "data-launcher-item": true, onClick: link.onPlainClick, color: "inherit", borderRadius: "sm", position: "relative", zIndex: 1, _hover: {
|
|
163
|
+
textDecoration: "underline",
|
|
164
|
+
textUnderlineOffset: "2px",
|
|
165
|
+
}, sx: ring, children: screen.label })] }, screen.id))) }) })) : null] }), (0, jsx_runtime_1.jsxs)(RowActions, { children: [(0, jsx_runtime_1.jsx)(CountBadge, { value: module.badge }), onTogglePin ? ((0, jsx_runtime_1.jsx)(PinToggle_1.default, { isPinned: isPinned, label: isPinned ? labels.unpin(module.label) : labels.pin(module.label), title: "", onToggle: onTogglePin })) : null, (0, jsx_runtime_1.jsx)(NewTabLink_1.default, { href: module.href, label: labels.openInNewTab(module.label), linkAs: link.linkAs })] }), onTogglePin ? ((0, jsx_runtime_1.jsx)(RowTip, { text: isPinned ? labels.unpinTip : labels.pinTip })) : null] }));
|
|
89
166
|
}
|
|
90
167
|
function RailRow({ screen, module, link, isStrong = false, trailing, pinId, }) {
|
|
91
168
|
var _a;
|
|
92
169
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
93
170
|
const hover = (0, exports.useRowHover)();
|
|
94
|
-
|
|
171
|
+
const focus = (0, exports.useRowFocus)();
|
|
172
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { "data-group": true, position: "relative", align: "center", gap: "10px", h: "32px", pl: "8px", pr: "4px", borderRadius: "8px", transition: (0, motion_1.transitionFor)(["background-color"]), _hover: hover._hover, _focusWithin: hover._focusWithin, sx: focus.sx, children: [(0, jsx_runtime_1.jsx)(RowIcon, { icon: (_a = screen.icon) !== null && _a !== void 0 ? _a : module.icon, size: 15 }), (0, jsx_runtime_1.jsx)(OverflowToolTip_1.default, { label: screen.label, placement: "top-start", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: link.linkAs, href: screen.href, "data-launcher-item": true, ...focus.primary, "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: (0, exports.stretchedLink)("8px"), children: screen.label }) }), (0, jsx_runtime_1.jsx)(react_1.Flex, { position: "relative", zIndex: 1, align: "center", gap: "2px", children: trailing })] }));
|
|
95
173
|
}
|
|
96
174
|
function PinTextButton({ label, text, onToggle }) {
|
|
97
175
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
@@ -105,12 +183,13 @@ function PinnedTile({ screen, module, link, labels, onTogglePin, }) {
|
|
|
105
183
|
var _a;
|
|
106
184
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
107
185
|
const Icon = (_a = screen.icon) !== null && _a !== void 0 ? _a : module.icon;
|
|
108
|
-
|
|
186
|
+
const focus = (0, exports.useRowFocus)(true);
|
|
187
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { "data-group": true, "data-nav-cell": true, position: "relative", align: "center", gap: "8px", h: "36px", pl: "9px", pr: "4px", borderRadius: "9px", borderWidth: "1px", borderColor: colors.boxborder[200], bg: colors.surfaceRaised, transition: (0, motion_1.transitionFor)(["border-color", "background-color"]), _hover: { borderColor: colors.gray[300] }, sx: focus.sx, children: [Icon ? ((0, jsx_runtime_1.jsx)(react_1.Box, { as: "span", display: "inline-flex", flexShrink: 0, color: colors.accentText, children: (0, jsx_runtime_1.jsx)(Icon, { size: 15, strokeWidth: 1.8, "aria-hidden": true }) })) : null, (0, jsx_runtime_1.jsx)(OverflowToolTip_1.default, { label: screen.label, placement: "top-start", children: (0, jsx_runtime_1.jsx)(react_1.Box, { as: link.linkAs, href: screen.href, "data-launcher-item": true, ...focus.primary, "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: (0, exports.stretchedLink)("9px"), children: screen.label }) }), (0, jsx_runtime_1.jsx)(CountBadge, { value: screen.badge, size: "tile" }), onTogglePin ? ((0, jsx_runtime_1.jsx)(react_1.Box, { position: "relative", zIndex: 1, flexShrink: 0, w: "0", overflow: "hidden", transition: (0, motion_1.transitionFor)(["width"]), _groupHover: { w: "22px" }, _groupFocusWithin: { w: "22px" }, children: (0, jsx_runtime_1.jsx)(PinToggle_1.default, { isPinned: true, size: 12, label: labels.unpin(screen.label), title: labels.unpinTip, onToggle: onTogglePin }) })) : null] }));
|
|
109
188
|
}
|
|
110
189
|
function AppsSection({ apps, hues, currentAppId, heading, onSelect, }) {
|
|
111
190
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
112
191
|
const rows = (0, rowStates_1.listRowBackgrounds)(colors);
|
|
113
|
-
const
|
|
192
|
+
const rowRing = (0, exports.activeRowSurface)(colors);
|
|
114
193
|
return ((0, jsx_runtime_1.jsxs)(react_1.Box, { children: [(0, jsx_runtime_1.jsx)(SectionHeader, { label: heading, isRail: true, hasCount: false }), (0, jsx_runtime_1.jsx)(react_1.Box, { as: "ul", listStyleType: "none", m: 0, p: 0, "aria-label": heading, children: apps.map((app, index) => {
|
|
115
194
|
var _a;
|
|
116
195
|
const isCurrent = app.id === currentAppId;
|
|
@@ -125,6 +204,9 @@ function AppsSection({ apps, hues, currentAppId, heading, onSelect, }) {
|
|
|
125
204
|
}
|
|
126
205
|
: {}), "aria-current": isCurrent ? "true" : undefined, title: app.locked
|
|
127
206
|
? ((_a = app.lockedReason) !== null && _a !== void 0 ? _a : `${app.name} is not available on your plan`)
|
|
128
|
-
: 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: (0, motion_1.transitionFor)(["background-color"]), _hover: interactive ? { bg: rows.active } : undefined, sx:
|
|
207
|
+
: undefined, "data-app-locked": app.locked ? "true" : undefined, "aria-disabled": 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: (0, motion_1.transitionFor)(["background-color"]), _hover: interactive ? { bg: rows.active } : undefined, sx: {
|
|
208
|
+
_focusVisible: rowRing,
|
|
209
|
+
[focusRing_styles_1.FOCUS_VISIBLE_OVER_STATE]: rowRing,
|
|
210
|
+
}, children: [(0, jsx_runtime_1.jsx)(AppMark_1.default, { app: app, hue: hues[index], boxSize: "28px", iconSize: 15, muted: app.locked }), (0, jsx_runtime_1.jsx)(OverflowToolTip_1.default, { label: app.name, placement: "top-start", children: (0, jsx_runtime_1.jsx)(react_1.Text, { flex: 1, minW: 0, fontSize: "sm", fontWeight: "medium", noOfLines: 1, color: app.locked ? colors.textMuted : colors.text[900], children: app.name }) }), app.locked ? ((0, jsx_runtime_1.jsx)(react_1.Box, { as: lucide_react_1.Lock, size: 14, color: colors.textMuted, flexShrink: 0, "aria-hidden": true })) : null] }) }, app.id || app.name));
|
|
129
211
|
}) })] }));
|
|
130
212
|
}
|
|
@@ -13,6 +13,11 @@ const color_1 = require("../../Theme/tokens/builders/color");
|
|
|
13
13
|
function ProfilePhotoViewer({ photoUrl, onPhotoChange, imageWidth = "100px", imageAlt = "Profile Photo", imageObjectFit = "cover", imageBorderRadius = "full", editIconSize = "sm", editIconPositionRight = "0px", editIconPositionBottom = "0px", isRound = true, boxStyle, isEditable = false, isView = false, style, handleIsView, fallbackText, revealOnHover = true, }) {
|
|
14
14
|
var _a, _b, _c, _d, _e;
|
|
15
15
|
const [photo, setPhoto] = (0, react_1.useState)(photoUrl);
|
|
16
|
+
const [syncedUrl, setSyncedUrl] = (0, react_1.useState)(photoUrl);
|
|
17
|
+
if (photoUrl !== syncedUrl) {
|
|
18
|
+
setSyncedUrl(photoUrl);
|
|
19
|
+
setPhoto(photoUrl);
|
|
20
|
+
}
|
|
16
21
|
const fileInputRef = (0, react_1.useRef)(null);
|
|
17
22
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
18
23
|
const c = theme.colors;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** isEditable and isView are independent — both true shows edit and view actions side by side. */
|
|
2
2
|
export type ProfilePhotoViewerProps = {
|
|
3
|
-
/**
|
|
3
|
+
/** Source of the displayed image; a changed value replaces it, discarding a locally picked preview. */
|
|
4
4
|
photoUrl: string;
|
|
5
5
|
/** Receives the raw File (not a URL, despite the param name) — fires only when isEditable and a file is picked. */
|
|
6
6
|
onPhotoChange: (photoUrl: File) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { QueryStateBoundaryProps } from "./QueryStateProps";
|
|
2
|
-
/** Renders one of loading / error / empty / children for a content region; agnostic of the fetching library. */
|
|
3
|
-
declare const QueryStateBoundary: ({ isLoading, error, isEmpty, loadingFallback, emptyFallback, empty, errorTitle, errorDescription, onRetry, isRetrying, minH, children, }: QueryStateBoundaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
/** Renders one of loading / forbidden / error / empty / children for a content region; agnostic of the fetching library. */
|
|
3
|
+
declare const QueryStateBoundary: ({ isLoading, isForbidden, forbidden, hasData, error, isEmpty, loadingFallback, emptyFallback, empty, errorTitle, errorDescription, onRetry, isRetrying, minH, children, }: QueryStateBoundaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default QueryStateBoundary;
|