{"version":3,"file":"slider.mjs","names":[],"sources":["../../../../../../packages/components/slider/src/slider.ts"],"sourcesContent":["import { placements } from '@popperjs/core'\nimport {\n  buildProps,\n  definePropType,\n  isArray,\n  isNumber,\n} from '@element-plus/utils'\nimport {\n  CHANGE_EVENT,\n  INPUT_EVENT,\n  UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\n\nimport type { Arrayable, ClassValue } from '@element-plus/utils'\nimport type { ExtractPropTypes, ExtractPublicPropTypes } from 'vue'\nimport type { SliderMarkerProps } from './marker'\nimport type Slider from './slider.vue'\n\ntype SliderMarks = Record<number, string | SliderMarkerProps['mark']>\n\nexport interface SliderInitData {\n  firstValue: number\n  secondValue: number\n  oldValue?: Arrayable<number>\n  dragging: boolean\n  sliderSize: number\n}\n\nexport const sliderProps = buildProps({\n  /**\n   * @description binding value\n   */\n  modelValue: {\n    type: definePropType<Arrayable<number>>([Number, Array]),\n    default: 0,\n  },\n  id: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description minimum value\n   */\n  min: {\n    type: Number,\n    default: 0,\n  },\n  /**\n   * @description maximum value\n   */\n  max: {\n    type: Number,\n    default: 100,\n  },\n  /**\n   * @description step size, can be a number or `'mark'` to restrict values to marks. When set to `'mark'`, the `marks` attribute must be set\n   */\n  step: {\n    type: definePropType<number | 'mark'>([Number, String]),\n    default: 1,\n  },\n  /**\n   * @description whether to display an input box, works when `range` is false and `step` is not `'mark'`\n   */\n  showInput: Boolean,\n  /**\n   * @description whether to display control buttons when `show-input` is true\n   */\n  showInputControls: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description size of the slider wrapper, will not work in vertical mode\n   */\n  size: useSizeProp,\n  /**\n   * @description size of the input box, when set `size`, the default is the value of `size`\n   */\n  inputSize: useSizeProp,\n  /**\n   * @description whether to display breakpoints\n   */\n  showStops: Boolean,\n  /**\n   * @description whether to display tooltip value\n   */\n  showTooltip: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description format to display tooltip value\n   */\n  formatTooltip: {\n    type: definePropType<(val: number) => number | string>(Function),\n    default: undefined,\n  },\n  /**\n   * @description whether Slider is disabled\n   */\n  disabled: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description whether to select a range\n   */\n  range: Boolean,\n  /**\n   * @description vertical mode\n   */\n  vertical: Boolean,\n  /**\n   * @description slider height, required in vertical mode\n   */\n  height: String,\n  /**\n   * @description when `range` is true, screen reader label for the start of the range\n   */\n  rangeStartLabel: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description when `range` is true, screen reader label for the end of the range\n   */\n  rangeEndLabel: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description format to display the `aria-valuenow` attribute for screen readers\n   */\n  formatValueText: {\n    type: definePropType<(val: number) => string>(Function),\n    default: undefined,\n  },\n  /**\n   * @description custom class name for the tooltip\n   */\n  tooltipClass: {\n    type: definePropType<ClassValue>([String, Array, Object, Boolean]),\n    default: undefined,\n  },\n  /**\n   * @description position of Tooltip\n   */\n  placement: {\n    type: String,\n    values: placements,\n    default: 'top',\n  },\n  /**\n   * @description marks, type of key must be `number` and must in closed interval `[min, max]`, each mark can custom style\n   */\n  marks: {\n    type: definePropType<SliderMarks>(Object),\n  },\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description when slider tooltip inactive and `persistent` is `false` , popconfirm will be destroyed. `persistent` always be `false` when `show-tooltip ` is `false`\n   */\n  persistent: {\n    type: Boolean,\n    default: true,\n  },\n  ...useAriaProps(['ariaLabel']),\n} as const)\nexport type SliderProps = ExtractPropTypes<typeof sliderProps>\nexport type SliderPropsPublic = ExtractPublicPropTypes<typeof sliderProps>\n\nconst isValidValue = (value: Arrayable<number>) =>\n  isNumber(value) || (isArray(value) && value.every(isNumber))\nexport const sliderEmits = {\n  [UPDATE_MODEL_EVENT]: isValidValue,\n  [INPUT_EVENT]: isValidValue,\n  [CHANGE_EVENT]: isValidValue,\n}\nexport type SliderEmits = typeof sliderEmits\n\nexport type SliderInstance = InstanceType<typeof Slider> & unknown\n"],"mappings":";;;;;;;AA6BA,MAAa,cAAc,WAAW;;;;CAIpC,YAAY;EACV,MAAM,eAAkC,CAAC,QAAQ,KAAK,CAAC;EACvD,SAAS;CACX;CACA,IAAI;EACF,MAAM;EACN,SAAS,KAAA;CACX;;;;CAIA,KAAK;EACH,MAAM;EACN,SAAS;CACX;;;;CAIA,KAAK;EACH,MAAM;EACN,SAAS;CACX;;;;CAIA,MAAM;EACJ,MAAM,eAAgC,CAAC,QAAQ,MAAM,CAAC;EACtD,SAAS;CACX;;;;CAIA,WAAW;;;;CAIX,mBAAmB;EACjB,MAAM;EACN,SAAS;CACX;;;;CAIA,MAAM;;;;CAIN,WAAW;;;;CAIX,WAAW;;;;CAIX,aAAa;EACX,MAAM;EACN,SAAS;CACX;;;;CAIA,eAAe;EACb,MAAM,eAAiD,QAAQ;EAC/D,SAAS,KAAA;CACX;;;;CAIA,UAAU;EACR,MAAM;EACN,SAAS,KAAA;CACX;;;;CAIA,OAAO;;;;CAIP,UAAU;;;;CAIV,QAAQ;;;;CAIR,iBAAiB;EACf,MAAM;EACN,SAAS,KAAA;CACX;;;;CAIA,eAAe;EACb,MAAM;EACN,SAAS,KAAA;CACX;;;;CAIA,iBAAiB;EACf,MAAM,eAAwC,QAAQ;EACtD,SAAS,KAAA;CACX;;;;CAIA,cAAc;EACZ,MAAM,eAA2B;GAAC;GAAQ;GAAO;GAAQ;EAAO,CAAC;EACjE,SAAS,KAAA;CACX;;;;CAIA,WAAW;EACT,MAAM;EACN,QAAQ;EACR,SAAS;CACX;;;;CAIA,OAAO,EACL,MAAM,eAA4B,MAAM,EAC1C;;;;CAIA,eAAe;EACb,MAAM;EACN,SAAS;CACX;;;;CAIA,YAAY;EACV,MAAM;EACN,SAAS;CACX;CACA,GAAG,aAAa,CAAC,WAAW,CAAC;AAC/B,CAAU;AAIV,MAAM,gBAAgB,UACpB,SAAS,KAAK,KAAM,QAAQ,KAAK,KAAK,MAAM,MAAM,QAAQ;AAC5D,MAAa,cAAc;EACxB,qBAAqB;EACrB,cAAc;EACd,eAAe;AAClB"}