@servicetitan/navigation 14.3.0 → 14.4.0
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/dist/components/titan-layout/navigation-catalog/navigation-catalog.d.ts.map +1 -1
- package/dist/components/titan-layout/navigation-catalog/navigation-catalog.js +68 -107
- package/dist/components/titan-layout/navigation-catalog/navigation-catalog.js.map +1 -1
- package/dist/components/titan-layout/navigation-catalog/navigation-catalog.module.less +70 -127
- package/dist/components/titan-layout/navigation-catalog/navigation-catalog.module.less.d.ts +2 -0
- package/dist/utils/__tests__/catalog-groups.test.d.ts +2 -0
- package/dist/utils/__tests__/catalog-groups.test.d.ts.map +1 -0
- package/dist/utils/catalog-groups.d.ts +11 -0
- package/dist/utils/catalog-groups.d.ts.map +1 -0
- package/dist/utils/catalog-groups.js +66 -0
- package/dist/utils/catalog-groups.js.map +1 -0
- package/package.json +2 -2
- package/src/components/titan-layout/__tests__/navigation-catalog-reset.test.tsx +7 -3
- package/src/components/titan-layout/navigation-catalog/navigation-catalog.module.less +70 -127
- package/src/components/titan-layout/navigation-catalog/navigation-catalog.module.less.d.ts +2 -0
- package/src/components/titan-layout/navigation-catalog/navigation-catalog.tsx +106 -134
- package/src/utils/__tests__/catalog-groups.test.ts +97 -0
- package/src/utils/catalog-groups.ts +57 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-catalog.d.ts","sourceRoot":"","sources":["../../../../src/components/titan-layout/navigation-catalog/navigation-catalog.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,EAAmD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"navigation-catalog.d.ts","sourceRoot":"","sources":["../../../../src/components/titan-layout/navigation-catalog/navigation-catalog.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,EAAmD,MAAM,OAAO,CAAC;AAS5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAkMtD,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IAClE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAkNxD,CAAC"}
|
|
@@ -5,26 +5,12 @@ import IconStar from '@servicetitan/anvil2/assets/icons/material/round/star.svg'
|
|
|
5
5
|
import IconStarBorder from '@servicetitan/anvil2/assets/icons/material/round/star_border.svg';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { Fragment, useMemo, useRef, useState } from 'react';
|
|
8
|
+
import { filterCatalogGroups, getCatalogChildren, getCatalogSubmenuGroups } from '../../../utils/catalog-groups';
|
|
8
9
|
import { getCounterTag } from '../../../utils/side-nav';
|
|
9
10
|
import { BadgeTag } from '../../badge-tag';
|
|
10
11
|
import { useTitanLayoutContext } from '../layout-context';
|
|
11
12
|
import { NavigationCatalogFooter } from './navigation-catalog-footer';
|
|
12
13
|
import * as styles from './navigation-catalog.module.less';
|
|
13
|
-
/** The pages beneath an item, flattened out of its submenu groups. */ const childrenOf = (item)=>{
|
|
14
|
-
var _ref;
|
|
15
|
-
var _item_submenu;
|
|
16
|
-
const seen = new Set();
|
|
17
|
-
return ((_ref = (_item_submenu = item.submenu) === null || _item_submenu === void 0 ? void 0 : _item_submenu.groups) !== null && _ref !== void 0 ? _ref : []).flatMap((group)=>{
|
|
18
|
-
var _group_links;
|
|
19
|
-
return ((_group_links = group.links) !== null && _group_links !== void 0 ? _group_links : []).filter((link)=>{
|
|
20
|
-
if (seen.has(link.id)) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
seen.add(link.id);
|
|
24
|
-
return true;
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
14
|
/** Shown in place of the pin control for a destination the user may not unpin. */ const LockedPin = ()=>/*#__PURE__*/ _jsxs(Tooltip, {
|
|
29
15
|
children: [
|
|
30
16
|
/*#__PURE__*/ _jsx(Tooltip.Trigger, {
|
|
@@ -34,6 +20,9 @@ import * as styles from './navigation-catalog.module.less';
|
|
|
34
20
|
})
|
|
35
21
|
}),
|
|
36
22
|
/*#__PURE__*/ _jsx(Tooltip.Content, {
|
|
23
|
+
style: {
|
|
24
|
+
pointerEvents: 'none'
|
|
25
|
+
},
|
|
37
26
|
children: "Cannot be removed from Favorites"
|
|
38
27
|
})
|
|
39
28
|
]
|
|
@@ -52,8 +41,7 @@ const PinToggle = ({ pinned, label, onToggle })=>{
|
|
|
52
41
|
children: /*#__PURE__*/ _jsx(Button, {
|
|
53
42
|
appearance: "ghost",
|
|
54
43
|
size: "small",
|
|
55
|
-
icon: pinned ? IconStar : IconStarBorder,
|
|
56
|
-
// Only a control that covers nothing but pinned rows is lit.
|
|
44
|
+
icon: pinned === true ? IconStar : IconStarBorder,
|
|
57
45
|
className: classNames(styles.star, pinned && styles.starActive),
|
|
58
46
|
"aria-label": label,
|
|
59
47
|
"aria-pressed": pinned,
|
|
@@ -61,19 +49,23 @@ const PinToggle = ({ pinned, label, onToggle })=>{
|
|
|
61
49
|
})
|
|
62
50
|
}),
|
|
63
51
|
/*#__PURE__*/ _jsx(Tooltip.Content, {
|
|
64
|
-
|
|
52
|
+
style: {
|
|
53
|
+
pointerEvents: 'none'
|
|
54
|
+
},
|
|
55
|
+
children: pinned === 'mixed' ? 'Add this module to Favorites' : pinned ? 'Remove from Favorites' : 'Add to Favorites'
|
|
65
56
|
})
|
|
66
57
|
]
|
|
67
58
|
});
|
|
68
59
|
};
|
|
69
60
|
const CatalogRows = ({ item, scopeIds, isPinned, isLocked, onTogglePin, onToggleAll, onNavigate })=>{
|
|
70
61
|
const { NavigationComponent } = useTitanLayoutContext();
|
|
71
|
-
const
|
|
62
|
+
const submenuGroups = getCatalogSubmenuGroups(item);
|
|
72
63
|
/*
|
|
73
64
|
* Minus anything locked — locked destinations are always present, so the module's control
|
|
74
65
|
* neither reports on them nor acts on them.
|
|
75
66
|
*/ const everything = scopeIds.filter((id)=>!isLocked(id));
|
|
76
67
|
const anyPinned = everything.some(isPinned);
|
|
68
|
+
const allPinned = everything.length > 0 && everything.every(isPinned);
|
|
77
69
|
const tag = getCounterTag(item.counter, item.tag);
|
|
78
70
|
return /*#__PURE__*/ _jsxs("div", {
|
|
79
71
|
className: styles.moduleGroup,
|
|
@@ -89,11 +81,12 @@ const CatalogRows = ({ item, scopeIds, isPinned, isLocked, onTogglePin, onToggle
|
|
|
89
81
|
children: [
|
|
90
82
|
item.icon && /*#__PURE__*/ _jsx(Icon, {
|
|
91
83
|
svg: item.icon,
|
|
92
|
-
size: "
|
|
84
|
+
size: "medium",
|
|
93
85
|
className: styles.moduleIcon
|
|
94
86
|
}),
|
|
95
87
|
/*#__PURE__*/ _jsx(Text, {
|
|
96
88
|
inline: true,
|
|
89
|
+
size: "small",
|
|
97
90
|
className: styles.moduleTitle,
|
|
98
91
|
children: item.title
|
|
99
92
|
}),
|
|
@@ -104,96 +97,63 @@ const CatalogRows = ({ item, scopeIds, isPinned, isLocked, onTogglePin, onToggle
|
|
|
104
97
|
]
|
|
105
98
|
}),
|
|
106
99
|
isLocked(item.id) ? /*#__PURE__*/ _jsx(LockedPin, {}) : /*#__PURE__*/ _jsx(PinToggle, {
|
|
107
|
-
pinned: anyPinned,
|
|
108
|
-
label:
|
|
109
|
-
onToggle: ()=>onToggleAll(everything, !
|
|
100
|
+
pinned: allPinned ? true : anyPinned ? 'mixed' : false,
|
|
101
|
+
label: allPinned ? `Unpin ${item.title} from the navigation` : `Pin ${item.title} to the navigation`,
|
|
102
|
+
onToggle: ()=>onToggleAll(everything, !allPinned)
|
|
110
103
|
})
|
|
111
104
|
]
|
|
112
105
|
}),
|
|
113
|
-
|
|
114
|
-
/*
|
|
115
|
-
* Page titles are only unique within their item — "Settings" and "Reports" recur
|
|
116
|
-
* across the catalog — and the row that tells them apart is a separate element, so
|
|
117
|
-
* it is not part of any of these names. Anything reading the rows on their own, a
|
|
118
|
-
* screen reader running through the links or a voice command naming one, would
|
|
119
|
-
* otherwise be given the same name several times.
|
|
120
|
-
*/ const qualifiedTitle = `${item.title}: ${child.title}`;
|
|
121
|
-
const childPinned = isPinned(child.id);
|
|
122
|
-
const childTag = getCounterTag(child.counter, child.tag);
|
|
123
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
124
|
-
className: styles.row,
|
|
106
|
+
submenuGroups.map((group)=>/*#__PURE__*/ _jsxs("div", {
|
|
125
107
|
children: [
|
|
126
|
-
/*#__PURE__*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
children: [
|
|
132
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
133
|
-
inline: true,
|
|
134
|
-
className: styles.childTitle,
|
|
135
|
-
children: child.title
|
|
136
|
-
}),
|
|
137
|
-
!!childTag && /*#__PURE__*/ _jsx(BadgeTag, {
|
|
138
|
-
data: childTag,
|
|
139
|
-
className: styles.badge
|
|
140
|
-
})
|
|
141
|
-
]
|
|
108
|
+
group.title && /*#__PURE__*/ _jsx(Text, {
|
|
109
|
+
variant: "eyebrow",
|
|
110
|
+
size: "small",
|
|
111
|
+
className: styles.submenuTitle,
|
|
112
|
+
children: group.title
|
|
142
113
|
}),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
114
|
+
group.links.map((child)=>{
|
|
115
|
+
/*
|
|
116
|
+
* Page titles are only unique within their item — "Settings" and "Reports" recur
|
|
117
|
+
* across the catalog — and the row that tells them apart is a separate element, so
|
|
118
|
+
* it is not part of any of these names. Anything reading the rows on their own, a
|
|
119
|
+
* screen reader running through the links or a voice command naming one, would
|
|
120
|
+
* otherwise be given the same name several times.
|
|
121
|
+
*/ const qualifiedTitle = `${item.title}: ${child.title}`;
|
|
122
|
+
const childPinned = isPinned(child.id);
|
|
123
|
+
const childTag = getCounterTag(child.counter, child.tag);
|
|
124
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
125
|
+
className: styles.row,
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ _jsxs(NavigationComponent, {
|
|
128
|
+
to: child.to,
|
|
129
|
+
className: classNames(styles.link, styles.childLink),
|
|
130
|
+
onClick: onNavigate,
|
|
131
|
+
"aria-label": qualifiedTitle,
|
|
132
|
+
children: [
|
|
133
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
134
|
+
inline: true,
|
|
135
|
+
className: styles.childTitle,
|
|
136
|
+
children: child.title
|
|
137
|
+
}),
|
|
138
|
+
!!childTag && /*#__PURE__*/ _jsx(BadgeTag, {
|
|
139
|
+
data: childTag,
|
|
140
|
+
className: styles.badge
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
}),
|
|
144
|
+
isLocked(child.id) ? /*#__PURE__*/ _jsx(LockedPin, {}) : /*#__PURE__*/ _jsx(PinToggle, {
|
|
145
|
+
pinned: childPinned,
|
|
146
|
+
label: childPinned ? `Unpin ${qualifiedTitle} from the navigation` : `Pin ${qualifiedTitle} to the navigation`,
|
|
147
|
+
onToggle: ()=>onTogglePin(child.id, item.id)
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
}, child.id);
|
|
147
151
|
})
|
|
148
152
|
]
|
|
149
|
-
},
|
|
150
|
-
})
|
|
153
|
+
}, group.links[0].id))
|
|
151
154
|
]
|
|
152
155
|
});
|
|
153
156
|
};
|
|
154
|
-
/**
|
|
155
|
-
* Narrows the catalog to the entries matching `query`.
|
|
156
|
-
*
|
|
157
|
-
* Matching is literal and never cascades: a row survives only when its own title matches. An item
|
|
158
|
-
* whose title matches is kept as a bare row without the pages beneath it, and a section is kept
|
|
159
|
-
* only for whatever survived under it, so the list only ever shrinks as the query grows.
|
|
160
|
-
*/ const filterGroups = (groups, query)=>{
|
|
161
|
-
const needle = query.trim().toLowerCase();
|
|
162
|
-
if (!needle) {
|
|
163
|
-
return groups;
|
|
164
|
-
}
|
|
165
|
-
return groups.reduce((out, group)=>{
|
|
166
|
-
const items = group.items.reduce((kept, item)=>{
|
|
167
|
-
const matchingChildren = childrenOf(item).filter((child)=>child.title.toLowerCase().includes(needle));
|
|
168
|
-
if (matchingChildren.length > 0) {
|
|
169
|
-
kept.push({
|
|
170
|
-
...item,
|
|
171
|
-
submenu: {
|
|
172
|
-
groups: [
|
|
173
|
-
{
|
|
174
|
-
title: '',
|
|
175
|
-
links: matchingChildren
|
|
176
|
-
}
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
} else if (item.title.toLowerCase().includes(needle)) {
|
|
181
|
-
kept.push({
|
|
182
|
-
...item,
|
|
183
|
-
submenu: undefined
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
return kept;
|
|
187
|
-
}, []);
|
|
188
|
-
if (items.length > 0) {
|
|
189
|
-
out.push({
|
|
190
|
-
...group,
|
|
191
|
-
items
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
return out;
|
|
195
|
-
}, []);
|
|
196
|
-
};
|
|
197
157
|
/**
|
|
198
158
|
* Every destination the host offers, grouped into sections, with a star on every row.
|
|
199
159
|
*
|
|
@@ -201,6 +161,7 @@ const CatalogRows = ({ item, scopeIds, isPinned, isLocked, onTogglePin, onToggle
|
|
|
201
161
|
* user may reach, so the catalog cannot offer a destination they do not have.
|
|
202
162
|
*/ export const NavigationCatalog = ({ open, onClose, groups, pinnedIds, lockedIds, onPinnedIdsChange, onResetToDefaults })=>{
|
|
203
163
|
const [query, setQuery] = useState('');
|
|
164
|
+
const isSearching = query.trim().length > 0;
|
|
204
165
|
const searchRef = useRef(null);
|
|
205
166
|
/*
|
|
206
167
|
* Resolved here rather than by the host, so a catalog that costs requests to enumerate is paid
|
|
@@ -209,7 +170,7 @@ const CatalogRows = ({ item, scopeIds, isPinned, isLocked, onTogglePin, onToggle
|
|
|
209
170
|
*/ const resolvedGroups = useMemo(()=>groups(), [
|
|
210
171
|
groups
|
|
211
172
|
]);
|
|
212
|
-
const visibleGroups = useMemo(()=>
|
|
173
|
+
const visibleGroups = useMemo(()=>filterCatalogGroups(resolvedGroups, query), [
|
|
213
174
|
resolvedGroups,
|
|
214
175
|
query
|
|
215
176
|
]);
|
|
@@ -220,7 +181,7 @@ const CatalogRows = ({ item, scopeIds, isPinned, isLocked, onTogglePin, onToggle
|
|
|
220
181
|
item.id,
|
|
221
182
|
[
|
|
222
183
|
item.id,
|
|
223
|
-
...
|
|
184
|
+
...getCatalogChildren(item).map((child)=>child.id)
|
|
224
185
|
]
|
|
225
186
|
])), [
|
|
226
187
|
resolvedGroups
|
|
@@ -322,12 +283,12 @@ const CatalogRows = ({ item, scopeIds, isPinned, isLocked, onTogglePin, onToggle
|
|
|
322
283
|
"aria-label": "Go to"
|
|
323
284
|
}),
|
|
324
285
|
/*#__PURE__*/ _jsx("div", {
|
|
325
|
-
className: styles.results,
|
|
286
|
+
className: classNames(styles.results, isSearching && styles.searchResults),
|
|
326
287
|
children: visibleGroups.length === 0 ? /*#__PURE__*/ _jsx("div", {
|
|
327
288
|
className: styles.empty,
|
|
328
289
|
children: /*#__PURE__*/ _jsx(Text, {
|
|
329
290
|
subdued: true,
|
|
330
|
-
children:
|
|
291
|
+
children: isSearching ? /*#__PURE__*/ _jsxs(Fragment, {
|
|
331
292
|
children: [
|
|
332
293
|
"No navigation items match “",
|
|
333
294
|
query,
|
|
@@ -336,11 +297,11 @@ const CatalogRows = ({ item, scopeIds, isPinned, isLocked, onTogglePin, onToggle
|
|
|
336
297
|
}) : 'There are no navigation items to show.'
|
|
337
298
|
})
|
|
338
299
|
}) : /*#__PURE__*/ _jsx("div", {
|
|
339
|
-
className: styles.columns,
|
|
300
|
+
className: isSearching ? undefined : styles.columns,
|
|
340
301
|
children: visibleGroups.map((group)=>/*#__PURE__*/ _jsxs("div", {
|
|
341
|
-
className: styles.group,
|
|
302
|
+
className: isSearching ? undefined : styles.group,
|
|
342
303
|
children: [
|
|
343
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
304
|
+
!isSearching && /*#__PURE__*/ _jsx(Text, {
|
|
344
305
|
variant: "eyebrow",
|
|
345
306
|
size: "medium",
|
|
346
307
|
className: styles.groupTitle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/titan-layout/navigation-catalog/navigation-catalog.tsx"],"sourcesContent":["import { Button, Dialog, Icon, SearchField, Text, Tooltip } from '@servicetitan/anvil2';\nimport IconLock from '@servicetitan/anvil2/assets/icons/material/round/lock.svg';\nimport IconStar from '@servicetitan/anvil2/assets/icons/material/round/star.svg';\nimport IconStarBorder from '@servicetitan/anvil2/assets/icons/material/round/star_border.svg';\nimport classNames from 'classnames';\nimport { FC, Fragment, MouseEvent, useMemo, useRef, useState } from 'react';\nimport { NavigationItemData } from '../../../utils/navigation';\nimport { getCounterTag } from '../../../utils/side-nav';\nimport { BadgeTag } from '../../badge-tag';\nimport { NavigationCatalogGroup, PinnedNavigationConfig } from '../interface';\nimport { useTitanLayoutContext } from '../layout-context';\nimport { NavigationCatalogFooter } from './navigation-catalog-footer';\nimport * as styles from './navigation-catalog.module.less';\n\n/** The pages beneath an item, flattened out of its submenu groups. */\nconst childrenOf = (item: NavigationItemData) => {\n const seen = new Set<string>();\n\n return (item.submenu?.groups ?? []).flatMap(group =>\n (group.links ?? []).filter(link => {\n if (seen.has(link.id)) {\n return false;\n }\n\n seen.add(link.id);\n return true;\n })\n );\n};\n\n/** Shown in place of the pin control for a destination the user may not unpin. */\nconst LockedPin: FC = () => (\n <Tooltip>\n <Tooltip.Trigger>\n <Icon svg={IconLock} className={styles.lock} />\n </Tooltip.Trigger>\n <Tooltip.Content>Cannot be removed from Favorites</Tooltip.Content>\n </Tooltip>\n);\n\ninterface PinToggleProps {\n pinned: boolean;\n label: string;\n onToggle: () => void;\n}\n\nconst PinToggle: FC<PinToggleProps> = ({ pinned, label, onToggle }) => {\n const toggle = (event: MouseEvent) => {\n // The control sits inside the row but is not a navigation affordance.\n event.preventDefault();\n event.stopPropagation();\n onToggle();\n };\n\n return (\n <Tooltip delay={300}>\n <Tooltip.Trigger>\n <Button\n appearance=\"ghost\"\n size=\"small\"\n icon={pinned ? IconStar : IconStarBorder}\n // Only a control that covers nothing but pinned rows is lit.\n className={classNames(styles.star, pinned && styles.starActive)}\n aria-label={label}\n aria-pressed={pinned}\n onClick={toggle}\n />\n </Tooltip.Trigger>\n <Tooltip.Content>\n {pinned ? 'Remove from Favorites' : 'Add to Favorites'}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\ninterface CatalogRowsProps {\n item: NavigationItemData;\n /**\n * Every id the module's own control covers, taken from the unfiltered item.\n *\n * `item` may have been narrowed by the search, so deriving this from it would let the control\n * act on only the pages that happen to be visible — silently stranding the rest.\n */\n scopeIds: string[];\n isPinned: (id: string) => boolean;\n isLocked: (id: string) => boolean;\n /** `ownerId` is the module the page belongs to; omitted for the module's own row. */\n onTogglePin: (id: string, ownerId?: string) => void;\n onToggleAll: (ids: string[], shouldPin: boolean) => void;\n onNavigate: () => void;\n}\n\nconst CatalogRows: FC<CatalogRowsProps> = ({\n item,\n scopeIds,\n isPinned,\n isLocked,\n onTogglePin,\n onToggleAll,\n onNavigate,\n}) => {\n const { NavigationComponent } = useTitanLayoutContext();\n const children = childrenOf(item);\n\n /*\n * Minus anything locked — locked destinations are always present, so the module's control\n * neither reports on them nor acts on them.\n */\n const everything = scopeIds.filter(id => !isLocked(id));\n const anyPinned = everything.some(isPinned);\n const tag = getCounterTag(item.counter, item.tag);\n\n return (\n <div className={styles.moduleGroup}>\n <div className={styles.row}>\n <NavigationComponent\n to={item.to}\n className={styles.link}\n onClick={onNavigate}\n aria-label={item.title}\n >\n {item.icon && (\n <Icon svg={item.icon} size=\"small\" className={styles.moduleIcon} />\n )}\n <Text inline className={styles.moduleTitle}>\n {item.title}\n </Text>\n {/*\n * The same counter the rail shows, so a destination that is asking for\n * attention still says so here — the catalog is the only place an unfavourited\n * one is visible at all.\n */}\n {!!tag && <BadgeTag data={tag} className={styles.badge} />}\n </NavigationComponent>\n {/*\n * One control for the whole module: favouriting it takes its pages with it, and\n * unfavouriting it takes them away again.\n *\n * Lit when *any* page under it is favourited, because that is exactly when the\n * module is on the rail — the star reports whether the module is there, not\n * whether every page under it is. Reporting \"all\" instead would leave an unlit\n * star on a module the user can plainly see in the navigation.\n */}\n {isLocked(item.id) ? (\n <LockedPin />\n ) : (\n <PinToggle\n pinned={anyPinned}\n label={\n anyPinned\n ? `Unpin ${item.title} from the navigation`\n : `Pin ${item.title} to the navigation`\n }\n onToggle={() => onToggleAll(everything, !anyPinned)}\n />\n )}\n </div>\n {children.map(child => {\n /*\n * Page titles are only unique within their item — \"Settings\" and \"Reports\" recur\n * across the catalog — and the row that tells them apart is a separate element, so\n * it is not part of any of these names. Anything reading the rows on their own, a\n * screen reader running through the links or a voice command naming one, would\n * otherwise be given the same name several times.\n */\n const qualifiedTitle = `${item.title}: ${child.title}`;\n const childPinned = isPinned(child.id);\n const childTag = getCounterTag(child.counter, child.tag);\n\n return (\n <div key={child.id} className={styles.row}>\n <NavigationComponent\n to={child.to}\n className={classNames(styles.link, styles.childLink)}\n onClick={onNavigate}\n aria-label={qualifiedTitle}\n >\n <Text inline className={styles.childTitle}>\n {child.title}\n </Text>\n {!!childTag && <BadgeTag data={childTag} className={styles.badge} />}\n </NavigationComponent>\n {isLocked(child.id) ? (\n <LockedPin />\n ) : (\n <PinToggle\n pinned={childPinned}\n label={\n childPinned\n ? `Unpin ${qualifiedTitle} from the navigation`\n : `Pin ${qualifiedTitle} to the navigation`\n }\n onToggle={() => onTogglePin(child.id, item.id)}\n />\n )}\n </div>\n );\n })}\n </div>\n );\n};\n\n/**\n * Narrows the catalog to the entries matching `query`.\n *\n * Matching is literal and never cascades: a row survives only when its own title matches. An item\n * whose title matches is kept as a bare row without the pages beneath it, and a section is kept\n * only for whatever survived under it, so the list only ever shrinks as the query grows.\n */\nconst filterGroups = (groups: NavigationCatalogGroup[], query: string) => {\n const needle = query.trim().toLowerCase();\n\n if (!needle) {\n return groups;\n }\n\n return groups.reduce<NavigationCatalogGroup[]>((out, group) => {\n const items = group.items.reduce<NavigationItemData[]>((kept, item) => {\n const matchingChildren = childrenOf(item).filter(child =>\n child.title.toLowerCase().includes(needle)\n );\n\n if (matchingChildren.length > 0) {\n kept.push({\n ...item,\n submenu: { groups: [{ title: '', links: matchingChildren }] },\n });\n } else if (item.title.toLowerCase().includes(needle)) {\n kept.push({ ...item, submenu: undefined });\n }\n\n return kept;\n }, []);\n\n if (items.length > 0) {\n out.push({ ...group, items });\n }\n\n return out;\n }, []);\n};\n\nexport interface NavigationCatalogProps extends PinnedNavigationConfig {\n open: boolean;\n onClose: () => void;\n}\n\n/**\n * Every destination the host offers, grouped into sections, with a star on every row.\n *\n * The catalog shows what it is given and nothing more — the host has already resolved what this\n * user may reach, so the catalog cannot offer a destination they do not have.\n */\nexport const NavigationCatalog: FC<NavigationCatalogProps> = ({\n open,\n onClose,\n groups,\n pinnedIds,\n lockedIds,\n onPinnedIdsChange,\n onResetToDefaults,\n}) => {\n const [query, setQuery] = useState('');\n const searchRef = useRef<HTMLInputElement>(null);\n\n /*\n * Resolved here rather than by the host, so a catalog that costs requests to enumerate is paid\n * for on opening the dialog and not on every page load. This component is mounted only while\n * open, so the call happens once per open unless the host changes the function.\n */\n const resolvedGroups = useMemo(() => groups(), [groups]);\n\n const visibleGroups = useMemo(\n () => filterGroups(resolvedGroups, query),\n [resolvedGroups, query]\n );\n\n /*\n * The pin scope of every item, keyed by id and built before the search narrows anything, so a\n * module's control still covers the pages a query is currently hiding.\n */\n const scopeById = useMemo(\n () =>\n new Map(\n resolvedGroups\n .flatMap(group => group.items)\n .map(item => [item.id, [item.id, ...childrenOf(item).map(child => child.id)]])\n ),\n [resolvedGroups]\n );\n const pinnedSet = useMemo(() => new Set(pinnedIds), [pinnedIds]);\n const lockedSet = useMemo(() => new Set(lockedIds ?? []), [lockedIds]);\n\n const isPinned = (id: string) => pinnedSet.has(id);\n const isLocked = (id: string) => lockedSet.has(id);\n\n /**\n * Favourites or unfavourites one row, carrying its module with it.\n *\n * A page is reached through its module, so the two travel together: favouriting a page brings\n * the module along when it is not already there, and unfavouriting the last one takes the\n * module with it. Leaving the module behind on its own would not read as an emptier\n * navigation — it would put the module back carrying every page it has.\n *\n * Locked ids never reach a proposal. The controls that would move them are not rendered, so\n * that part is belt and braces — but the host's list is the thing that gets persisted, and a\n * locked destination has no business appearing in or disappearing from it.\n */\n const togglePin = (id: string, ownerId?: string) => {\n if (lockedSet.has(id)) {\n return;\n }\n\n /** The module, when it is a separate row that this page can legitimately move. */\n const owner = ownerId !== id && ownerId && !lockedSet.has(ownerId) ? ownerId : undefined;\n\n if (pinnedSet.has(id)) {\n const removing = new Set([id]);\n\n if (owner) {\n const siblings = (scopeById.get(owner) ?? []).filter(\n scoped => scoped !== owner && scoped !== id\n );\n\n if (!siblings.some(sibling => pinnedSet.has(sibling))) {\n removing.add(owner);\n }\n }\n\n onPinnedIdsChange(pinnedIds.filter(pinned => !removing.has(pinned)));\n return;\n }\n\n // Module first, so it reads ahead of its own page in the saved order.\n const additions = owner && !pinnedSet.has(owner) ? [owner, id] : [id];\n\n onPinnedIdsChange([...pinnedIds, ...additions]);\n };\n\n /*\n * One proposal for the whole set rather than one per row, so a host that persists on every\n * change writes once, and every intermediate list — states the user never asked for — never\n * exists.\n */\n const toggleAll = (ids: string[], shouldPin: boolean) => {\n const actionable = ids.filter(id => !lockedSet.has(id));\n\n if (!shouldPin) {\n const removing = new Set(actionable);\n\n onPinnedIdsChange(pinnedIds.filter(pinned => !removing.has(pinned)));\n return;\n }\n\n const additions = actionable.filter(id => !pinnedSet.has(id));\n\n if (additions.length > 0) {\n onPinnedIdsChange([...pinnedIds, ...additions]);\n }\n };\n\n const close = () => {\n setQuery('');\n onClose();\n };\n\n return (\n <Dialog\n open={open}\n onClose={close}\n size=\"xlarge\"\n aria-label=\"All Navigation\"\n className={styles.dialog}\n data-cy=\"navigation-catalog-dialog\"\n >\n <Dialog.Content className={styles.content}>\n <div className={styles.body}>\n <SearchField\n ref={searchRef}\n size=\"small\"\n className={styles.search}\n placeholder=\"Go to ...\"\n value={query}\n onChange={event => setQuery(event.target.value)}\n onClear={() => setQuery('')}\n aria-label=\"Go to\"\n />\n <div className={styles.results}>\n {visibleGroups.length === 0 ? (\n <div className={styles.empty}>\n {/*\n * Two different nothings: a search that matched no row, and a host\n * that offered no rows at all. The second is a real state — the\n * catalog is reachable whether or not there is anything in it — and\n * quoting an empty query at the user does not describe it.\n */}\n <Text subdued>\n {query.trim() ? (\n <Fragment>\n No navigation items match “{query}”.\n </Fragment>\n ) : (\n 'There are no navigation items to show.'\n )}\n </Text>\n </div>\n ) : (\n <div className={styles.columns}>\n {visibleGroups.map(group => (\n <div key={group.title} className={styles.group}>\n {/*\n * `medium` is 0.75rem, a step below the destinations under\n * it. A heading that matches or beats its contents in size\n * competes with them, and this one does not need the room:\n * it is already set apart by case, tracking and a grey that\n * nothing else on the surface uses. `small` is 0.625rem,\n * too small to take in at a glance once uppercased and\n * letter-spaced.\n */}\n <Text\n variant=\"eyebrow\"\n size=\"medium\"\n className={styles.groupTitle}\n >\n {group.title}\n </Text>\n {group.items.map(item => (\n <CatalogRows\n key={item.id}\n item={item}\n scopeIds={scopeById.get(item.id) ?? [item.id]}\n isPinned={isPinned}\n isLocked={isLocked}\n onTogglePin={togglePin}\n onToggleAll={toggleAll}\n onNavigate={close}\n />\n ))}\n </div>\n ))}\n </div>\n )}\n </div>\n </div>\n </Dialog.Content>\n <NavigationCatalogFooter\n onRestore={\n onResetToDefaults &&\n (() => {\n onResetToDefaults();\n // The control disappears with the host's reset; keep focus in the dialog.\n searchRef.current?.focus();\n })\n }\n />\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","Icon","SearchField","Text","Tooltip","IconLock","IconStar","IconStarBorder","classNames","Fragment","useMemo","useRef","useState","getCounterTag","BadgeTag","useTitanLayoutContext","NavigationCatalogFooter","styles","childrenOf","item","seen","Set","submenu","groups","flatMap","group","links","filter","link","has","id","add","LockedPin","Trigger","svg","className","lock","Content","PinToggle","pinned","label","onToggle","toggle","event","preventDefault","stopPropagation","delay","appearance","size","icon","star","starActive","aria-label","aria-pressed","onClick","CatalogRows","scopeIds","isPinned","isLocked","onTogglePin","onToggleAll","onNavigate","NavigationComponent","children","everything","anyPinned","some","tag","counter","div","moduleGroup","row","to","title","moduleIcon","inline","moduleTitle","data","badge","map","child","qualifiedTitle","childPinned","childTag","childLink","childTitle","filterGroups","query","needle","trim","toLowerCase","reduce","out","items","kept","matchingChildren","includes","length","push","undefined","NavigationCatalog","open","onClose","pinnedIds","lockedIds","onPinnedIdsChange","onResetToDefaults","setQuery","searchRef","resolvedGroups","visibleGroups","scopeById","Map","pinnedSet","lockedSet","togglePin","ownerId","owner","removing","siblings","get","scoped","sibling","additions","toggleAll","ids","shouldPin","actionable","close","dialog","data-cy","content","body","ref","search","placeholder","value","onChange","target","onClear","results","empty","subdued","columns","variant","groupTitle","onRestore","current","focus"],"mappings":";AAAA,SAASA,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,QAAQ,uBAAuB;AACxF,OAAOC,cAAc,4DAA4D;AACjF,OAAOC,cAAc,4DAA4D;AACjF,OAAOC,oBAAoB,mEAAmE;AAC9F,OAAOC,gBAAgB,aAAa;AACpC,SAAaC,QAAQ,EAAcC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAE5E,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,YAAYC,YAAY,mCAAmC;AAE3D,oEAAoE,GACpE,MAAMC,aAAa,CAACC;;QAGRA;IAFR,MAAMC,OAAO,IAAIC;IAEjB,OAAO,UAACF,gBAAAA,KAAKG,OAAO,cAAZH,oCAAAA,cAAcI,MAAM,uCAAI,EAAE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AAC;oDAC7C2B,UAAUA;oDACVC,UAAUA;oDACVC,aAAawD;oDACbvD,aAAagE;oDACb/D,YAAYmE;mDAPP7G,KAAKW,EAAE;;;uCAnBdL,MAAMgD,KAAK;;;;;;0BAoC7C,KAACzD;gBACGkI,WACIxC,qBACC,CAAA;wBAEG,0EAA0E;oBAC1EE;oBAFAF;qBAEAE,qBAAAA,UAAUuC,OAAO,cAAjBvC,yCAAAA,mBAAmBwC,KAAK;gBAC5B,CAAA;;;;AAKpB,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/titan-layout/navigation-catalog/navigation-catalog.tsx"],"sourcesContent":["import { Button, Dialog, Icon, SearchField, Text, Tooltip } from '@servicetitan/anvil2';\nimport IconLock from '@servicetitan/anvil2/assets/icons/material/round/lock.svg';\nimport IconStar from '@servicetitan/anvil2/assets/icons/material/round/star.svg';\nimport IconStarBorder from '@servicetitan/anvil2/assets/icons/material/round/star_border.svg';\nimport classNames from 'classnames';\nimport { FC, Fragment, MouseEvent, useMemo, useRef, useState } from 'react';\nimport {\n filterCatalogGroups,\n getCatalogChildren,\n getCatalogSubmenuGroups,\n} from '../../../utils/catalog-groups';\nimport { NavigationItemData } from '../../../utils/navigation';\nimport { getCounterTag } from '../../../utils/side-nav';\nimport { BadgeTag } from '../../badge-tag';\nimport { PinnedNavigationConfig } from '../interface';\nimport { useTitanLayoutContext } from '../layout-context';\nimport { NavigationCatalogFooter } from './navigation-catalog-footer';\nimport * as styles from './navigation-catalog.module.less';\n\n/** Shown in place of the pin control for a destination the user may not unpin. */\nconst LockedPin: FC = () => (\n <Tooltip>\n <Tooltip.Trigger>\n <Icon svg={IconLock} className={styles.lock} />\n </Tooltip.Trigger>\n <Tooltip.Content style={{ pointerEvents: 'none' }}>\n Cannot be removed from Favorites\n </Tooltip.Content>\n </Tooltip>\n);\n\ninterface PinToggleProps {\n /** Mixed modules stay highlighted but use an outline until all pages are pinned. */\n pinned: boolean | 'mixed';\n label: string;\n onToggle: () => void;\n}\n\nconst PinToggle: FC<PinToggleProps> = ({ pinned, label, onToggle }) => {\n const toggle = (event: MouseEvent) => {\n // The control sits inside the row but is not a navigation affordance.\n event.preventDefault();\n event.stopPropagation();\n onToggle();\n };\n\n return (\n <Tooltip delay={300}>\n <Tooltip.Trigger>\n <Button\n appearance=\"ghost\"\n size=\"small\"\n icon={pinned === true ? IconStar : IconStarBorder}\n className={classNames(styles.star, pinned && styles.starActive)}\n aria-label={label}\n aria-pressed={pinned}\n onClick={toggle}\n />\n </Tooltip.Trigger>\n <Tooltip.Content style={{ pointerEvents: 'none' }}>\n {pinned === 'mixed'\n ? 'Add this module to Favorites'\n : pinned\n ? 'Remove from Favorites'\n : 'Add to Favorites'}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\ninterface CatalogRowsProps {\n item: NavigationItemData;\n /**\n * Every id the module's own control covers, taken from the unfiltered item.\n *\n * `item` may have been narrowed by the search, so deriving this from it would let the control\n * act on only the pages that happen to be visible — silently stranding the rest.\n */\n scopeIds: string[];\n isPinned: (id: string) => boolean;\n isLocked: (id: string) => boolean;\n /** `ownerId` is the module the page belongs to; omitted for the module's own row. */\n onTogglePin: (id: string, ownerId?: string) => void;\n onToggleAll: (ids: string[], shouldPin: boolean) => void;\n onNavigate: () => void;\n}\n\nconst CatalogRows: FC<CatalogRowsProps> = ({\n item,\n scopeIds,\n isPinned,\n isLocked,\n onTogglePin,\n onToggleAll,\n onNavigate,\n}) => {\n const { NavigationComponent } = useTitanLayoutContext();\n const submenuGroups = getCatalogSubmenuGroups(item);\n\n /*\n * Minus anything locked — locked destinations are always present, so the module's control\n * neither reports on them nor acts on them.\n */\n const everything = scopeIds.filter(id => !isLocked(id));\n const anyPinned = everything.some(isPinned);\n const allPinned = everything.length > 0 && everything.every(isPinned);\n const tag = getCounterTag(item.counter, item.tag);\n\n return (\n <div className={styles.moduleGroup}>\n <div className={styles.row}>\n <NavigationComponent\n to={item.to}\n className={styles.link}\n onClick={onNavigate}\n aria-label={item.title}\n >\n {item.icon && (\n <Icon svg={item.icon} size=\"medium\" className={styles.moduleIcon} />\n )}\n <Text inline size=\"small\" className={styles.moduleTitle}>\n {item.title}\n </Text>\n {/*\n * The same counter the rail shows, so a destination that is asking for\n * attention still says so here — the catalog is the only place an unfavourited\n * one is visible at all.\n */}\n {!!tag && <BadgeTag data={tag} className={styles.badge} />}\n </NavigationComponent>\n {/*\n * One control for the whole module: favouriting it takes its pages with it, and\n * unfavouriting it takes them away again.\n *\n * A gold outline marks a partially favourited module. Fill the star only when\n * its full, unfiltered scope is favourited, including pages hidden by search.\n * Clicking the outline adds the remaining pages; clicking the filled star removes all.\n */}\n {isLocked(item.id) ? (\n <LockedPin />\n ) : (\n <PinToggle\n pinned={allPinned ? true : anyPinned ? 'mixed' : false}\n label={\n allPinned\n ? `Unpin ${item.title} from the navigation`\n : `Pin ${item.title} to the navigation`\n }\n onToggle={() => onToggleAll(everything, !allPinned)}\n />\n )}\n </div>\n {submenuGroups.map(group => (\n <div key={group.links[0].id}>\n {group.title && (\n <Text variant=\"eyebrow\" size=\"small\" className={styles.submenuTitle}>\n {group.title}\n </Text>\n )}\n {group.links.map(child => {\n /*\n * Page titles are only unique within their item — \"Settings\" and \"Reports\" recur\n * across the catalog — and the row that tells them apart is a separate element, so\n * it is not part of any of these names. Anything reading the rows on their own, a\n * screen reader running through the links or a voice command naming one, would\n * otherwise be given the same name several times.\n */\n const qualifiedTitle = `${item.title}: ${child.title}`;\n const childPinned = isPinned(child.id);\n const childTag = getCounterTag(child.counter, child.tag);\n\n return (\n <div key={child.id} className={styles.row}>\n <NavigationComponent\n to={child.to}\n className={classNames(styles.link, styles.childLink)}\n onClick={onNavigate}\n aria-label={qualifiedTitle}\n >\n <Text inline className={styles.childTitle}>\n {child.title}\n </Text>\n {!!childTag && (\n <BadgeTag data={childTag} className={styles.badge} />\n )}\n </NavigationComponent>\n {isLocked(child.id) ? (\n <LockedPin />\n ) : (\n <PinToggle\n pinned={childPinned}\n label={\n childPinned\n ? `Unpin ${qualifiedTitle} from the navigation`\n : `Pin ${qualifiedTitle} to the navigation`\n }\n onToggle={() => onTogglePin(child.id, item.id)}\n />\n )}\n </div>\n );\n })}\n </div>\n ))}\n </div>\n );\n};\n\nexport interface NavigationCatalogProps extends PinnedNavigationConfig {\n open: boolean;\n onClose: () => void;\n}\n\n/**\n * Every destination the host offers, grouped into sections, with a star on every row.\n *\n * The catalog shows what it is given and nothing more — the host has already resolved what this\n * user may reach, so the catalog cannot offer a destination they do not have.\n */\nexport const NavigationCatalog: FC<NavigationCatalogProps> = ({\n open,\n onClose,\n groups,\n pinnedIds,\n lockedIds,\n onPinnedIdsChange,\n onResetToDefaults,\n}) => {\n const [query, setQuery] = useState('');\n const isSearching = query.trim().length > 0;\n const searchRef = useRef<HTMLInputElement>(null);\n\n /*\n * Resolved here rather than by the host, so a catalog that costs requests to enumerate is paid\n * for on opening the dialog and not on every page load. This component is mounted only while\n * open, so the call happens once per open unless the host changes the function.\n */\n const resolvedGroups = useMemo(() => groups(), [groups]);\n\n const visibleGroups = useMemo(\n () => filterCatalogGroups(resolvedGroups, query),\n [resolvedGroups, query]\n );\n\n /*\n * The pin scope of every item, keyed by id and built before the search narrows anything, so a\n * module's control still covers the pages a query is currently hiding.\n */\n const scopeById = useMemo(\n () =>\n new Map(\n resolvedGroups\n .flatMap(group => group.items)\n .map(item => [\n item.id,\n [item.id, ...getCatalogChildren(item).map(child => child.id)],\n ])\n ),\n [resolvedGroups]\n );\n const pinnedSet = useMemo(() => new Set(pinnedIds), [pinnedIds]);\n const lockedSet = useMemo(() => new Set(lockedIds ?? []), [lockedIds]);\n\n const isPinned = (id: string) => pinnedSet.has(id);\n const isLocked = (id: string) => lockedSet.has(id);\n\n /**\n * Favourites or unfavourites one row, carrying its module with it.\n *\n * A page is reached through its module, so the two travel together: favouriting a page brings\n * the module along when it is not already there, and unfavouriting the last one takes the\n * module with it. Leaving the module behind on its own would not read as an emptier\n * navigation — it would put the module back carrying every page it has.\n *\n * Locked ids never reach a proposal. The controls that would move them are not rendered, so\n * that part is belt and braces — but the host's list is the thing that gets persisted, and a\n * locked destination has no business appearing in or disappearing from it.\n */\n const togglePin = (id: string, ownerId?: string) => {\n if (lockedSet.has(id)) {\n return;\n }\n\n /** The module, when it is a separate row that this page can legitimately move. */\n const owner = ownerId !== id && ownerId && !lockedSet.has(ownerId) ? ownerId : undefined;\n\n if (pinnedSet.has(id)) {\n const removing = new Set([id]);\n\n if (owner) {\n const siblings = (scopeById.get(owner) ?? []).filter(\n scoped => scoped !== owner && scoped !== id\n );\n\n if (!siblings.some(sibling => pinnedSet.has(sibling))) {\n removing.add(owner);\n }\n }\n\n onPinnedIdsChange(pinnedIds.filter(pinned => !removing.has(pinned)));\n return;\n }\n\n // Module first, so it reads ahead of its own page in the saved order.\n const additions = owner && !pinnedSet.has(owner) ? [owner, id] : [id];\n\n onPinnedIdsChange([...pinnedIds, ...additions]);\n };\n\n /*\n * One proposal for the whole set rather than one per row, so a host that persists on every\n * change writes once, and every intermediate list — states the user never asked for — never\n * exists.\n */\n const toggleAll = (ids: string[], shouldPin: boolean) => {\n const actionable = ids.filter(id => !lockedSet.has(id));\n\n if (!shouldPin) {\n const removing = new Set(actionable);\n\n onPinnedIdsChange(pinnedIds.filter(pinned => !removing.has(pinned)));\n return;\n }\n\n const additions = actionable.filter(id => !pinnedSet.has(id));\n\n if (additions.length > 0) {\n onPinnedIdsChange([...pinnedIds, ...additions]);\n }\n };\n\n const close = () => {\n setQuery('');\n onClose();\n };\n\n return (\n <Dialog\n open={open}\n onClose={close}\n size=\"xlarge\"\n aria-label=\"All Navigation\"\n className={styles.dialog}\n data-cy=\"navigation-catalog-dialog\"\n >\n <Dialog.Content className={styles.content}>\n <div className={styles.body}>\n <SearchField\n ref={searchRef}\n size=\"small\"\n className={styles.search}\n placeholder=\"Go to ...\"\n value={query}\n onChange={event => setQuery(event.target.value)}\n onClear={() => setQuery('')}\n aria-label=\"Go to\"\n />\n <div\n className={classNames(styles.results, isSearching && styles.searchResults)}\n >\n {visibleGroups.length === 0 ? (\n <div className={styles.empty}>\n {/*\n * Two different nothings: a search that matched no row, and a host\n * that offered no rows at all. The second is a real state — the\n * catalog is reachable whether or not there is anything in it — and\n * quoting an empty query at the user does not describe it.\n */}\n <Text subdued>\n {isSearching ? (\n <Fragment>\n No navigation items match “{query}”.\n </Fragment>\n ) : (\n 'There are no navigation items to show.'\n )}\n </Text>\n </div>\n ) : (\n <div className={isSearching ? undefined : styles.columns}>\n {visibleGroups.map(group => (\n <div\n key={group.title}\n className={isSearching ? undefined : styles.group}\n >\n {/*\n * Browse uses titled columns. Search stacks matches at full\n * width, keeping only each module's own submenu headings.\n */}\n {!isSearching && (\n <Text\n variant=\"eyebrow\"\n size=\"medium\"\n className={styles.groupTitle}\n >\n {group.title}\n </Text>\n )}\n {group.items.map(item => (\n <CatalogRows\n key={item.id}\n item={item}\n scopeIds={scopeById.get(item.id) ?? [item.id]}\n isPinned={isPinned}\n isLocked={isLocked}\n onTogglePin={togglePin}\n onToggleAll={toggleAll}\n onNavigate={close}\n />\n ))}\n </div>\n ))}\n </div>\n )}\n </div>\n </div>\n </Dialog.Content>\n <NavigationCatalogFooter\n onRestore={\n onResetToDefaults &&\n (() => {\n onResetToDefaults();\n // The control disappears with the host's reset; keep focus in the dialog.\n searchRef.current?.focus();\n })\n }\n />\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","Icon","SearchField","Text","Tooltip","IconLock","IconStar","IconStarBorder","classNames","Fragment","useMemo","useRef","useState","filterCatalogGroups","getCatalogChildren","getCatalogSubmenuGroups","getCounterTag","BadgeTag","useTitanLayoutContext","NavigationCatalogFooter","styles","LockedPin","Trigger","svg","className","lock","Content","style","pointerEvents","PinToggle","pinned","label","onToggle","toggle","event","preventDefault","stopPropagation","delay","appearance","size","icon","star","starActive","aria-label","aria-pressed","onClick","CatalogRows","item","scopeIds","isPinned","isLocked","onTogglePin","onToggleAll","onNavigate","NavigationComponent","submenuGroups","everything","filter","id","anyPinned","some","allPinned","length","every","tag","counter","div","moduleGroup","row","to","link","title","moduleIcon","inline","moduleTitle","data","badge","map","group","variant","submenuTitle","links","child","qualifiedTitle","childPinned","childTag","childLink","childTitle","NavigationCatalog","open","onClose","groups","pinnedIds","lockedIds","onPinnedIdsChange","onResetToDefaults","query","setQuery","isSearching","trim","searchRef","resolvedGroups","visibleGroups","scopeById","Map","flatMap","items","pinnedSet","Set","lockedSet","has","togglePin","ownerId","owner","undefined","removing","siblings","get","scoped","sibling","add","additions","toggleAll","ids","shouldPin","actionable","close","dialog","data-cy","content","body","ref","search","placeholder","value","onChange","target","onClear","results","searchResults","empty","subdued","columns","groupTitle","onRestore","current","focus"],"mappings":";AAAA,SAASA,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,QAAQ,uBAAuB;AACxF,OAAOC,cAAc,4DAA4D;AACjF,OAAOC,cAAc,4DAA4D;AACjF,OAAOC,oBAAoB,mEAAmE;AAC9F,OAAOC,gBAAgB,aAAa;AACpC,SAAaC,QAAQ,EAAcC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC5E,SACIC,mBAAmB,EACnBC,kBAAkB,EAClBC,uBAAuB,QACpB,gCAAgC;AAEvC,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,YAAYC,YAAY,mCAAmC;AAE3D,gFAAgF,GAChF,MAAMC,YAAgB,kBAClB,MAACjB;;0BACG,KAACA,QAAQkB,OAAO;0BACZ,cAAA,KAACrB;oBAAKsB,KAAKlB;oBAAUmB,WAAWJ,OAAOK,IAAI;;;0BAE/C,KAACrB,QAAQsB,OAAO;gBAACC,OAAO;oBAAEC,eAAe;gBAAO;0BAAG;;;;AAa3D,MAAMC,YAAgC,CAAC,EAAEC,MAAM,EA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