{"version":3,"file":"color-picker.mjs","names":[],"sources":["../../../../../../packages/components/color-picker/src/color-picker.ts"],"sourcesContent":["import { isNil } from 'lodash-unified'\nimport { buildProps, definePropType, isString } from '@element-plus/utils'\nimport {\n  useAriaProps,\n  useEmptyValuesProps,\n  useSizeProp,\n} from '@element-plus/hooks'\nimport { useTooltipContentProps } from '@element-plus/components/tooltip'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { ColorFormats } from '@ctrl/tinycolor'\nimport type ColorPicker from './color-picker.vue'\nimport type { AriaProps, UseEmptyValuesProps } from '@element-plus/hooks'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { ElTooltipContentProps } from '@element-plus/components/tooltip'\n\nexport interface ColorPickerProps\n  extends UseEmptyValuesProps, Pick<AriaProps, 'ariaLabel'> {\n  /**\n   * @description when color-picker inactive and persistent is false, the color panel will be destroyed\n   */\n  persistent?: boolean\n  /**\n   * @description binding value\n   */\n  modelValue?: string | null\n  /**\n   * @description ColorPicker id\n   */\n  id?: string\n  /**\n   * @description whether to display the alpha slider\n   */\n  showAlpha?: boolean\n  /**\n   * @description color format of v-model\n   */\n  colorFormat?: ColorFormats\n  /**\n   * @description whether to disable the ColorPicker\n   */\n  disabled?: boolean\n  /**\n   * @description whether to show clear button\n   */\n  clearable?: boolean\n  /**\n   * @description size of ColorPicker\n   */\n  size?: ComponentSize\n  /**\n   * @description custom class name for ColorPicker's dropdown\n   */\n  popperClass?: ElTooltipContentProps['popperClass']\n  /**\n   * @description custom style for ColorPicker's dropdown\n   */\n  popperStyle?: ElTooltipContentProps['popperStyle']\n  /**\n   * @description ColorPicker tabindex\n   */\n  tabindex?: string | number\n  /**\n   * @description whether color-picker popper is teleported to the body\n   */\n  teleported?: ElTooltipContentProps['teleported']\n  /**\n   * @description which color-picker panel appends to\n   */\n  appendTo?: ElTooltipContentProps['appendTo']\n  /**\n   * @description predefined color options\n   */\n  predefine?: string[]\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent?: boolean\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ColorPickerProps` instead.\n */\nexport const colorPickerProps = buildProps({\n  /**\n   * @description when color-picker inactive and persistent is false, the color panel will be destroyed\n   */\n  persistent: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description binding value\n   */\n  modelValue: {\n    type: definePropType<string | null>(String),\n    default: undefined,\n  },\n  /**\n   * @description ColorPicker id\n   */\n  id: String,\n  /**\n   * @description whether to display the alpha slider\n   */\n  showAlpha: Boolean,\n  /**\n   * @description color format of v-model\n   */\n  colorFormat: {\n    type: definePropType<ColorFormats>(String),\n  },\n  /**\n   * @description whether to disable the ColorPicker\n   */\n  disabled: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description whether to show clear button\n   */\n  clearable: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description size of ColorPicker\n   */\n  size: useSizeProp,\n  /**\n   * @description custom class name for ColorPicker's dropdown\n   */\n  popperClass: useTooltipContentProps.popperClass,\n  /**\n   * @description custom style for ColorPicker's dropdown\n   */\n  popperStyle: useTooltipContentProps.popperStyle,\n  /**\n   * @description ColorPicker tabindex\n   */\n  tabindex: {\n    type: [String, Number],\n    default: 0,\n  },\n  /**\n   * @description whether color-picker popper is teleported to the body\n   */\n  teleported: useTooltipContentProps.teleported,\n  /**\n   * @description which color-picker panel appends to\n   */\n  appendTo: useTooltipContentProps.appendTo,\n  /**\n   * @description predefined color options\n   */\n  predefine: {\n    type: definePropType<string[]>(Array),\n  },\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent: {\n    type: Boolean,\n    default: true,\n  },\n  ...useEmptyValuesProps,\n  ...useAriaProps(['ariaLabel']),\n} as const)\nexport const colorPickerEmits = {\n  [UPDATE_MODEL_EVENT]: (val: string | null) => isString(val) || isNil(val),\n  [CHANGE_EVENT]: (val: string | null) => isString(val) || isNil(val),\n  activeChange: (val: string | null) => isString(val) || isNil(val),\n  focus: (evt: FocusEvent) => evt instanceof FocusEvent,\n  blur: (evt: FocusEvent) => evt instanceof FocusEvent,\n  clear: () => true,\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ColorPickerProps` instead.\n */\nexport type ColorPickerPropsPublic = ExtractPublicPropTypes<\n  typeof colorPickerProps\n>\nexport type ColorPickerEmits = typeof colorPickerEmits\nexport type ColorPickerInstance = InstanceType<typeof ColorPicker> & unknown\n\n/**\n * @description default values for ColorPickerProps, used in components that extend ColorPickerProps\n */\nexport const colorPickerPropsDefaults = {\n  persistent: true,\n  modelValue: undefined,\n  disabled: undefined,\n  clearable: true,\n  popperStyle: undefined,\n  tabindex: 0,\n  teleported: true,\n  validateEvent: true,\n  valueOnClear: undefined,\n} as const\n"],"mappings":";;;;;;;;;;;;;AAoFA,MAAa,mBAAmB,WAAW;CAIzC,YAAY;EACV,MAAM;EACN,SAAS;EACV;CAID,YAAY;EACV,MAAM,eAA8B,OAAO;EAC3C,SAAS;EACV;CAID,IAAI;CAIJ,WAAW;CAIX,aAAa,EACX,MAAM,eAA6B,OAAO,EAC3C;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,MAAM;CAIN,aAAa,uBAAuB;CAIpC,aAAa,uBAAuB;CAIpC,UAAU;EACR,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAID,YAAY,uBAAuB;CAInC,UAAU,uBAAuB;CAIjC,WAAW,EACT,MAAM,eAAyB,MAAM,EACtC;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;CACD,GAAG;CACH,GAAG,aAAa,CAAC,YAAY,CAAC;CAC/B,CAAU;AACX,MAAa,mBAAmB;EAC7B,sBAAsB,QAAuB,SAAS,IAAI,IAAI,MAAM,IAAI;EACxE,gBAAgB,QAAuB,SAAS,IAAI,IAAI,MAAM,IAAI;CACnE,eAAe,QAAuB,SAAS,IAAI,IAAI,MAAM,IAAI;CACjE,QAAQ,QAAoB,eAAe;CAC3C,OAAO,QAAoB,eAAe;CAC1C,aAAa;CACd;;;;AAcD,MAAa,2BAA2B;CACtC,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,WAAW;CACX,aAAa;CACb,UAAU;CACV,YAAY;CACZ,eAAe;CACf,cAAc;CACf"}