element-plus
Version:
A Component Library for Vue 3
1 lines • 2.87 kB
Source Map (JSON)
{"version":3,"file":"avatar.mjs","names":[],"sources":["../../../../../../packages/components/avatar/src/avatar.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n iconPropType,\n isNumber,\n} from '@element-plus/utils'\nimport { componentSizes } from '@element-plus/constants'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { IconPropType, ObjectFit } from '@element-plus/utils'\n\nexport interface AvatarProps {\n /**\n * @description avatar size.\n */\n size?: number | ComponentSize\n /**\n * @description avatar shape.\n */\n shape?: 'circle' | 'square'\n /**\n * @description representation type to icon, more info on icon component.\n */\n icon?: IconPropType\n /**\n * @description the source of the image for an image avatar.\n */\n src?: string\n /**\n * @description native attribute `alt` of image avatar.\n */\n alt?: string\n /**\n * @description native attribute srcset of image avatar.\n */\n srcSet?: string\n /**\n * @description set how the image fit its container for an image avatar.\n */\n fit?: ObjectFit\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `AvatarProps` instead.\n */\nexport const avatarProps = buildProps({\n /**\n * @description avatar size.\n */\n size: {\n type: [Number, String],\n values: componentSizes,\n validator: (val: unknown): val is number => isNumber(val),\n },\n /**\n * @description avatar shape.\n */\n shape: {\n type: String,\n values: ['circle', 'square'],\n },\n /**\n * @description representation type to icon, more info on icon component.\n */\n icon: {\n type: iconPropType,\n },\n /**\n * @description the source of the image for an image avatar.\n */\n src: {\n type: String,\n default: '',\n },\n /**\n * @description native attribute `alt` of image avatar.\n */\n alt: String,\n /**\n * @description native attribute srcset of image avatar.\n */\n srcSet: String,\n /**\n * @description set how the image fit its container for an image avatar.\n */\n fit: {\n type: definePropType<ObjectFit>(String),\n default: 'cover',\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `AvatarProps` instead.\n */\nexport type AvatarPropsPublic = ExtractPublicPropTypes<typeof avatarProps>\n\nexport const avatarEmits = {\n error: (evt: Event) => evt instanceof Event,\n}\nexport type AvatarEmits = typeof avatarEmits\n"],"mappings":";;;;;;;;;AA8CA,MAAa,cAAc,WAAW;CAIpC,MAAM;EACJ,MAAM,CAAC,QAAQ,OAAO;EACtB,QAAQ;EACR,YAAY,QAAgC,SAAS,IAAI;EAC1D;CAID,OAAO;EACL,MAAM;EACN,QAAQ,CAAC,UAAU,SAAS;EAC7B;CAID,MAAM,EACJ,MAAM,cACP;CAID,KAAK;EACH,MAAM;EACN,SAAS;EACV;CAID,KAAK;CAIL,QAAQ;CAIR,KAAK;EACH,MAAM,eAA0B,OAAO;EACvC,SAAS;EACV;CACF,CAAU;AAOX,MAAa,cAAc,EACzB,QAAQ,QAAe,eAAe,OACvC"}