{"version":3,"file":"input-tag.mjs","names":[],"sources":["../../../../../../packages/components/input-tag/src/input-tag.ts"],"sourcesContent":["import {\n  buildProps,\n  definePropType,\n  iconPropType,\n  isArray,\n  isNumber,\n  isString,\n  isUndefined,\n} from '@element-plus/utils'\nimport { useSizeProp } from '@element-plus/hooks'\nimport {\n  CHANGE_EVENT,\n  EVENT_CODE,\n  INPUT_EVENT,\n  UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { tagProps } from '@element-plus/components/tag/src/tag'\nimport { CircleClose } from '@element-plus/icons-vue'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { PopperEffect } from '@element-plus/components/popper'\nimport type { TagProps } from '@element-plus/components/tag'\nimport type { IconPropType } from '@element-plus/utils'\n\nexport interface InputTagProps {\n  /**\n   * @description binding value\n   */\n  modelValue?: string[]\n  /**\n   * @description max number tags that can be enter\n   */\n  max?: number\n  /**\n   * @description tag type\n   */\n  tagType?: TagProps['type']\n  /**\n   * @description tag effect\n   */\n  tagEffect?: TagProps['effect']\n  /**\n   * @description tooltip theme, built-in theme: `dark` / `light`\n   */\n  effect?: PopperEffect\n  /**\n   * @description the key to trigger input tag\n   */\n  trigger?: 'Enter' | 'Space'\n  /**\n   * @description whether tags can be dragged\n   */\n  draggable?: boolean\n  /**\n   * @description add a tag when a delimiter is matched\n   */\n  delimiter?: string | RegExp\n  /**\n   * @description input box size\n   */\n  size?: ComponentSize\n  /**\n   * @description whether to show clear button\n   */\n  clearable?: boolean\n  /**\n   * @description custom clear icon component\n   */\n  clearIcon?: IconPropType\n  /**\n   * @description whether to disable input-tag\n   */\n  disabled?: boolean\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent?: boolean\n  /**\n   * @description native input readonly\n   */\n  readonly?: boolean\n  /**\n   * @description native input autofocus\n   */\n  autofocus?: boolean\n  /**\n   * @description same as `id` in native input\n   */\n  id?: string\n  /**\n   * @description same as `tabindex` in native input\n   */\n  tabindex?: string | number\n  /**\n   * @description same as `maxlength` in native input\n   */\n  maxlength?: string | number\n  /**\n   * @description same as `minlength` in native input\n   */\n  minlength?: string | number\n  /**\n   * @description placeholder of input\n   */\n  placeholder?: string\n  /**\n   * @description native input autocomplete\n   * - When the number of literal types in a union exceeds 315, the TS2590 error occurs. see: https://github.com/vuejs/core/issues/10514\n   */\n  autocomplete?: string // HTMLInputElement['autocomplete']\n  /**\n   * @description whether to save the input value when the input loses focus\n   */\n  saveOnBlur?: boolean\n  /**\n   * @description whether to collapse tags to a text\n   */\n  collapseTags?: boolean\n  /**\n   * @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true\n   */\n  collapseTagsTooltip?: boolean\n  /**\n   * @description the max tags number to be shown. To use this, `collapse-tags` must be true\n   */\n  maxCollapseTags?: number\n  /**\n   * @description native `aria-label` attribute\n   */\n  ariaLabel?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `InputTagProps` instead.\n */\nexport const inputTagProps = buildProps({\n  /**\n   * @description binding value\n   */\n  modelValue: {\n    type: definePropType<string[]>(Array),\n  },\n  /**\n   * @description max number tags that can be enter\n   */\n  max: Number,\n  /**\n   * @description tag type\n   */\n  tagType: { ...tagProps.type, default: 'info' },\n  /**\n   * @description tag effect\n   */\n  tagEffect: tagProps.effect,\n  /**\n   * @description tooltip theme, built-in theme: `dark` / `light`\n   */\n  effect: {\n    type: definePropType<PopperEffect>(String),\n    default: 'light',\n  },\n  /**\n   * @description the key to trigger input tag\n   */\n  trigger: {\n    type: definePropType<'Enter' | 'Space'>(String),\n    default: EVENT_CODE.enter,\n  },\n  /**\n   * @description whether tags can be dragged\n   */\n  draggable: Boolean,\n  /**\n   * @description add a tag when a delimiter is matched\n   */\n  delimiter: {\n    type: [String, RegExp],\n    default: '',\n  },\n  /**\n   * @description input box size\n   */\n  size: useSizeProp,\n  /**\n   * @description whether to show clear button\n   */\n  clearable: Boolean,\n  /**\n   * @description custom clear icon component\n   */\n  clearIcon: {\n    type: iconPropType,\n    default: CircleClose,\n  },\n  /**\n   * @description whether to disable input-tag\n   */\n  disabled: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description native input readonly\n   */\n  readonly: Boolean,\n  /**\n   * @description native input autofocus\n   */\n  autofocus: Boolean,\n  /**\n   * @description same as `id` in native input\n   */\n  id: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description same as `tabindex` in native input\n   */\n  tabindex: {\n    type: [String, Number],\n    default: 0,\n  },\n  /**\n   * @description same as `maxlength` in native input\n   */\n  maxlength: {\n    type: [String, Number],\n  },\n  /**\n   * @description same as `minlength` in native input\n   */\n  minlength: {\n    type: [String, Number],\n  },\n  /**\n   * @description placeholder of input\n   */\n  placeholder: String,\n  /**\n   * @description native input autocomplete\n   */\n  autocomplete: {\n    type: definePropType<HTMLInputElement['autocomplete']>(String),\n    default: 'off',\n  },\n  /**\n   * @description whether to save the input value when the input loses focus\n   */\n  saveOnBlur: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether to collapse tags to a text\n   */\n  collapseTags: Boolean,\n  /**\n   * @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true\n   */\n  collapseTagsTooltip: Boolean,\n  /**\n   * @description the max tags number to be shown. To use this, `collapse-tags` must be true\n   */\n  maxCollapseTags: {\n    type: Number,\n    default: 1,\n  },\n  /**\n   * @description native `aria-label` attribute\n   */\n  ariaLabel: String,\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `InputTagProps` instead.\n */\nexport type InputTagPropsPublic = ExtractPublicPropTypes<typeof inputTagProps>\n\nexport const inputTagEmits = {\n  [UPDATE_MODEL_EVENT]: (value?: string[]) =>\n    isArray(value) || isUndefined(value),\n  [CHANGE_EVENT]: (value?: string[]) => isArray(value) || isUndefined(value),\n  [INPUT_EVENT]: (value: string) => isString(value),\n  'add-tag': (value: string | string[]) => isString(value) || isArray(value),\n  'remove-tag': (value: string, index: number) =>\n    isString(value) && isNumber(index),\n  'drag-tag': (oldIndex: number, newIndex: number, value: string) =>\n    isNumber(oldIndex) && isNumber(newIndex) && isString(value),\n  focus: (evt: FocusEvent) => evt instanceof FocusEvent,\n  blur: (evt: FocusEvent) => evt instanceof FocusEvent,\n  clear: () => true,\n}\nexport type InputTagEmits = typeof inputTagEmits\n"],"mappings":";;;;;;;;;;;;;AAwIA,MAAa,gBAAgB,WAAW;CAItC,YAAY,EACV,MAAM,eAAyB,MAAM,EACtC;CAID,KAAK;CAIL,SAAS;EAAE,GAAG,SAAS;EAAM,SAAS;EAAQ;CAI9C,WAAW,SAAS;CAIpB,QAAQ;EACN,MAAM,eAA6B,OAAO;EAC1C,SAAS;EACV;CAID,SAAS;EACP,MAAM,eAAkC,OAAO;EAC/C,SAAS,WAAW;EACrB;CAID,WAAW;CAIX,WAAW;EACT,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAID,MAAM;CAIN,WAAW;CAIX,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;CAID,UAAU;CAIV,WAAW;CAIX,IAAI;EACF,MAAM;EACN,SAAS;EACV;CAID,UAAU;EACR,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAID,WAAW,EACT,MAAM,CAAC,QAAQ,OAAO,EACvB;CAID,WAAW,EACT,MAAM,CAAC,QAAQ,OAAO,EACvB;CAID,aAAa;CAIb,cAAc;EACZ,MAAM,eAAiD,OAAO;EAC9D,SAAS;EACV;CAID,YAAY;EACV,MAAM;EACN,SAAS;EACV;CAID,cAAc;CAId,qBAAqB;CAIrB,iBAAiB;EACf,MAAM;EACN,SAAS;EACV;CAID,WAAW;CACZ,CAAU;AAOX,MAAa,gBAAgB;EAC1B,sBAAsB,UACrB,QAAQ,MAAM,IAAI,YAAY,MAAM;EACrC,gBAAgB,UAAqB,QAAQ,MAAM,IAAI,YAAY,MAAM;EACzE,eAAe,UAAkB,SAAS,MAAM;CACjD,YAAY,UAA6B,SAAS,MAAM,IAAI,QAAQ,MAAM;CAC1E,eAAe,OAAe,UAC5B,SAAS,MAAM,IAAI,SAAS,MAAM;CACpC,aAAa,UAAkB,UAAkB,UAC/C,SAAS,SAAS,IAAI,SAAS,SAAS,IAAI,SAAS,MAAM;CAC7D,QAAQ,QAAoB,eAAe;CAC3C,OAAO,QAAoB,eAAe;CAC1C,aAAa;CACd"}