UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 4.64 kB
{"version":3,"file":"radio-group.mjs","names":[],"sources":["../../../../../../packages/components/radio/src/radio-group.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport { radioEmits } from './radio'\n\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type RadioGroup from './radio-group.vue'\n\nexport type radioOptionProp = {\n value?: string\n label?: string\n disabled?: string\n}\n\nexport const radioDefaultProps: Required<radioOptionProp> = {\n label: 'label',\n value: 'value',\n disabled: 'disabled',\n}\n\nexport type radioOption = Record<string, any>\n\nexport interface RadioGroupProps {\n /**\n * @description native `id` attribute\n */\n id?: string\n /**\n * @description the size of radio buttons or bordered radios\n */\n size?: ComponentSize\n /**\n * @description whether the nesting radios are disabled\n */\n disabled?: boolean\n /**\n * @description binding value\n */\n modelValue?: string | number | boolean\n /**\n * @description border and background color when button is active\n */\n fill?: string\n /**\n * @description font color when button is active\n */\n textColor?: string\n /**\n * @description native `name` attribute\n */\n name?: string\n /**\n * @description whether to trigger form validation\n */\n validateEvent?: boolean\n /**\n * @description radio options\n */\n options?: radioOption[]\n /**\n * @description custom prop names for options\n */\n props?: radioOptionProp\n /**\n * @description radio type\n */\n type?: 'radio' | 'button'\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `RadioGroupProps` instead.\n */\nexport const radioGroupProps = buildProps({\n /**\n * @description native `id` attribute\n */\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description the size of radio buttons or bordered radios\n */\n size: useSizeProp,\n /**\n * @description whether the nesting radios are disabled\n */\n disabled: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description binding value\n */\n modelValue: {\n type: [String, Number, Boolean],\n default: undefined,\n },\n /**\n * @description border and background color when button is active\n */\n fill: {\n type: String,\n default: '',\n },\n /**\n * @description font color when button is active\n */\n textColor: {\n type: String,\n default: '',\n },\n /**\n * @description native `name` attribute\n */\n name: {\n type: String,\n default: undefined,\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n options: {\n type: definePropType<radioOption[]>(Array),\n },\n props: {\n type: definePropType<radioOptionProp>(Object),\n default: () => radioDefaultProps,\n },\n type: {\n type: String,\n values: ['radio', 'button'] as const,\n default: 'radio',\n },\n ...useAriaProps(['ariaLabel']),\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `RadioGroupProps` instead.\n */\nexport type RadioGroupPropsPublic = ExtractPublicPropTypes<\n typeof radioGroupProps\n>\n\nexport const radioGroupEmits = radioEmits\nexport type RadioGroupEmits = typeof radioGroupEmits\nexport type RadioGroupInstance = InstanceType<typeof RadioGroup> & unknown\n\n/**\n * @description default values for RadioGroupProps\n */\nexport const radioGroupPropsDefaults = {\n id: undefined,\n disabled: undefined,\n modelValue: undefined,\n fill: '',\n textColor: '',\n name: undefined,\n validateEvent: true,\n props: () => radioDefaultProps,\n type: 'radio',\n} as const\n"],"mappings":";;;;;;AAcA,MAAa,oBAA+C;CAC1D,OAAO;CACP,OAAO;CACP,UAAU;CACX;;;;AA0DD,MAAa,kBAAkB,WAAW;CAIxC,IAAI;EACF,MAAM;EACN,SAAS;EACV;CAID,MAAM;CAIN,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,YAAY;EACV,MAAM;GAAC;GAAQ;GAAQ;GAAQ;EAC/B,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;CACD,SAAS,EACP,MAAM,eAA8B,MAAM,EAC3C;CACD,OAAO;EACL,MAAM,eAAgC,OAAO;EAC7C,eAAe;EAChB;CACD,MAAM;EACJ,MAAM;EACN,QAAQ,CAAC,SAAS,SAAS;EAC3B,SAAS;EACV;CACD,GAAG,aAAa,CAAC,YAAY,CAAC;CAC/B,CAAU;AASX,MAAa,kBAAkB;;;;AAO/B,MAAa,0BAA0B;CACrC,IAAI;CACJ,UAAU;CACV,YAAY;CACZ,MAAM;CACN,WAAW;CACX,MAAM;CACN,eAAe;CACf,aAAa;CACb,MAAM;CACP"}