UNPKG

maz-ui

Version:

A standalone components library for Vue.Js 3 & Nuxt.Js 3

172 lines (171 loc) 4.93 kB
import { MazUiTranslationsNestedSchema } from '@maz-ui/translations'; import { HTMLAttributes } from 'vue'; import { CodesType, DisplayNameCode, DisplayNamesOptions } from '../composables/useDisplayNames'; import { MazPopoverProps } from './MazPopover.vue'; import { MazSelectProps } from './MazSelect.vue'; import { MazColor, MazSize } from './types'; export interface MazSelectCountryProps<Option extends { name: string; code: DisplayNameCode | string; } = { name: string; code: string; }> extends Omit<MazSelectProps<Option['code'], Option, false>, 'options' | 'multiple'> { /** * Style attribut of the component root element * @type {HTMLAttributes['style']} */ style?: HTMLAttributes['style']; /** * Class attribut of the component root element * @type {HTMLAttributes['class']} */ class?: HTMLAttributes['class']; /** * Id of the component */ id?: string; /** * Color of the component * @type {MazColor} * @default primary */ color?: MazColor; /** * Size of the component * @type {MazSize} * @default md */ size?: MazSize; /** * Preferred countries to display * @type {Option['code'][]} */ preferredCodes?: Option['code'][]; /** * Ignored countries to display * @type {Option['code'][]} */ ignoredCodes?: Option['code'][]; /** * Only countries to display * @type {Option['code'][]} */ onlyCodes?: Option['code'][]; /** * Position of the list * @type {MazPopoverProps['position']} * @default 'auto' */ listPosition?: MazPopoverProps['position']; /** * Hide flags */ hideFlags?: boolean; /** * Display search input in options list * @type {boolean} * @default true */ search?: boolean; /** * Show code on list * @default false */ showCodeInList?: boolean; /** * Locale * @type {string} * @default locale defined within the maz-ui plugin or browser locale or en-US */ locale?: string; /** * Success state */ success?: boolean; /** * Error state */ error?: boolean; /** * Warning state */ warning?: boolean; /** * */ displayCode?: boolean; /** * Search threshold */ searchThreshold?: number; /** * Translations * @type {Partial<MazUiTranslationsNestedSchema['selectCountry']>} * @default MazUiTranslationsNestedSchema['selectCountry'] */ translations?: Partial<MazUiTranslationsNestedSchema['selectCountry']>; /** * Hint message displayed */ hint?: string; /** * Options * @type {Option[]} */ options?: Option[]; /** * Display name type * @type {Intl.DisplayNamesOptions} * @default { type: 'region', languageDisplay: 'standard', fallback: 'code', style: 'long' } */ displayNamesOptions?: DisplayNamesOptions; /** * Codes type * @type {CodesType} * @default defined by displayNamesOptions.type (if 'region', 'country' is used, otherwise 'iso') * @values 'iso' | 'bcp' | 'country' | 'all' */ codesType?: CodesType; /** * Open the select * @type {boolean} * @default false */ open?: boolean; } declare const _default: <Option extends { name: string; code: DisplayNameCode | string; }>(__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?: Option["code"] | undefined) => any) | undefined; } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:model-value"> & MazSelectCountryProps<Option> & Partial<{}>> & import('vue').PublicProps; expose(exposed: import('vue').ShallowUnwrapRef<{}>): void; attrs: any; slots: { 'selector-flag'?(_: { countryCode: Option["code"] | undefined; }): any; 'no-results'?(_: {}): any; 'country-list-flag'?(_: { option: Option; isSelected: boolean; }): any; 'country-list-code'?(_: { option: Option; isSelected: boolean; }): any; 'country-list-name'?(_: { option: Option; isSelected: boolean; }): any; }; emit: (evt: "update:model-value", value?: Option["code"] | undefined) => void; }>) => import('vue').VNode & { __ctx?: Awaited<typeof __VLS_setup>; }; export default _default; type __VLS_PrettifyLocal<T> = { [K in keyof T]: T[K]; } & {};