@redocly/theme 0.64.0-next.1 → 0.64.0-next.2
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/lib/components/Banner/Banner.js +3 -3
- package/lib/components/Catalog/CatalogActionsRow.d.ts +3 -3
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +4 -6
- package/lib/components/Catalog/CatalogEntities.d.ts +2 -2
- package/lib/components/Catalog/CatalogEntities.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +1 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +2 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +5 -5
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +15 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +14 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +13 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +4 -3
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +3 -2
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +9 -9
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.d.ts +2 -3
- package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.d.ts +2 -3
- package/lib/components/Catalog/CatalogPageDescription.js +1 -1
- package/lib/components/Catalog/CatalogSortButton.d.ts +4 -5
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +6 -2
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +2 -2
- package/lib/components/Catalog/CatalogTableView/CatalogLastUpdateCell.d.ts +5 -0
- package/lib/components/Catalog/CatalogTableView/CatalogLastUpdateCell.js +45 -0
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +5 -3
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +2 -3
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +3 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +1 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +15 -5
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +3 -2
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +2 -2
- package/lib/components/Catalog/CatalogTags.d.ts +11 -0
- package/lib/components/Catalog/CatalogTags.js +62 -0
- package/lib/components/Catalog/variables.js +22 -14
- package/lib/components/Search/SearchDialog.js +118 -116
- package/lib/core/constants/catalog.d.ts +1 -1
- package/lib/core/constants/catalog.js +1 -1
- package/lib/core/hooks/catalog/use-catalog-entity-link.d.ts +8 -0
- package/lib/core/hooks/catalog/use-catalog-entity-link.js +42 -0
- package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.d.ts +2 -1
- package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.js +5 -3
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/styles/dark.d.ts +3 -1
- package/lib/core/styles/dark.js +8 -1
- package/lib/core/styles/global.d.ts +6 -2
- package/lib/core/styles/global.js +18 -10
- package/lib/core/styles/palette.d.ts +6 -0
- package/lib/core/styles/palette.dark.d.ts +3 -0
- package/lib/core/styles/palette.dark.js +216 -0
- package/lib/core/styles/palette.js +179 -0
- package/lib/core/types/catalog.d.ts +23 -7
- package/lib/core/types/hooks.d.ts +6 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/markdoc/components/Heading/Heading.js +2 -2
- package/package.json +2 -2
- package/src/components/Banner/Banner.tsx +7 -7
- package/src/components/Catalog/CatalogActionsRow.tsx +3 -3
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +4 -6
- package/src/components/Catalog/CatalogEntities.tsx +3 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +3 -24
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +2 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +8 -10
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +13 -8
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +27 -15
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +9 -9
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +17 -9
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +4 -8
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +16 -10
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +4 -3
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +18 -11
- package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.tsx +3 -3
- package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.tsx +2 -3
- package/src/components/Catalog/CatalogPageDescription.tsx +1 -1
- package/src/components/Catalog/CatalogSortButton.tsx +5 -6
- package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +6 -2
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +2 -2
- package/src/components/Catalog/CatalogTableView/CatalogLastUpdateCell.tsx +54 -0
- package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +5 -2
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +4 -3
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +17 -7
- package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +3 -2
- package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +2 -2
- package/src/components/Catalog/CatalogTags.tsx +115 -0
- package/src/components/Catalog/variables.ts +22 -14
- package/src/components/Search/SearchDialog.tsx +299 -293
- package/src/core/constants/catalog.ts +1 -1
- package/src/core/hooks/catalog/use-catalog-entity-link.ts +46 -0
- package/src/core/hooks/catalog/use-catalog-table-header-cell-actions.ts +10 -2
- package/src/core/hooks/index.ts +1 -0
- package/src/core/styles/dark.ts +10 -2
- package/src/core/styles/global.ts +20 -12
- package/src/core/styles/palette.dark.ts +214 -0
- package/src/core/styles/palette.ts +177 -0
- package/src/core/types/catalog.ts +24 -8
- package/src/core/types/hooks.ts +5 -10
- package/src/index.ts +1 -1
- package/src/markdoc/components/Heading/Heading.tsx +2 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +0 -10
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +0 -57
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +0 -101
|
@@ -8,6 +8,7 @@ import { SearchInput } from '@redocly/theme/components/Search/SearchInput';
|
|
|
8
8
|
import { SearchShortcut } from '@redocly/theme/components/Search/SearchShortcut';
|
|
9
9
|
import { Button } from '@redocly/theme/components/Button/Button';
|
|
10
10
|
import { breakpoints, concatClassNames } from '@redocly/theme/core/utils';
|
|
11
|
+
import { Portal } from '@redocly/theme/components/Portal/Portal';
|
|
11
12
|
import { SearchItem } from '@redocly/theme/components/Search/SearchItem';
|
|
12
13
|
import { SearchRecent } from '@redocly/theme/components/Search/SearchRecent';
|
|
13
14
|
import { SearchSuggestedPages } from '@redocly/theme/components/Search/SearchSuggestedPages';
|
|
@@ -207,149 +208,140 @@ export function SearchDialog({
|
|
|
207
208
|
const showHeaderButtons = showSearchFilterButton || showAiSearchButton;
|
|
208
209
|
|
|
209
210
|
return (
|
|
210
|
-
<
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
aiQueryRef.current
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
data-translation-key="search.label"
|
|
242
|
-
/>
|
|
243
|
-
{showHeaderButtons && (
|
|
244
|
-
<SearchHeaderButtons>
|
|
245
|
-
{showAiSearchButton ? (
|
|
246
|
-
<SearchAiButton
|
|
247
|
-
icon={<AiStarsGradientIcon color="var(--search-ai-button-icon-color)" />}
|
|
248
|
-
onClick={() => {
|
|
249
|
-
setMode('ai-dialog');
|
|
250
|
-
if (query.trim()) {
|
|
251
|
-
aiSearch.askQuestion(query);
|
|
252
|
-
}
|
|
253
|
-
telemetry.sendSearchAiOpenedMessage([
|
|
254
|
-
{
|
|
255
|
-
object: 'search',
|
|
256
|
-
method: 'ai_search_button',
|
|
257
|
-
},
|
|
258
|
-
]);
|
|
259
|
-
}}
|
|
260
|
-
>
|
|
261
|
-
{translate('search.ai.button', 'Search with AI')}
|
|
262
|
-
</SearchAiButton>
|
|
263
|
-
) : null}
|
|
264
|
-
{showSearchFilterButton && (
|
|
265
|
-
<SearchFilterToggleButton icon={<SettingsIcon />} onClick={onFilterToggle} />
|
|
266
|
-
)}
|
|
267
|
-
</SearchHeaderButtons>
|
|
268
|
-
)}
|
|
269
|
-
</>
|
|
270
|
-
) : (
|
|
271
|
-
<AiDialogHeaderWrapper>
|
|
272
|
-
{initialMode === 'ai-dialog' ? (
|
|
273
|
-
<AiDialogHeaderTitle>
|
|
274
|
-
<AiStarsGradientIcon color="var(--search-ai-button-icon-color)" size="1.25rem" />
|
|
275
|
-
{translate('search.ai.assistant', 'Assistant')}
|
|
276
|
-
</AiDialogHeaderTitle>
|
|
277
|
-
) : (
|
|
278
|
-
<Button
|
|
279
|
-
variant="secondary"
|
|
280
|
-
onClick={() => {
|
|
281
|
-
setMode('search');
|
|
282
|
-
aiSearch.clearConversation();
|
|
283
|
-
focusSearchInput();
|
|
284
|
-
}}
|
|
285
|
-
tabIndex={0}
|
|
286
|
-
icon={<ChevronLeftIcon />}
|
|
287
|
-
>
|
|
288
|
-
{isMobile
|
|
289
|
-
? translate('search.ai.back', 'Back')
|
|
290
|
-
: translate('search.ai.backToSearch', 'Back to search')}
|
|
291
|
-
</Button>
|
|
292
|
-
)}
|
|
293
|
-
<AiDialogHeaderActionsWrapper>
|
|
294
|
-
<Button
|
|
295
|
-
variant="secondary"
|
|
296
|
-
disabled={!aiSearch.conversation.length}
|
|
297
|
-
onClick={() => {
|
|
298
|
-
refreshSearchSessionId();
|
|
299
|
-
aiSearch.clearConversation();
|
|
211
|
+
<Portal>
|
|
212
|
+
<SearchOverlay
|
|
213
|
+
data-component-name="Search/SearchDialog"
|
|
214
|
+
ref={modalRef}
|
|
215
|
+
onClick={handleOverlayClick}
|
|
216
|
+
className={concatClassNames('overlay', className)}
|
|
217
|
+
>
|
|
218
|
+
<SearchDialogWrapper className="scroll-lock" role="dialog">
|
|
219
|
+
<SearchDialogHeader>
|
|
220
|
+
{product && (
|
|
221
|
+
<SearchProductTag color="product">
|
|
222
|
+
{product.name}
|
|
223
|
+
<CloseIcon onClick={() => setProduct(undefined)} color="--icon-color-additional" />
|
|
224
|
+
</SearchProductTag>
|
|
225
|
+
)}
|
|
226
|
+
{mode === 'search' ? (
|
|
227
|
+
<>
|
|
228
|
+
<SearchInput
|
|
229
|
+
value={query}
|
|
230
|
+
onChange={setQuery}
|
|
231
|
+
placeholder={translate('search.label', 'Search docs...')}
|
|
232
|
+
isLoading={isSearchLoading}
|
|
233
|
+
inputRef={searchInputRef}
|
|
234
|
+
onSubmit={() => {
|
|
235
|
+
if (isSearchLoading) return;
|
|
236
|
+
|
|
237
|
+
if (showAiSearchButton && aiQueryRef.current) {
|
|
238
|
+
aiQueryRef.current.focus();
|
|
239
|
+
} else {
|
|
240
|
+
firstSearchResultRef.current?.focus();
|
|
241
|
+
}
|
|
300
242
|
}}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
243
|
+
data-translation-key="search.label"
|
|
244
|
+
/>
|
|
245
|
+
{showHeaderButtons && (
|
|
246
|
+
<SearchHeaderButtons>
|
|
247
|
+
{showAiSearchButton ? (
|
|
248
|
+
<SearchAiButton
|
|
249
|
+
icon={<AiStarsGradientIcon color="var(--search-ai-button-icon-color)" />}
|
|
250
|
+
onClick={() => {
|
|
251
|
+
setMode('ai-dialog');
|
|
252
|
+
if (query.trim()) {
|
|
253
|
+
aiSearch.askQuestion(query);
|
|
254
|
+
}
|
|
255
|
+
telemetry.sendSearchAiOpenedMessage([
|
|
256
|
+
{
|
|
257
|
+
object: 'search',
|
|
258
|
+
method: 'ai_search_button',
|
|
259
|
+
},
|
|
260
|
+
]);
|
|
261
|
+
}}
|
|
262
|
+
>
|
|
263
|
+
{translate('search.ai.button', 'Search with AI')}
|
|
264
|
+
</SearchAiButton>
|
|
265
|
+
) : null}
|
|
266
|
+
{showSearchFilterButton && (
|
|
267
|
+
<SearchFilterToggleButton icon={<SettingsIcon />} onClick={onFilterToggle} />
|
|
268
|
+
)}
|
|
269
|
+
</SearchHeaderButtons>
|
|
270
|
+
)}
|
|
271
|
+
</>
|
|
272
|
+
) : (
|
|
273
|
+
<AiDialogHeaderWrapper>
|
|
274
|
+
{initialMode === 'ai-dialog' ? (
|
|
275
|
+
<AiDialogHeaderTitle>
|
|
276
|
+
<AiStarsGradientIcon
|
|
277
|
+
color="var(--search-ai-button-icon-color)"
|
|
278
|
+
size="1.25rem"
|
|
279
|
+
/>
|
|
280
|
+
{translate('search.ai.assistant', 'Assistant')}
|
|
281
|
+
</AiDialogHeaderTitle>
|
|
282
|
+
) : (
|
|
283
|
+
<Button
|
|
284
|
+
variant="secondary"
|
|
285
|
+
onClick={() => {
|
|
286
|
+
setMode('search');
|
|
287
|
+
aiSearch.clearConversation();
|
|
288
|
+
focusSearchInput();
|
|
289
|
+
}}
|
|
290
|
+
tabIndex={0}
|
|
291
|
+
icon={<ChevronLeftIcon />}
|
|
292
|
+
>
|
|
293
|
+
{isMobile
|
|
294
|
+
? translate('search.ai.back', 'Back')
|
|
295
|
+
: translate('search.ai.backToSearch', 'Back to search')}
|
|
296
|
+
</Button>
|
|
297
|
+
)}
|
|
298
|
+
<AiDialogHeaderActionsWrapper>
|
|
299
|
+
<Button
|
|
300
|
+
variant="secondary"
|
|
301
|
+
disabled={!aiSearch.conversation.length}
|
|
302
|
+
onClick={() => {
|
|
303
|
+
refreshSearchSessionId();
|
|
304
|
+
aiSearch.clearConversation();
|
|
305
|
+
}}
|
|
306
|
+
tabIndex={0}
|
|
307
|
+
icon={<EditIcon />}
|
|
308
|
+
>
|
|
309
|
+
{translate('search.ai.newConversation', 'New conversation')}
|
|
310
|
+
</Button>
|
|
311
|
+
{isMobile && <Button variant="text" icon={<CloseIcon />} onClick={handleClose} />}
|
|
312
|
+
</AiDialogHeaderActionsWrapper>
|
|
313
|
+
</AiDialogHeaderWrapper>
|
|
314
|
+
)}
|
|
315
|
+
</SearchDialogHeader>
|
|
316
|
+
|
|
317
|
+
<SearchDialogBody>
|
|
318
|
+
{mode === 'search' ? (
|
|
319
|
+
<>
|
|
320
|
+
{advancedSearch && isFilterOpen && (
|
|
321
|
+
<SearchDialogBodyFilterView>
|
|
322
|
+
<SearchFilter
|
|
323
|
+
facets={facets}
|
|
324
|
+
filter={filter}
|
|
325
|
+
query={query}
|
|
326
|
+
quickFilterFields={[groupField]}
|
|
327
|
+
onFilterChange={onFilterChange}
|
|
328
|
+
onFilterReset={onFilterReset}
|
|
329
|
+
onFacetReset={onFacetReset}
|
|
330
|
+
/>
|
|
331
|
+
</SearchDialogBodyFilterView>
|
|
332
|
+
)}
|
|
333
|
+
<SearchDialogBodyMainView>
|
|
334
|
+
<SearchGroups
|
|
318
335
|
facets={facets}
|
|
319
|
-
|
|
320
|
-
query={query}
|
|
321
|
-
quickFilterFields={[groupField]}
|
|
336
|
+
searchFilter={filter}
|
|
322
337
|
onFilterChange={onFilterChange}
|
|
323
|
-
|
|
324
|
-
|
|
338
|
+
onQuickFilterReset={onQuickFilterReset}
|
|
339
|
+
groupField={groupField}
|
|
325
340
|
/>
|
|
326
|
-
</SearchDialogBodyFilterView>
|
|
327
|
-
)}
|
|
328
|
-
<SearchDialogBodyMainView>
|
|
329
|
-
<SearchGroups
|
|
330
|
-
facets={facets}
|
|
331
|
-
searchFilter={filter}
|
|
332
|
-
onFilterChange={onFilterChange}
|
|
333
|
-
onQuickFilterReset={onQuickFilterReset}
|
|
334
|
-
groupField={groupField}
|
|
335
|
-
/>
|
|
336
341
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
setMode('ai-dialog');
|
|
341
|
-
if (query.trim()) {
|
|
342
|
-
aiSearch.askQuestion(query);
|
|
343
|
-
}
|
|
344
|
-
telemetry.sendSearchAiOpenedMessage([
|
|
345
|
-
{
|
|
346
|
-
object: 'search',
|
|
347
|
-
method: 'ai_search_input',
|
|
348
|
-
},
|
|
349
|
-
]);
|
|
350
|
-
}}
|
|
351
|
-
onKeyDown={(e) => {
|
|
352
|
-
if (e.key === 'Enter') {
|
|
342
|
+
{showAiSearchItem && (
|
|
343
|
+
<SearchWithAI
|
|
344
|
+
onClick={() => {
|
|
353
345
|
setMode('ai-dialog');
|
|
354
346
|
if (query.trim()) {
|
|
355
347
|
aiSearch.askQuestion(query);
|
|
@@ -360,167 +352,181 @@ export function SearchDialog({
|
|
|
360
352
|
method: 'ai_search_input',
|
|
361
353
|
},
|
|
362
354
|
]);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
355
|
+
}}
|
|
356
|
+
onKeyDown={(e) => {
|
|
357
|
+
if (e.key === 'Enter') {
|
|
358
|
+
setMode('ai-dialog');
|
|
359
|
+
if (query.trim()) {
|
|
360
|
+
aiSearch.askQuestion(query);
|
|
361
|
+
}
|
|
362
|
+
telemetry.sendSearchAiOpenedMessage([
|
|
363
|
+
{
|
|
364
|
+
object: 'search',
|
|
365
|
+
method: 'ai_search_input',
|
|
366
|
+
},
|
|
367
|
+
]);
|
|
368
|
+
}
|
|
369
|
+
}}
|
|
370
|
+
ref={aiQueryRef}
|
|
371
|
+
tabIndex={0}
|
|
372
|
+
role="option"
|
|
373
|
+
aria-selected="true"
|
|
374
|
+
>
|
|
375
|
+
<AiStarsIcon
|
|
376
|
+
style={{ flexShrink: 0 }}
|
|
377
|
+
color="var(--search-ai-icon-color)"
|
|
378
|
+
size="36px"
|
|
379
|
+
background="var(--search-ai-icon-bg-color)"
|
|
380
|
+
margin="0 var(--spacing-md) 0 0"
|
|
381
|
+
borderRadius="var(--border-radius-lg)"
|
|
382
|
+
/>
|
|
383
|
+
<QueryWrapper>
|
|
384
|
+
<Typography fontWeight="var(--font-weight-semibold)">{query}</Typography>
|
|
385
|
+
</QueryWrapper>
|
|
386
|
+
<Typography>- {translate('search.ai.label', 'Ask AI assistant')}</Typography>
|
|
387
|
+
<ReturnKeyIcon color="var(--search-item-text-color)" />
|
|
388
|
+
</SearchWithAI>
|
|
389
|
+
)}
|
|
390
|
+
{showResults ? (
|
|
391
|
+
searchKeysWithResults.length ? (
|
|
392
|
+
searchKeysWithResults.map((key, searchGroupKeyIdx) => {
|
|
393
|
+
const searchResultItems = items[key];
|
|
394
|
+
|
|
395
|
+
if (searchResultItems?.length) {
|
|
396
|
+
return (
|
|
397
|
+
<Fragment key={key}>
|
|
398
|
+
<SearchGroupTitle data-testid="search-group-title">
|
|
399
|
+
{key}
|
|
400
|
+
</SearchGroupTitle>
|
|
401
|
+
{searchResultItems.map((item, idx, resultsArr) =>
|
|
402
|
+
mapItem(
|
|
403
|
+
item,
|
|
404
|
+
idx,
|
|
405
|
+
resultsArr,
|
|
406
|
+
searchGroupKeyIdx === 0 ? firstSearchResultRef : undefined,
|
|
407
|
+
),
|
|
408
|
+
)}
|
|
409
|
+
{showLoadMore(key, searchResultItems.length || 0) && (
|
|
410
|
+
<SearchGroupFooter
|
|
411
|
+
tabIndex={0}
|
|
412
|
+
data-translation-key="search.showMore"
|
|
413
|
+
onKeyDown={(e) => {
|
|
414
|
+
if (e.key === 'Enter') {
|
|
415
|
+
setLoadMore({
|
|
416
|
+
groupKey: key,
|
|
417
|
+
offset: searchResultItems.length || 0,
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}}
|
|
421
|
+
onClick={() =>
|
|
410
422
|
setLoadMore({
|
|
411
423
|
groupKey: key,
|
|
412
424
|
offset: searchResultItems.length || 0,
|
|
413
|
-
})
|
|
425
|
+
})
|
|
414
426
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
)
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
{translate('search.loading', 'Loading...')}
|
|
436
|
-
</SearchMessage>
|
|
427
|
+
>
|
|
428
|
+
{translate('search.showMore', 'Show more')}
|
|
429
|
+
</SearchGroupFooter>
|
|
430
|
+
)}
|
|
431
|
+
</Fragment>
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
return null;
|
|
436
|
+
})
|
|
437
|
+
) : isSearchLoading ? (
|
|
438
|
+
<SearchMessage data-translation-key="search.loading">
|
|
439
|
+
<SpinnerLoader size="26px" color="var(--search-input-icon-color)" />
|
|
440
|
+
{translate('search.loading', 'Loading...')}
|
|
441
|
+
</SearchMessage>
|
|
442
|
+
) : (
|
|
443
|
+
<SearchMessage data-translation-key="search.noResults">
|
|
444
|
+
<b>{translate('search.noResults.title', 'No results')}</b>
|
|
445
|
+
</SearchMessage>
|
|
446
|
+
)
|
|
437
447
|
) : (
|
|
438
|
-
|
|
439
|
-
<
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
448
|
+
<>
|
|
449
|
+
<SearchRecent
|
|
450
|
+
onSelect={(query, index) => {
|
|
451
|
+
telemetry.sendSearchRecentClickedMessage([
|
|
452
|
+
{
|
|
453
|
+
object: 'search',
|
|
454
|
+
query,
|
|
455
|
+
index: index.toString(),
|
|
456
|
+
searchSessionId,
|
|
457
|
+
},
|
|
458
|
+
]);
|
|
459
|
+
setQuery(query);
|
|
460
|
+
focusSearchInput();
|
|
461
|
+
}}
|
|
462
|
+
/>
|
|
463
|
+
<SearchSuggestedPages />
|
|
464
|
+
</>
|
|
465
|
+
)}
|
|
466
|
+
</SearchDialogBodyMainView>
|
|
467
|
+
</>
|
|
468
|
+
) : (
|
|
469
|
+
<SearchAiDialog
|
|
470
|
+
initialMessage={query}
|
|
471
|
+
response={aiSearch.response}
|
|
472
|
+
isGeneratingResponse={aiSearch.isGeneratingResponse}
|
|
473
|
+
error={aiSearch.error}
|
|
474
|
+
resources={aiSearch.resources}
|
|
475
|
+
conversation={aiSearch.conversation}
|
|
476
|
+
setConversation={aiSearch.setConversation}
|
|
477
|
+
onMessageSent={aiSearch.askQuestion}
|
|
478
|
+
toolCalls={aiSearch.toolCalls}
|
|
479
|
+
contentSegments={aiSearch.contentSegments}
|
|
480
|
+
/>
|
|
481
|
+
)}
|
|
482
|
+
</SearchDialogBody>
|
|
483
|
+
<SearchDialogFooter>
|
|
484
|
+
{mode === 'ai-dialog' ? (
|
|
485
|
+
<AiDisclaimer>
|
|
486
|
+
{translate(
|
|
487
|
+
'search.ai.disclaimer',
|
|
488
|
+
'AI search might provide incomplete or incorrect results. Verify important information.',
|
|
460
489
|
)}
|
|
461
|
-
</
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
combination="Esc"
|
|
502
|
-
text={translate('search.keys.exit', 'to exit')}
|
|
503
|
-
/>
|
|
504
|
-
</SearchShortcuts>
|
|
505
|
-
{isSearchLoading && (
|
|
506
|
-
<SearchLoading>
|
|
507
|
-
<SpinnerLoader size="16px" color="var(--search-input-icon-color)" />
|
|
508
|
-
{translate('search.loading', 'Loading...')}
|
|
509
|
-
</SearchLoading>
|
|
510
|
-
)}
|
|
511
|
-
<SearchCancelButton
|
|
512
|
-
data-translation-key="search.cancel"
|
|
513
|
-
variant="secondary"
|
|
514
|
-
size="small"
|
|
515
|
-
onClick={handleClose}
|
|
516
|
-
>
|
|
517
|
-
{translate('search.cancel', 'Cancel')}
|
|
518
|
-
</SearchCancelButton>
|
|
519
|
-
</>
|
|
520
|
-
)}
|
|
521
|
-
</SearchDialogFooter>
|
|
522
|
-
</SearchDialogWrapper>
|
|
523
|
-
</SearchOverlay>
|
|
490
|
+
</AiDisclaimer>
|
|
491
|
+
) : (
|
|
492
|
+
<>
|
|
493
|
+
<SearchShortcuts>
|
|
494
|
+
<SearchShortcut
|
|
495
|
+
data-translation-key="search.keys.navigate"
|
|
496
|
+
combination="Tab"
|
|
497
|
+
text={translate('search.keys.navigate', 'to navigate')}
|
|
498
|
+
/>
|
|
499
|
+
<SearchShortcut
|
|
500
|
+
data-translation-key="search.keys.select"
|
|
501
|
+
combination="⏎"
|
|
502
|
+
text={translate('search.keys.select', 'to select')}
|
|
503
|
+
/>
|
|
504
|
+
<SearchShortcut
|
|
505
|
+
data-translation-key="search.keys.exit"
|
|
506
|
+
combination="Esc"
|
|
507
|
+
text={translate('search.keys.exit', 'to exit')}
|
|
508
|
+
/>
|
|
509
|
+
</SearchShortcuts>
|
|
510
|
+
{isSearchLoading && (
|
|
511
|
+
<SearchLoading>
|
|
512
|
+
<SpinnerLoader size="16px" color="var(--search-input-icon-color)" />
|
|
513
|
+
{translate('search.loading', 'Loading...')}
|
|
514
|
+
</SearchLoading>
|
|
515
|
+
)}
|
|
516
|
+
<SearchCancelButton
|
|
517
|
+
data-translation-key="search.cancel"
|
|
518
|
+
variant="secondary"
|
|
519
|
+
size="small"
|
|
520
|
+
onClick={handleClose}
|
|
521
|
+
>
|
|
522
|
+
{translate('search.cancel', 'Cancel')}
|
|
523
|
+
</SearchCancelButton>
|
|
524
|
+
</>
|
|
525
|
+
)}
|
|
526
|
+
</SearchDialogFooter>
|
|
527
|
+
</SearchDialogWrapper>
|
|
528
|
+
</SearchOverlay>
|
|
529
|
+
</Portal>
|
|
524
530
|
);
|
|
525
531
|
}
|
|
526
532
|
|