@bitrix24/b24ui-nuxt
Version:
Bitrix24 UI-Kit for developing web applications REST API for NUXT & VUE
115 lines (114 loc) • 4.64 kB
TypeScript
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 { ButtonProps, InputProps, LinkProps, ModalProps, CommandPaletteProps, CommandPaletteSlots, CommandPaletteGroup, CommandPaletteItem, IconComponent, LinkPropsKeys } from '../../types';
import type { ComponentConfig } from '../../types/tv';
type ContentSearch = ComponentConfig<typeof theme, AppConfig, 'contentSearch'>;
export interface ContentSearchLink extends Omit<LinkProps, 'custom'> {
label?: string;
description?: string;
/**
* @IconComponent
*/
icon?: IconComponent;
children?: ContentSearchLink[];
}
export interface ContentSearchFile {
id: string;
title: string;
titles: string[];
level: number;
content: string;
}
export interface ContentSearchItem extends Omit<LinkProps, 'custom'>, CommandPaletteItem {
level?: number;
/**
* @IconComponent
*/
icon?: IconComponent;
}
/**
* @memo not use loadingIcon
*/
export interface ContentSearchProps<T extends ContentSearchLink = ContentSearchLink> extends Pick<ModalProps, 'title' | 'description' | 'overlay' | 'transition' | 'content' | 'dismissible' | 'fullscreen' | 'modal' | 'portal'> {
/**
* The icon displayed in the input.
* @defaultValue icons.search
* @IconComponent
*/
icon?: IconComponent;
/**
* The placeholder text for the input.
* @defaultValue t('commandPalette.placeholder')
*/
placeholder?: InputProps['placeholder'];
/**
* Automatically focus the input when component is mounted.
* @defaultValue true
*/
autofocus?: boolean;
/** When `true`, the loading icon will be displayed. */
loading?: boolean;
/**
* 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<ButtonProps, LinkPropsKeys>;
/**
* The icon displayed in the close button.
* @defaultValue icons.close
* @IconComponent
*/
closeIcon?: IconComponent;
/**
* 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[];
/** Custom groups displayed between navigation and color mode group. */
groups?: CommandPaletteGroup<ContentSearchItem>[];
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: { includeMatches: true } }
*/
fuse?: UseFuseOptions<T>;
/**
* When `true`, the theme command will be added to the groups.
* @defaultValue true
*/
colorMode?: boolean;
class?: any;
b24ui?: ContentSearch['slots'] & CommandPaletteProps<CommandPaletteGroup<ContentSearchItem>, ContentSearchItem>['b24ui'];
}
export type ContentSearchSlots = CommandPaletteSlots<CommandPaletteGroup<ContentSearchItem>, ContentSearchItem> & {
content(props: {
close: () => void;
}): any;
};
declare const __VLS_export: <T extends ContentSearchLink>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
props: __VLS_PrettifyLocal<(ContentSearchProps<T> & {
searchTerm?: string;
}) & __VLS_EmitsToProps<__VLS_NormalizeEmits<(evt: "update:searchTerm", value: string) => void>>> & import("vue").PublicProps & (typeof globalThis extends {
__VLS_PROPS_FALLBACK: infer P;
} ? P : {});
expose: (exposed: import("vue").ShallowUnwrapRef<{
commandPaletteRef: Readonly<import("vue").ShallowRef<any>>;
}>) => void;
attrs: any;
slots: ContentSearchSlots;
emit: (evt: "update:searchTerm", value: string) => void;
}>) => import("vue").VNode & {
__ctx?: Awaited<typeof __VLS_setup>;
};
declare const _default: typeof __VLS_export;
export default _default;
type __VLS_PrettifyLocal<T> = {
[K in keyof T as K]: T[K];
} & {};