{"version":3,"file":"rate.mjs","names":[],"sources":["../../../../../../packages/components/rate/src/rate.ts"],"sourcesContent":["import { Star, StarFilled } from '@element-plus/icons-vue'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport {\n  buildProps,\n  definePropType,\n  iconPropType,\n  isNumber,\n  mutable,\n} from '@element-plus/utils'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\n\nimport type { Component, ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { IconPropType } from '@element-plus/utils'\nimport type Rate from './rate.vue'\n\nexport interface RateProps {\n  /**\n   * @description binding value\n   */\n  modelValue?: number\n  /**\n   * @description native `id` attribute\n   */\n  id?: string\n  /**\n   * @description threshold value between low and medium level. The value itself will be included in low level\n   */\n  lowThreshold?: number\n  /**\n   * @description threshold value between medium and high level. The value itself will be included in high level\n   */\n  highThreshold?: number\n  /**\n   * @description max rating score\n   */\n  max?: number\n  /**\n   * @description colors for icons. If array, it should have 3 elements, each of which corresponds with a score level, else if object, the key should be threshold value between two levels, and the value should be corresponding color\n   */\n  colors?: string[] | Record<number, string>\n  /**\n   * @description color of unselected icons\n   */\n  voidColor?: string\n  /**\n   * @description color of unselected read-only icons\n   */\n  disabledVoidColor?: string\n  /**\n   * @description icon components. If array, it should have 3 elements, each of which corresponds with a score level, else if object, the key should be threshold value between two levels, and the value should be corresponding icon component\n   */\n  icons?: Array<IconPropType> | Record<number, IconPropType>\n  /**\n   * @description component of unselected icons\n   */\n  voidIcon?: IconPropType\n  /**\n   * @description component of unselected read-only icons\n   */\n  disabledVoidIcon?: IconPropType\n  /**\n   * @description whether Rate is read-only\n   */\n  disabled?: boolean\n  /**\n   * @description whether picking half start is allowed\n   */\n  allowHalf?: boolean\n  /**\n   * @description whether to display texts\n   */\n  showText?: boolean\n  /**\n   * @description whether to display current score. show-score and show-text cannot be true at the same time\n   */\n  showScore?: boolean\n  /**\n   * @description color of texts\n   */\n  textColor?: string\n  /**\n   * @description text array\n   */\n  texts?: string[]\n  /**\n   * @description score template\n   */\n  scoreTemplate?: string\n  /**\n   * @description size of Rate\n   */\n  size?: ComponentSize\n  /**\n   * @description whether value can be reset to `0`\n   */\n  clearable?: boolean\n  /**\n   * @description native `aria-label` attribute\n   */\n  ariaLabel?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `RateProps` instead.\n */\nexport const rateProps = buildProps({\n  /**\n   * @description binding value\n   */\n  modelValue: {\n    type: Number,\n    default: 0,\n  },\n  /**\n   * @description native `id` attribute\n   */\n  id: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description threshold value between low and medium level. The value itself will be included in low level\n   */\n  lowThreshold: {\n    type: Number,\n    default: 2,\n  },\n  /**\n   * @description threshold value between medium and high level. The value itself will be included in high level\n   */\n  highThreshold: {\n    type: Number,\n    default: 4,\n  },\n  /**\n   * @description max rating score\n   */\n  max: {\n    type: Number,\n    default: 5,\n  },\n  /**\n   * @description colors for icons. If array, it should have 3 elements, each of which corresponds with a score level, else if object, the key should be threshold value between two levels, and the value should be corresponding color\n   */\n  colors: {\n    type: definePropType<string[] | Record<number, string>>([Array, Object]),\n    default: () => mutable(['', '', ''] as const),\n  },\n  /**\n   * @description color of unselected icons\n   */\n  voidColor: {\n    type: String,\n    default: '',\n  },\n  /**\n   * @description color of unselected read-only icons\n   */\n  disabledVoidColor: {\n    type: String,\n    default: '',\n  },\n  /**\n   * @description icon components. If array, it should have 3 elements, each of which corresponds with a score level, else if object, the key should be threshold value between two levels, and the value should be corresponding icon component\n   */\n  icons: {\n    type: definePropType<\n      Array<string | Component> | Record<number, string | Component>\n    >([Array, Object]),\n    default: () =>\n      [StarFilled, StarFilled, StarFilled] as [Component, Component, Component],\n  },\n  /**\n   * @description component of unselected icons\n   */\n  voidIcon: {\n    type: iconPropType,\n    default: () => Star as Component,\n  },\n  /**\n   * @description component of unselected read-only icons\n   */\n  disabledVoidIcon: {\n    type: iconPropType,\n    default: () => StarFilled as Component,\n  },\n  /**\n   * @description whether Rate is read-only\n   */\n  disabled: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description whether picking half start is allowed\n   */\n  allowHalf: Boolean,\n  /**\n   * @description whether to display texts\n   */\n  showText: Boolean,\n  /**\n   * @description whether to display current score. show-score and show-text cannot be true at the same time\n   */\n  showScore: Boolean,\n  /**\n   * @description color of texts\n   */\n  textColor: {\n    type: String,\n    default: '',\n  },\n  /**\n   * @description text array\n   */\n  texts: {\n    type: definePropType<string[]>(Array),\n    default: () =>\n      mutable([\n        'Extremely bad',\n        'Disappointed',\n        'Fair',\n        'Satisfied',\n        'Surprise',\n      ] as const),\n  },\n  /**\n   * @description score template\n   */\n  scoreTemplate: {\n    type: String,\n    default: '{value}',\n  },\n  /**\n   * @description size of Rate\n   */\n  size: useSizeProp,\n  /**\n   * @description whether value can be reset to `0`\n   */\n  clearable: Boolean,\n  ...useAriaProps(['ariaLabel']),\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `RateProps` instead.\n */\nexport type RatePropsPublic = ExtractPublicPropTypes<typeof rateProps>\n\nexport const rateEmits = {\n  [CHANGE_EVENT]: (value: number) => isNumber(value),\n  [UPDATE_MODEL_EVENT]: (value: number) => isNumber(value),\n}\nexport type RateEmits = typeof rateEmits\n\nexport type RateInstance = InstanceType<typeof Rate> & unknown\n"],"mappings":";;;;;;;;;;;;;AA0GA,MAAa,YAAY,WAAW;CAIlC,YAAY;EACV,MAAM;EACN,SAAS;EACV;CAID,IAAI;EACF,MAAM;EACN,SAAS;EACV;CAID,cAAc;EACZ,MAAM;EACN,SAAS;EACV;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;CAID,KAAK;EACH,MAAM;EACN,SAAS;EACV;CAID,QAAQ;EACN,MAAM,eAAkD,CAAC,OAAO,OAAO,CAAC;EACxE,eAAe,QAAQ;GAAC;GAAI;GAAI;GAAG,CAAU;EAC9C;CAID,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,mBAAmB;EACjB,MAAM;EACN,SAAS;EACV;CAID,OAAO;EACL,MAAM,eAEJ,CAAC,OAAO,OAAO,CAAC;EAClB,eACE;GAAC;GAAY;GAAY;GAAW;EACvC;CAID,UAAU;EACR,MAAM;EACN,eAAe;EAChB;CAID,kBAAkB;EAChB,MAAM;EACN,eAAe;EAChB;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,WAAW;CAIX,UAAU;CAIV,WAAW;CAIX,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,OAAO;EACL,MAAM,eAAyB,MAAM;EACrC,eACE,QAAQ;GACN;GACA;GACA;GACA;GACA;GACD,CAAU;EACd;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;CAID,MAAM;CAIN,WAAW;CACX,GAAG,aAAa,CAAC,YAAY,CAAC;CAC/B,CAAU;AAOX,MAAa,YAAY;EACtB,gBAAgB,UAAkB,SAAS,MAAM;EACjD,sBAAsB,UAAkB,SAAS,MAAM;CACzD"}