element-plus
Version:
A Component Library for Vue 3
1 lines • 2.49 kB
Source Map (JSON)
{"version":3,"file":"input-otp.mjs","names":[],"sources":["../../../../../../packages/components/input-otp/src/input-otp.ts"],"sourcesContent":["import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { isString } from '@element-plus/utils'\n\nimport type { InputHTMLAttributes, VNode } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { AriaProps } from '@element-plus/hooks'\n\nexport interface InputOtpProps extends Pick<AriaProps, 'ariaLabel'> {\n /**\n * @description The value of the OTP fields.\n *\n * Since numbers must not have leading zeros, `modelValue` is allowed to be a number only during initialization.\n *\n * @default undefined\n */\n modelValue?: string | number\n /**\n * @description The OTP fields length\n * @default 6\n */\n length?: number\n /**\n * @description Custom validator function\n * @default () => true\n */\n validator?: (char: string, index: number) => boolean\n /**\n * @description Native input mode for virtual keyboards\n */\n inputmode?: InputHTMLAttributes['inputmode']\n /**\n * @description The type of the OTP fields\n * @default 'outlined'\n */\n type?: 'outlined' | 'filled' | 'underlined'\n /**\n * @description The size of the OTP fields\n * @default 'default'\n */\n size?: ComponentSize\n /**\n * @description Whether to enable password mode\n */\n mask?: boolean\n /**\n * @description Whether the OTP fields are disabled\n * @default undefined\n */\n disabled?: boolean\n /**\n * @description Same as `readonly` in native input\n */\n readonly?: boolean\n /**\n * @description Same as `id` in native input\n */\n id?: string\n /**\n * @description Whether to trigger form validation\n */\n validateEvent?: boolean\n /**\n * @description The separator between OTP fields\n */\n separator?: string | VNode | ((index: number) => string | VNode)\n}\n\nexport const inputOtpEmits = {\n [UPDATE_MODEL_EVENT]: (value: string) => isString(value),\n [CHANGE_EVENT]: (value: string) => isString(value),\n finish: (value: string) => isString(value),\n focus: (eve: FocusEvent) => eve instanceof FocusEvent,\n blur: (eve: FocusEvent) => eve instanceof FocusEvent,\n}\n\nexport type InputOtpEmits = typeof inputOtpEmits\n"],"mappings":";;;AAmEA,MAAa,gBAAgB;EAC1B,sBAAsB,UAAkB,SAAS,MAAM;EACvD,gBAAgB,UAAkB,SAAS,MAAM;CAClD,SAAS,UAAkB,SAAS,MAAM;CAC1C,QAAQ,QAAoB,eAAe;CAC3C,OAAO,QAAoB,eAAe;CAC3C"}