UNPKG

@bitrix24/b24ui-nuxt

Version:

Bitrix24 UI-Kit for developing web applications REST API for NUXT & VUE

146 lines (145 loc) 5.68 kB
import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuContentProps, NavigationMenuContentEmits, CollapsibleRootProps } from 'reka-ui'; import type { AppConfig } from '@nuxt/schema'; import theme from '#build/b24ui/navigation-menu'; import type { AvatarProps, BadgeProps, LinkProps, IconComponent } from '../types'; import type { ArrayOrNested, DynamicSlots, MergeTypes, NestedItem, EmitsToProps, ComponentConfig } from '../types/utils'; type NavigationMenu = ComponentConfig<typeof theme, AppConfig, 'navigationMenu'>; export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'type'> { /** Description is only used when `orientation` is `horizontal`. */ description?: string; [key: string]: any; } export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'>, Pick<CollapsibleRootProps, 'defaultOpen' | 'open'> { label?: string; /** * @IconComponent */ icon?: IconComponent; avatar?: AvatarProps; /** * Display a badge on the item. * `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"} */ badge?: string | number | BadgeProps; /** * @IconComponent */ trailingIcon?: IconComponent; /** * The type of the item. * The `label` type only works on `vertical` orientation. * @defaultValue 'link' */ type?: 'label' | 'link'; slot?: string; value?: string; children?: NavigationMenuChildItem[]; /** * With orientation=`horizontal` if `true` it will position the dropdown menu correctly */ viewportRtl?: boolean; onSelect?(e: Event): void; [key: string]: any; } export interface NavigationMenuProps<T extends ArrayOrNested<NavigationMenuItem> = ArrayOrNested<NavigationMenuItem>> extends Pick<NavigationMenuRootProps, 'modelValue' | 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'skipDelayDuration' | 'disablePointerLeaveClose' | 'unmountOnHide'> { /** * The element or component this component should render as. * @defaultValue 'div' */ as?: any; /** * The icon displayed to open the menu. * @defaultValue icons.chevronDown * @IconComponent */ trailingIcon?: IconComponent; /** * The icon displayed when the item is an external link. * Set to `false` to hide the external icon. * @defaultValue icons.external * @IconComponent */ externalIcon?: boolean | IconComponent; items?: T; /** * @defaultValue 'primary' */ color?: NavigationMenu['variants']['color']; /** * @defaultValue 'pill' */ variant?: NavigationMenu['variants']['variant']; /** * The orientation of the menu. * @defaultValue 'horizontal' */ orientation?: NavigationMenuRootProps['orientation']; /** * Collapse the navigation menu to only show icons. * Only works when `orientation` is `vertical`. * @defaultValue false */ collapsed?: boolean; /** Display a line next to the active item. */ highlight?: boolean; /** * @defaultValue 'primary' */ highlightColor?: NavigationMenu['variants']['highlightColor']; /** * The content of the menu. */ content?: Omit<NavigationMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<NavigationMenuContentEmits>>; /** * The orientation of the content. * Only works when `orientation` is `horizontal`. * @defaultValue 'vertical' */ contentOrientation?: NavigationMenu['variants']['contentOrientation']; /** * Display an arrow alongside the menu. * @defaultValue false */ arrow?: boolean; /** * The key used to get the label from the item. * @defaultValue 'label' */ labelKey?: keyof NestedItem<T>; class?: any; b24ui?: NavigationMenu['slots']; } export interface NavigationMenuEmits extends NavigationMenuRootEmits { } type SlotProps<T extends NavigationMenuItem> = (props: { item: T; index: number; active?: boolean; }) => any; export type NavigationMenuSlots<A extends ArrayOrNested<NavigationMenuItem> = ArrayOrNested<NavigationMenuItem>, T extends NestedItem<A> = NestedItem<A>> = { 'item': SlotProps<T>; 'item-leading': SlotProps<T>; 'item-label': SlotProps<T>; 'item-trailing': SlotProps<T>; 'item-content': SlotProps<T>; 'list-leading': (props?: {}) => any; 'list-trailing': (props?: {}) => any; } & DynamicSlots<MergeTypes<T>, 'leading' | 'label' | 'trailing' | 'content', { index: number; active?: boolean; }>; declare const _default: <T extends ArrayOrNested<NavigationMenuItem>>(__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:modelValue"?: ((value: string) => any) | undefined; } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & NavigationMenuProps<T> & Partial<{}>> & import("vue").PublicProps; expose(exposed: import("vue").ShallowUnwrapRef<{}>): void; attrs: any; slots: NavigationMenuSlots<T, NestedItem<T>>; emit: (evt: "update:modelValue", value: string) => void; }>) => import("vue").VNode & { __ctx?: Awaited<typeof __VLS_setup>; }; export default _default; type __VLS_PrettifyLocal<T> = { [K in keyof T]: T[K]; } & {};