UNPKG

@nuxt/ui

Version:

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.

90 lines (89 loc) 3.94 kB
import type { CheckboxGroupRootProps, CheckboxGroupRootEmits } from 'reka-ui'; import type { AppConfig } from '@nuxt/schema'; import theme from '#build/ui/checkbox-group'; import type { CheckboxProps } from '../types'; import type { AcceptableValue, GetItemKeys, GetModelValue } from '../types/utils'; import type { ComponentConfig } from '../types/tv'; type CheckboxGroup = ComponentConfig<typeof theme, AppConfig, 'checkboxGroup'>; export type CheckboxGroupValue = AcceptableValue; export type CheckboxGroupItem = CheckboxGroupValue | { label?: string; description?: string; disabled?: boolean; value?: string; class?: any; ui?: Pick<CheckboxGroup['slots'], 'item'> & Omit<Required<CheckboxProps>['ui'], 'root'>; [key: string]: any; }; export interface CheckboxGroupProps<T extends CheckboxGroupItem[] = CheckboxGroupItem[], VK extends GetItemKeys<T> = 'value'> extends Pick<CheckboxGroupRootProps, 'disabled' | 'loop' | 'name' | 'required'>, Pick<CheckboxProps, 'color' | 'indicator' | 'icon'> { /** * The element or component this component should render as. * @defaultValue 'div' */ as?: any; legend?: string; /** * When `items` is an array of objects, select the field to use as the value. * @defaultValue 'value' */ valueKey?: VK; /** * When `items` is an array of objects, select the field to use as the label. * @defaultValue 'label' */ labelKey?: GetItemKeys<T>; /** * When `items` is an array of objects, select the field to use as the description. * @defaultValue 'description' */ descriptionKey?: GetItemKeys<T>; items?: T; /** The controlled value of the CheckboxGroup. Can be bind as `v-model`. */ modelValue?: GetModelValue<T, VK, true>; /** The value of the CheckboxGroup when initially rendered. Use when you do not need to control the state of the CheckboxGroup. */ defaultValue?: GetModelValue<T, VK, true>; /** * @defaultValue 'md' */ size?: CheckboxGroup['variants']['size']; /** * @defaultValue 'list' */ variant?: CheckboxGroup['variants']['variant']; /** * The orientation the checkbox buttons are laid out. * @defaultValue 'vertical' */ orientation?: CheckboxGroupRootProps['orientation']; class?: any; ui?: CheckboxGroup['slots'] & CheckboxProps['ui']; } export type CheckboxGroupEmits<T extends CheckboxGroupItem[] = CheckboxGroupItem[]> = CheckboxGroupRootEmits<T[number]> & { change: [event: Event]; }; type SlotProps<T extends CheckboxGroupItem> = (props: { item: T & { id: string; }; }) => any; export interface CheckboxGroupSlots<T extends CheckboxGroupItem[] = CheckboxGroupItem[]> { legend(props?: {}): any; label: SlotProps<T[number]>; description: SlotProps<T[number]>; } declare const __VLS_export: <T extends CheckboxGroupItem[], VK extends GetItemKeys<T> = "value">(__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<CheckboxGroupProps<T, VK> & __VLS_EmitsToProps<__VLS_NormalizeEmits<((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T[number][]) => void)>>> & import("vue").PublicProps & (typeof globalThis extends { __VLS_PROPS_FALLBACK: infer P; } ? P : {}); expose: (exposed: {}) => void; attrs: any; slots: CheckboxGroupSlots<T>; emit: ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T[number][]) => 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]; } & {};