UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 3.25 kB
{"version":3,"file":"avatar.mjs","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 { CSSProperties, Component, ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\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?: string | Component\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?: CSSProperties['object-fit']\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<CSSProperties['object-fit']>(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"],"names":[],"mappings":";;;;;AA6CO,MAAM,cAAc,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAIpC,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,IACrB,MAAA,EAAQ,cAAA;AAAA,IACR,SAAA,EAAW,CAAC,GAAA,KAAgC,QAAA,CAAS,GAAG;AAAA,GAC1D;AAAA;AAAA;AAAA;AAAA,EAIA,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,MAAA;AAAA,IACN,MAAA,EAAQ,CAAC,QAAA,EAAU,QAAQ;AAAA,GAC7B;AAAA;AAAA;AAAA;AAAA,EAIA,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM;AAAA,GACR;AAAA;AAAA;AAAA;AAAA,EAIA,GAAA,EAAK;AAAA,IACH,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,GAAA,EAAK,MAAA;AAAA;AAAA;AAAA;AAAA,EAIL,MAAA,EAAQ,MAAA;AAAA;AAAA;AAAA;AAAA,EAIR,GAAA,EAAK;AAAA,IACH,IAAA,EAAM,eAA4C,MAAM,CAAA;AAAA,IACxD,OAAA,EAAS;AAAA;AAEb,CAAU;AAOH,MAAM,WAAA,GAAc;AAAA,EACzB,KAAA,EAAO,CAAC,GAAA,KAAe,GAAA,YAAe;AACxC;;;;"}