@hi-ui/input 4.0.0-beta.17 → 4.0.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,8 @@ var domUtils = require('@hi-ui/dom-utils');
23
23
 
24
24
  var index = require('./utils/index.js');
25
25
 
26
+ var EXTRA_TYPE = ['text', 'id', 'tel', 'card', 'amount', 'email'];
27
+
26
28
  var useInput = function useInput(_ref) {
27
29
  var name = _ref.name,
28
30
  _ref$autoFocus = _ref.autoFocus,
@@ -110,8 +112,10 @@ var useInput = function useInput(_ref) {
110
112
  };
111
113
  }, [disabled, readOnly, autoFocus, placeholder, maxLength, name, focused]);
112
114
  var getInputProps = React.useCallback(function () {
115
+ var nativeType = EXTRA_TYPE.includes(type) ? undefined : type;
113
116
  return Object.assign(Object.assign({}, nativeInputProps), {
114
117
  value: index.format(value, type),
118
+ type: nativeType,
115
119
  onChange: handleChange,
116
120
  onFocus: handleFocus,
117
121
  onBlur: handleBlur
@@ -12,6 +12,7 @@ import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
12
12
  import { useLatestCallback } from '@hi-ui/use-latest';
13
13
  import { setAttrStatus } from '@hi-ui/dom-utils';
14
14
  import { pure, format, formatAmount } from './utils/index.js';
15
+ var EXTRA_TYPE = ['text', 'id', 'tel', 'card', 'amount', 'email'];
15
16
 
16
17
  var useInput = function useInput(_ref) {
17
18
  var name = _ref.name,
@@ -100,8 +101,10 @@ var useInput = function useInput(_ref) {
100
101
  };
101
102
  }, [disabled, readOnly, autoFocus, placeholder, maxLength, name, focused]);
102
103
  var getInputProps = useCallback(function () {
104
+ var nativeType = EXTRA_TYPE.includes(type) ? undefined : type;
103
105
  return Object.assign(Object.assign({}, nativeInputProps), {
104
106
  value: format(value, type),
107
+ type: nativeType,
105
108
  onChange: handleChange,
106
109
  onFocus: handleFocus,
107
110
  onBlur: handleBlur
@@ -5,6 +5,7 @@ export declare const useInput: ({ name, autoFocus, disabled, readOnly, maxLength
5
5
  tryChangeValue: (stateOrFunction: React.SetStateAction<string>, ...args: any[]) => void;
6
6
  getInputProps: () => {
7
7
  value: string;
8
+ type: string | undefined;
8
9
  onChange: (evt: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>, trim?: any) => void;
9
10
  onFocus: (evt: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
10
11
  onBlur: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/input",
3
- "version": "4.0.0-beta.17",
3
+ "version": "4.0.0-beta.18",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HIUI <mi-hiui@xiaomi.com>",
@@ -62,5 +62,5 @@
62
62
  "react": "^17.0.1",
63
63
  "react-dom": "^17.0.1"
64
64
  },
65
- "gitHead": "a2d7267f383300bb5b96f8c156f54da4924b79dc"
65
+ "gitHead": "3dc9f628767f463b67ba9a7911cc57de84182b85"
66
66
  }