import { UPDATE_MODEL_EVENT } from '@element-plus/constants' import { useSizeProp } from '@element-plus/hooks' import { buildProps, definePropType, isArray } from '@element-plus/utils' import type { ExtractPropTypes } from 'vue' import type checkboxGroup from './checkbox-group.vue' import type { CheckboxValueType } from './checkbox' export type CheckboxGroupValueType = Exclude[] export const checkboxGroupProps = buildProps({ /** * @description binding value */ modelValue: { type: definePropType(Array), default: () => [], }, /** * @description whether the nesting checkboxes are disabled */ disabled: Boolean, /** * @description minimum number of checkbox checked */ min: Number, /** * @description maximum number of checkbox checked */ max: Number, /** * @description size of checkbox */ size: useSizeProp, /** * @description label for screen reader */ label: String, /** * @description border and background color when button is active */ fill: String, /** * @description font color when button is active */ textColor: String, /** * @description element tag of the checkbox group */ tag: { type: String, default: 'div', }, /** * @description whether to trigger form validation */ validateEvent: { type: Boolean, default: true, }, } as const) export const checkboxGroupEmits = { [UPDATE_MODEL_EVENT]: (val: CheckboxGroupValueType) => isArray(val), change: (val: CheckboxValueType[]) => isArray(val), } export type CheckboxGroupProps = ExtractPropTypes export type CheckboxGroupEmits = typeof checkboxGroupEmits export type CheckboxGroupInstance = InstanceType