{"version":3,"file":"input.mjs","names":[],"sources":["../../../../../../packages/components/input/src/input.ts"],"sourcesContent":["import { markRaw } from 'vue'\nimport {\n  buildProps,\n  definePropType,\n  iconPropType,\n  isString,\n  mutable,\n} from '@element-plus/utils'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport { CircleClose } from '@element-plus/icons-vue'\n\nimport type { ExtractPublicPropTypes, HTMLAttributes, StyleValue } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { IconPropType } from '@element-plus/utils'\n\nexport type InputModelModifiers = {\n  lazy?: true\n  number?: true\n  trim?: true\n}\nexport type InputAutoSize = { minRows?: number; maxRows?: number } | boolean\n// Some commonly used values for input type\nexport type InputType =\n  | 'text'\n  | 'textarea'\n  | 'number'\n  | 'password'\n  | 'email'\n  | 'search'\n  | 'tel'\n  | 'url'\n  | (string & NonNullable<unknown>)\n\nexport interface InputProps {\n  /**\n   * @description native input id\n   */\n  id?: string\n  /**\n   * @description input box size\n   */\n  size?: ComponentSize\n  /**\n   * @description whether to disable\n   */\n  disabled?: boolean\n  /**\n   * @description binding value\n   */\n  modelValue?: string | number | null | undefined\n  /**\n   * @description v-model modifiers, reference [Vue modifiers](https://vuejs.org/guide/essentials/forms.html#modifiers)\n   */\n  modelModifiers?: InputModelModifiers\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 type of input, see more in [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types)\n   */\n  type?: InputType\n  /**\n   * @description control the resizability\n   */\n  resize?: 'none' | 'both' | 'horizontal' | 'vertical'\n  /**\n   * @description whether textarea has an adaptive height\n   */\n  autosize?: InputAutoSize\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 format content\n   */\n  formatter?: (value: string) => string\n  /**\n   * @description parse content\n   */\n  parser?: (value: string) => string\n  /**\n   * @description placeholder\n   */\n  placeholder?: string\n  /**\n   * @description native input form\n   */\n  form?: string\n  /**\n   * @description native input readonly\n   */\n  readonly?: boolean\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 toggleable password input\n   */\n  showPassword?: boolean\n  /**\n   * @description word count\n   */\n  showWordLimit?: boolean\n  /**\n   * @description word count position, valid when `show-word-limit` is true\n   */\n  wordLimitPosition?: 'inside' | 'outside'\n  /**\n   * @description suffix icon\n   */\n  suffixIcon?: IconPropType\n  /**\n   * @description prefix icon\n   */\n  prefixIcon?: IconPropType\n  /**\n   * @description container role, internal properties provided for use by the picker component\n   */\n  containerRole?: string\n  /**\n   * @description input tabindex\n   */\n  tabindex?: string | number\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent?: boolean\n  /**\n   * @description input or textarea element style\n   */\n  inputStyle?: StyleValue\n  /**\n   * @description native input autofocus\n   */\n  autofocus?: boolean\n  /**\n   * @description number of rows of textarea, only works when `type` is 'textarea'\n   */\n  rows?: number\n  /**\n   * @description native `aria-label` attribute\n   */\n  ariaLabel?: string\n  /**\n   * @description native input mode for virtual keyboards\n   */\n  inputmode?: HTMLAttributes['inputmode']\n  /**\n   * @description same as `name` in native input\n   */\n  name?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `InputProps` instead.\n */\nexport const inputProps = buildProps({\n  /**\n   * @description native input id\n   */\n  id: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description input box size\n   */\n  size: useSizeProp,\n  /**\n   * @description whether to disable\n   */\n  disabled: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description binding value\n   */\n  modelValue: {\n    type: definePropType<string | number | null | undefined>([\n      String,\n      Number,\n      Object,\n    ]),\n    default: '',\n  },\n  /**\n   * @description v-model modifiers, reference [Vue modifiers](https://vuejs.org/guide/essentials/forms.html#modifiers)\n   */\n  modelModifiers: {\n    type: definePropType<InputModelModifiers>(Object),\n    default: () => ({}),\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 type of input, see more in [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types)\n   */\n  type: {\n    type: definePropType<InputType>(String),\n    default: 'text',\n  },\n  /**\n   * @description control the resizability\n   */\n  resize: {\n    type: String,\n    values: ['none', 'both', 'horizontal', 'vertical'],\n  },\n  /**\n   * @description whether textarea has an adaptive height\n   */\n  autosize: {\n    type: definePropType<InputAutoSize>([Boolean, Object]),\n    default: false,\n  },\n  /**\n   * @description native input autocomplete\n   */\n  autocomplete: {\n    type: definePropType<HTMLInputElement['autocomplete']>(String),\n    default: 'off',\n  },\n  /**\n   * @description format content\n   */\n  formatter: {\n    type: Function,\n  },\n  /**\n   * @description parse content\n   */\n  parser: {\n    type: Function,\n  },\n  /**\n   * @description placeholder\n   */\n  placeholder: {\n    type: String,\n  },\n  /**\n   * @description native input form\n   */\n  form: {\n    type: String,\n  },\n  /**\n   * @description native input readonly\n   */\n  readonly: Boolean,\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 toggleable password input\n   */\n  showPassword: Boolean,\n  /**\n   * @description word count\n   */\n  showWordLimit: Boolean,\n  /**\n   * @description word count position, valid when `show-word-limit` is true\n   */\n  wordLimitPosition: {\n    type: String,\n    values: ['inside', 'outside'],\n    default: 'inside',\n  },\n  /**\n   * @description suffix icon\n   */\n  suffixIcon: {\n    type: iconPropType,\n  },\n  /**\n   * @description prefix icon\n   */\n  prefixIcon: {\n    type: iconPropType,\n  },\n  /**\n   * @description container role, internal properties provided for use by the picker component\n   */\n  containerRole: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description input tabindex\n   */\n  tabindex: {\n    type: [String, Number],\n    default: 0,\n  },\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description input or textarea element style\n   */\n  inputStyle: {\n    type: definePropType<StyleValue>([Object, Array, String]),\n    default: () => mutable({} as const),\n  },\n  /**\n   * @description native input autofocus\n   */\n  autofocus: Boolean,\n  rows: {\n    type: Number,\n    default: 2,\n  },\n  ...useAriaProps(['ariaLabel']),\n  /**\n   * @description native input mode for virtual keyboards\n   */\n  inputmode: {\n    type: definePropType<HTMLAttributes['inputmode']>(String),\n    default: undefined,\n  },\n  /**\n   * @description same as `name` in native input\n   */\n  name: String,\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `InputProps` instead.\n */\nexport type InputPropsPublic = ExtractPublicPropTypes<typeof inputProps>\n\nexport const inputEmits = {\n  [UPDATE_MODEL_EVENT]: (value: string) => isString(value),\n  input: (value: string) => isString(value),\n  change: (value: string, evt?: Event) =>\n    isString(value) && (evt instanceof Event || evt === undefined),\n  focus: (evt: FocusEvent) => evt instanceof FocusEvent,\n  blur: (evt: FocusEvent) => evt instanceof FocusEvent,\n  clear: (evt: MouseEvent | undefined) =>\n    evt === undefined || evt instanceof MouseEvent,\n  mouseleave: (evt: MouseEvent) => evt instanceof MouseEvent,\n  mouseenter: (evt: MouseEvent) => evt instanceof MouseEvent,\n  // NOTE: when autofill by browser, the keydown event is instanceof Event, not KeyboardEvent\n  // relative bug report https://github.com/element-plus/element-plus/issues/6665\n  keydown: (evt: KeyboardEvent | Event) => evt instanceof Event,\n  compositionstart: (evt: CompositionEvent) => evt instanceof CompositionEvent,\n  compositionupdate: (evt: CompositionEvent) => evt instanceof CompositionEvent,\n  compositionend: (evt: CompositionEvent) => evt instanceof CompositionEvent,\n}\nexport type InputEmits = typeof inputEmits\n\n/**\n * @description default values for InputProps, used in components that extend InputProps like Autocomplete\n */\nexport const inputPropsDefaults = {\n  disabled: undefined,\n  modelValue: '',\n  modelModifiers: () => ({}),\n  type: 'text' as InputType,\n  autocomplete: 'off',\n  clearIcon: markRaw(CircleClose),\n  wordLimitPosition: 'inside',\n  tabindex: 0,\n  validateEvent: true,\n  inputStyle: () => ({}),\n  rows: 2,\n} as const\n"],"mappings":";;;;;;;;;;;;;;AAyKA,MAAa,aAAa,WAAW;CAInC,IAAI;EACF,MAAM;EACN,SAAS;EACV;CAID,MAAM;CAIN,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,YAAY;EACV,MAAM,eAAmD;GACvD;GACA;GACA;GACD,CAAC;EACF,SAAS;EACV;CAID,gBAAgB;EACd,MAAM,eAAoC,OAAO;EACjD,gBAAgB,EAAE;EACnB;CAID,WAAW,EACT,MAAM,CAAC,QAAQ,OAAO,EACvB;CAID,WAAW,EACT,MAAM,CAAC,QAAQ,OAAO,EACvB;CAID,MAAM;EACJ,MAAM,eAA0B,OAAO;EACvC,SAAS;EACV;CAID,QAAQ;EACN,MAAM;EACN,QAAQ;GAAC;GAAQ;GAAQ;GAAc;GAAW;EACnD;CAID,UAAU;EACR,MAAM,eAA8B,CAAC,SAAS,OAAO,CAAC;EACtD,SAAS;EACV;CAID,cAAc;EACZ,MAAM,eAAiD,OAAO;EAC9D,SAAS;EACV;CAID,WAAW,EACT,MAAM,UACP;CAID,QAAQ,EACN,MAAM,UACP;CAID,aAAa,EACX,MAAM,QACP;CAID,MAAM,EACJ,MAAM,QACP;CAID,UAAU;CAIV,WAAW;CAIX,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,cAAc;CAId,eAAe;CAIf,mBAAmB;EACjB,MAAM;EACN,QAAQ,CAAC,UAAU,UAAU;EAC7B,SAAS;EACV;CAID,YAAY,EACV,MAAM,cACP;CAID,YAAY,EACV,MAAM,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