{"version":3,"file":"input-tag2.mjs","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 '@hd-front-end/utils'\nimport { useSizeProp } from '@hd-front-end/hooks'\nimport {\n  CHANGE_EVENT,\n  EVENT_CODE,\n  INPUT_EVENT,\n  UPDATE_MODEL_EVENT,\n} from '@hd-front-end/constants'\nimport { tagProps } from '@hd-front-end/components/tag/src/tag'\nimport { CircleClose } from '@element-plus/icons-vue'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\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 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)\nexport type InputTagProps = ExtractPropTypes<typeof inputTagProps>\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"],"names":[],"mappings":";;;;;;;;;;AAqBO,MAA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