{"version":3,"file":"input-number2.mjs","sources":["../../../../../../../packages/components/input-number/src/input-number.ts"],"sourcesContent":["import { isNil } from 'lodash-unified'\nimport { useAriaProps, useSizeProp } from '@hd-front-end/hooks'\nimport { buildProps, definePropType, isNumber } from '@hd-front-end/utils'\nimport {\n  CHANGE_EVENT,\n  INPUT_EVENT,\n  UPDATE_MODEL_EVENT,\n} from '@hd-front-end/constants'\n\nimport type {\n  ExtractPropTypes,\n  HTMLAttributes,\n  __ExtractPublicPropTypes,\n} from 'vue'\nimport type InputNumber from './input-number.vue'\n\nexport const inputNumberProps = buildProps({\n  /**\n   * @description same as `id` in native input\n   */\n  id: {\n    type: String,\n    default: undefined,\n  },\n  /**\n   * @description incremental step\n   */\n  step: {\n    type: Number,\n    default: 1,\n  },\n  /**\n   * @description whether input value can only be multiple of step\n   */\n  stepStrictly: Boolean,\n  /**\n   * @description the maximum allowed value\n   */\n  max: {\n    type: Number,\n    default: Number.MAX_SAFE_INTEGER,\n  },\n  /**\n   * @description the minimum allowed value\n   */\n  min: {\n    type: Number,\n    default: Number.MIN_SAFE_INTEGER,\n  },\n  /**\n   * @description binding value\n   */\n  modelValue: {\n    type: [Number, null],\n  },\n  /**\n   * @description same as `readonly` in native input\n   */\n  readonly: Boolean,\n  /**\n   * @description whether the component is disabled\n   */\n  disabled: Boolean,\n  /**\n   * @description size of the component\n   */\n  size: useSizeProp,\n  /**\n   * @description whether to enable the control buttons\n   */\n  controls: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description position of the control buttons\n   */\n  controlsPosition: {\n    type: String,\n    default: '',\n    values: ['', 'right'],\n  },\n  /**\n   * @description value should be set when input box is cleared\n   */\n  valueOnClear: {\n    type: [String, Number, null],\n    validator: (val: 'min' | 'max' | number | null) =>\n      val === null || isNumber(val) || ['min', 'max'].includes(val),\n    default: null,\n  },\n  /**\n   * @description same as `name` in native input\n   */\n  name: String,\n  /**\n   * @description same as `placeholder` in native input\n   */\n  placeholder: String,\n  /**\n   * @description precision of input value\n   */\n  precision: {\n    type: Number,\n    validator: (val: number) =>\n      val >= 0 && val === Number.parseInt(`${val}`, 10),\n  },\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent: {\n    type: Boolean,\n    default: true,\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 alignment for the inner input text\n   */\n  align: {\n    type: definePropType<'left' | 'right' | 'center'>(String),\n    default: 'center',\n  },\n  /**\n   * @description whether to disable scientific notation input (e.g. 'e', 'E')\n   */\n  disabledScientific: Boolean,\n} as const)\nexport type InputNumberProps = ExtractPropTypes<typeof inputNumberProps>\nexport type InputNumberPropsPublic = __ExtractPublicPropTypes<\n  typeof inputNumberProps\n>\n\nexport const inputNumberEmits = {\n  [CHANGE_EVENT]: (cur: number | undefined, prev: number | undefined) =>\n    prev !== cur,\n  blur: (e: FocusEvent) => e instanceof FocusEvent,\n  focus: (e: FocusEvent) => e instanceof FocusEvent,\n  [INPUT_EVENT]: (val: number | null | undefined) =>\n    isNumber(val) || isNil(val),\n  [UPDATE_MODEL_EVENT]: (val: number | undefined) =>\n    isNumber(val) || isNil(val),\n}\nexport type InputNumberEmits = typeof inputNumberEmits\n\nexport type InputNumberInstance = InstanceType<typeof InputNumber> & unknown\n"],"names":[],"mappings":";;;;;;;AAgBO,MAAM,mBAAmB,UAAW,CAAA;AAAA,EAIzC,EAAI,EAAA;AAAA,IACF,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,CAAA;AAAA,GACX;AAAA,EAIA,YAAc,EAAA,OAAA;AAAA,EAId,GAAK,EAAA;AAAA,IACH,IAAM,EAAA,MAAA;AAAA,IACN,SAAS,MAAO,CAAA,gBAAA;AAAA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