{"version":3,"file":"rate2.mjs","sources":["../../../../../../../packages/components/rate/src/rate.ts"],"sourcesContent":["import { Star, StarFilled } from '@element-plus/icons-vue'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@hd-front-end/constants'\nimport {\n  buildProps,\n  definePropType,\n  iconPropType,\n  isNumber,\n  mutable,\n} from '@hd-front-end/utils'\nimport { useAriaProps, useSizeProp } from '@hd-front-end/hooks'\n\nimport type { Component, ExtractPropTypes, __ExtractPublicPropTypes } 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: () =>\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: 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 whether value can be reset to `0`\n   */\n  clearable: Boolean,\n  ...useAriaProps(['ariaLabel']),\n} as const)\n\nexport type RateProps = ExtractPropTypes<typeof rateProps>\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"],"names":[],"mappings":";;;;;;;;;AAcO,MAAM,YAAY,UAAW,CAAA;AAAA,EAIlC,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,CAAA;AAAA,GACX;AAAA,EAIA,EAAI,EAAA;AAAA,IACF,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,YAAc,EAAA;AAAA,IACZ,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,CAAA;AAAA,GAC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