import type { VNode } from 'vue'; import type { ContentNavigationItem } from '@nuxt/content'; import type { AppConfig } from '@nuxt/schema'; import type { UseFuseOptions } from '@vueuse/integrations/useFuse'; import theme from '#build/b24ui/content/content-search'; import type { IconComponent } from '../../types/icons'; import type { ButtonProps } from '../Button.vue'; import type { CommandPaletteGroup, CommandPaletteItem, CommandPaletteProps, CommandPaletteSlots } from '../CommandPalette.vue'; import type { InputProps } from '../Input.vue'; import type { LinkProps, LinkPropsKeys } from '../Link.vue'; import type { ModalProps } from '../Modal.vue'; import type { ComponentConfig } from '../../types/tv'; type ContentSearch = ComponentConfig; export interface ContentSearchLink extends Omit { label?: string; description?: string; /** * @IconComponent */ icon?: IconComponent; children?: ContentSearchLink[]; } export interface ContentSearchFile { id: string; title: string; titles: string[]; level: number; content: string; } export interface ContentSearchResult extends ContentSearchFile { snippets?: { title?: string; content?: string; }; } export interface ContentSearchOptions { limit?: number; snippet?: { columns?: ('title' | 'content')[]; around?: number; }; } export type ContentSearchStatus = 'idle' | 'loading' | 'ready' | 'error'; export type ContentSearchFn = (query: string, opts?: ContentSearchOptions) => Promise; export interface ContentSearchItem extends Omit, CommandPaletteItem { level?: number; /** * @IconComponent */ icon?: IconComponent; } /** * @memo not use loadingIcon */ export interface ContentSearchProps extends Pick, Pick, ContentSearchItem>, 'icon' | 'trailingIcon' | 'selectedIcon' | 'childrenIcon' | 'placeholder' | 'autofocus' | 'loading' | 'closeIcon' | 'back' | 'backIcon' | 'disabled' | 'highlightOnHover' | 'labelKey' | 'descriptionKey' | 'preserveGroupOrder' | 'virtualize' | 'groups'> { /** * @defaultValue 'md' */ size?: ContentSearch['variants']['size']; /** * Display a close button in the input (useful when inside a Modal for example). * `{ size: 'sm', color: 'air-tertiary-no-accent' }`{lang="ts-type"} * @emits 'update:open' * @defaultValue true */ close?: boolean | Omit; /** * Configure the input or hide it with `false`. * `{ fixed: true }`{lang="ts-type"} * @defaultValue true */ input?: boolean | Omit; /** * Keyboard shortcut to open the search (used by [`defineShortcuts`](https://bitrix24.github.io/b24ui/docs/composables/define-shortcuts/)) * @defaultValue 'meta_k' */ shortcut?: string; /** Links group displayed as the first group in the command palette. */ links?: T[]; navigation?: ContentNavigationItem[]; files?: ContentSearchFile[]; /** * Options for [useFuse](https://vueuse.org/integrations/useFuse) passed to the [CommandPalette](https://bitrix24.github.io/b24ui/docs/components/command-palette/). * @defaultValue { fuseOptions: { ignoreLocation: true, includeMatches: true, useTokenSearch: true, threshold: 0.1, keys: ['label', 'description', 'suffix'] }, resultLimit: 12, matchAllWhenSearchEmpty: true } */ fuse?: UseFuseOptions; /** * Async search function (e.g. from [`useSearchCollection`](https://content.nuxt.com/docs/utils/use-search-collection)). * When provided, ContentSearch calls it on each keystroke and uses the results instead of Fuse. * Results are mapped, sanitized, and grouped by navigation internally. */ search?: ContentSearchFn; /** * Status of the async search index (e.g. from `useSearchCollection`). * When the status transitions to `'ready'`, the search is automatically re-triggered if there's a pending term. */ searchStatus?: ContentSearchStatus; /** * Delay (in milliseconds) before the search is triggered (debounced). * Keeps the input responsive by only running the search after typing settles. * Set to `0` to disable. * @defaultValue 100 */ searchDelay?: number; /** * When `true`, the theme command will be added to the groups. * @defaultValue true */ colorMode?: boolean; class?: any; b24ui?: ContentSearch['slots'] & CommandPaletteProps, ContentSearchItem>['b24ui']; } export type ContentSearchSlots = CommandPaletteSlots & { content?(props: { close: () => void; }): VNode[]; }; declare const _default: typeof __VLS_export; export default _default; declare const __VLS_export: (__VLS_props: NonNullable>["props"], __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable>["expose"], __VLS_setup?: Promise<{ props: import("vue").PublicProps & __VLS_PrettifyLocal<(ContentSearchProps & { searchTerm?: string; }) & { "onUpdate:searchTerm"?: ((value: string) => any) | undefined; }> & (typeof globalThis extends { __VLS_PROPS_FALLBACK: infer P; } ? P : {}); expose: (exposed: import("vue").ShallowUnwrapRef<{ commandPaletteRef: Readonly>; }>) => void; attrs: any; slots: ContentSearchSlots; emit: (event: "update:searchTerm", value: string) => void; }>) => import("vue").VNode & { __ctx?: NonNullable>; }; type __VLS_PrettifyLocal = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};