element-plus
Version:
A Component Library for Vue 3
1 lines • 5.39 kB
Source Map (JSON)
{"version":3,"file":"radio-group.mjs","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"],"names":[],"mappings":";;;;;AAcO,MAAM,iBAAA,GAA+C;AAAA,EAC1D,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,QAAA,EAAU;AACZ;AA0DO,MAAM,kBAAkB,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAIxC,EAAA,EAAI;AAAA,IACF,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,IAAA,EAAM,WAAA;AAAA;AAAA;AAAA;AAAA,EAIN,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAA,EAAQ,OAAO,CAAA;AAAA,IAC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