{"version":3,"file":"rate.mjs","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 { useSizeProp } from '@element-plus/hooks'\nimport type { Component, ExtractPropTypes } from 'vue'\nimport type Rate from './rate.vue'\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: () => [StarFilled, StarFilled, StarFilled],\n  },\n  /**\n   * @description component of unselected icons\n   */\n  voidIcon: {\n    type: iconPropType,\n    default: () => Star,\n  },\n  /**\n   * @description component of unselected read-only icons\n   */\n  disabledVoidIcon: {\n    type: iconPropType,\n    default: () => StarFilled,\n  },\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: {\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 same as `aria-label` in Rate\n   */\n  label: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description whether value can be reset to `0`\n   */\n  clearable: {\n    type: Boolean,\n    default: false,\n  },\n} as const)\n\nexport type RateProps = ExtractPropTypes<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>\n"],"names":[],"mappings":";;;;;;;;;;;AAUY,MAAC,SAAS,GAAG,UAAU,CAAC;AACpC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI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