maz-ui
Version:
A standalone components library for Vue.Js 3 & Nuxt.Js 3
88 lines (87 loc) • 3.37 kB
TypeScript
import { MazUiTranslationsNestedSchema } from '@maz-ui/translations';
import { NormalizeStringOptions } from '@maz-ui/utils/helpers/normalizeString';
import { DeepPartial } from '@maz-ui/utils/ts-helpers/DeepPartial';
import { MazInputProps } from './MazInput.vue';
import { MazColor } from './types';
export type MazChecklistItemOption = {
label: string;
value: string | number;
} & Record<string, any>;
export interface MazChecklistProps<T, O> {
/**
* The model value of the checklist (selected items)
* @type {(T extends unknown)[]}
*/
modelValue?: T[];
/**
* The query to filter the items (model)
* @type {string}
*/
query?: string;
/**
* The list of items to display
* @type {(O extends MazChecklistItemOption)[]}
*/
items?: O[];
/**
* The title of the checklist
*/
title?: string;
/**
* Add elevation to the card
* @default false
*/
elevation?: boolean;
/**
* The search input options
* @default { enabled: false, debounce: 300, autoFocus: false }
*/
search?: boolean | MazInputProps<string>;
/**
* The options to normalize the search query (used by the default search function)
* By default, the threshold is 0.75
*/
searchOptions?: NormalizeStringOptions & {
threshold?: number;
};
/**
* Replace the default search function to provide a custom search function
* @default undefined
*/
searchFunction?: (query: string, items: O[]) => O[] | undefined;
/**
* The color of the checklist (card, checkbox and search input)
* @default primary
*/
color?: MazColor;
/**
* Translations of the checklist component
* @type {DeepPartial<MazUiTranslationsNestedSchema['checklist']>}
* @default Translations from @maz-ui/translations
*/
translations?: DeepPartial<MazUiTranslationsNestedSchema['checklist']>;
}
declare const _default: <T extends string | number, O extends MazChecklistItemOption>(__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<Pick<Partial<{}> & Omit<{
readonly "onUpdate:model-value"?: ((value?: T[] | undefined) => any) | undefined;
readonly "onUpdate:query"?: ((value?: string | undefined) => any) | undefined;
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:model-value" | "onUpdate:query"> & MazChecklistProps<T, O> & Partial<{}>> & import('vue').PublicProps;
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
attrs: any;
slots: {
title?(_: {}): any;
'no-results'?(_: {}): any;
'no-results-text'?(_: {}): any;
item?(_: {
selectedValues: T[] | undefined;
item: O;
}): any;
};
emit: ((evt: "update:model-value", value?: T[] | undefined) => void) & ((evt: "update:query", value?: string | undefined) => void);
}>) => import('vue').VNode & {
__ctx?: Awaited<typeof __VLS_setup>;
};
export default _default;
type __VLS_PrettifyLocal<T> = {
[K in keyof T]: T[K];
} & {};