diginet-core-ui 1.3.74 → 1.3.75-beta.2
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.
- package/components/button/icon.js +21 -21
- package/components/button/index.js +13 -13
- package/components/form-control/attachment/index.js +24 -22
- package/components/form-control/checkbox/index.js +41 -37
- package/components/form-control/date-range-picker/index.js +325 -312
- package/components/form-control/dropdown/index.js +35 -35
- package/components/form-control/label/index.js +6 -6
- package/components/form-control/number-input/index2.js +152 -147
- package/components/popover/index.js +38 -27
- package/components/progress/circular.js +201 -145
- package/components/tab/tab-container.js +21 -19
- package/components/tab/tab-header.js +37 -35
- package/components/tab/tab-panel.js +15 -13
- package/components/tab/tab.js +16 -14
- package/components/tooltip/index.js +61 -58
- package/components/tree-view/index.js +38 -38
- package/components/typography/index.js +12 -12
- package/package.json +61 -31
- package/readme.md +3 -0
- package/styles/general.js +11 -11
- package/theme/set-theme.js +3 -3
|
@@ -1850,14 +1850,14 @@ Dropdown.propTypes = {
|
|
|
1850
1850
|
/** The icon to display if not found the icon follow `iconExpr`. */
|
|
1851
1851
|
iconDefault: PropTypes.string,
|
|
1852
1852
|
|
|
1853
|
-
/** Field name used for icon display.<br/>
|
|
1854
|
-
* Example:<br/>
|
|
1855
|
-
* string: 'icon'<br/>
|
|
1856
|
-
* object: {<br/>
|
|
1857
|
-
* key: 'icon',<br/>
|
|
1858
|
-
* prefix: 'https://imglink.com',<br/>
|
|
1859
|
-
* suffix: '.jpg'<br/>
|
|
1860
|
-
* }
|
|
1853
|
+
/** Field name used for icon display.<br/>
|
|
1854
|
+
* Example:<br/>
|
|
1855
|
+
* string: 'icon'<br/>
|
|
1856
|
+
* object: {<br/>
|
|
1857
|
+
* key: 'icon',<br/>
|
|
1858
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1859
|
+
* suffix: '.jpg'<br/>
|
|
1860
|
+
* }
|
|
1861
1861
|
*/
|
|
1862
1862
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1863
1863
|
key: PropTypes.string,
|
|
@@ -1872,9 +1872,9 @@ Dropdown.propTypes = {
|
|
|
1872
1872
|
/** The displayed value of component. */
|
|
1873
1873
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1874
1874
|
|
|
1875
|
-
/** Field name used for text display in dropdown list.<br/>
|
|
1876
|
-
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1877
|
-
* Note: don't use 'id - name', return undefined
|
|
1875
|
+
/** Field name used for text display in dropdown list.<br/>
|
|
1876
|
+
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1877
|
+
* Note: don't use 'id - name', return undefined
|
|
1878
1878
|
*/
|
|
1879
1879
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1880
1880
|
|
|
@@ -1884,10 +1884,10 @@ Dropdown.propTypes = {
|
|
|
1884
1884
|
/** The field name used for the returned result. */
|
|
1885
1885
|
valueExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
1886
1886
|
|
|
1887
|
-
/**
|
|
1888
|
-
* Duration wait enter search content on search.<br/>
|
|
1889
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1890
|
-
* If `true`, used default delayOnInput.
|
|
1887
|
+
/**
|
|
1888
|
+
* Duration wait enter search content on search.<br/>
|
|
1889
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1890
|
+
* If `true`, used default delayOnInput.
|
|
1891
1891
|
*/
|
|
1892
1892
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1893
1893
|
|
|
@@ -1954,19 +1954,19 @@ Dropdown.propTypes = {
|
|
|
1954
1954
|
/** The array of elements that appear in the dropdown list. */
|
|
1955
1955
|
dataSource: PropTypes.array,
|
|
1956
1956
|
|
|
1957
|
-
/** Function displays items by custom.<br/>
|
|
1958
|
-
* renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
|
|
1959
|
-
* --> such as: displayExpr={'name - role'}
|
|
1957
|
+
/** Function displays items by custom.<br/>
|
|
1958
|
+
* renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
|
|
1959
|
+
* --> such as: displayExpr={'name - role'}
|
|
1960
1960
|
*/
|
|
1961
1961
|
renderItem: PropTypes.func,
|
|
1962
1962
|
|
|
1963
|
-
/** Function or field name used for display selected items, example:<br/>
|
|
1964
|
-
* renderSelectedItem={(data, index) => index + ' - ' + data.name}<br/>
|
|
1963
|
+
/** Function or field name used for display selected items, example:<br/>
|
|
1964
|
+
* renderSelectedItem={(data, index) => index + ' - ' + data.name}<br/>
|
|
1965
1965
|
*/
|
|
1966
1966
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1967
1967
|
|
|
1968
|
-
/** Callback fired when the input value changes.<br/>
|
|
1969
|
-
* if undefined: the filter function will run (default)
|
|
1968
|
+
/** Callback fired when the input value changes.<br/>
|
|
1969
|
+
* if undefined: the filter function will run (default)
|
|
1970
1970
|
*/
|
|
1971
1971
|
onInput: PropTypes.func,
|
|
1972
1972
|
|
|
@@ -1997,19 +1997,19 @@ Dropdown.propTypes = {
|
|
|
1997
1997
|
/** If `true`, show multi-line selected item(s). */
|
|
1998
1998
|
multilineSelectedItem: PropTypes.bool,
|
|
1999
1999
|
|
|
2000
|
-
/**
|
|
2001
|
-
* ref methods
|
|
2002
|
-
*
|
|
2003
|
-
* how to get component element? ref.current
|
|
2004
|
-
*
|
|
2005
|
-
* how to call method? ref.current.instance.{method}
|
|
2006
|
-
*
|
|
2007
|
-
* * showDropdown(): Show dropdown
|
|
2008
|
-
* * closeDropdown(): Close dropdown
|
|
2009
|
-
* * onClear(): Clear selected value
|
|
2010
|
-
* * setPreviousValue(): Set value to previous value
|
|
2011
|
-
* * setValue(value): Set value of dropdown
|
|
2012
|
-
* * @param {value} - string || number || array
|
|
2000
|
+
/**
|
|
2001
|
+
* ref methods
|
|
2002
|
+
*
|
|
2003
|
+
* how to get component element? ref.current
|
|
2004
|
+
*
|
|
2005
|
+
* how to call method? ref.current.instance.{method}
|
|
2006
|
+
*
|
|
2007
|
+
* * showDropdown(): Show dropdown
|
|
2008
|
+
* * closeDropdown(): Close dropdown
|
|
2009
|
+
* * onClear(): Clear selected value
|
|
2010
|
+
* * setPreviousValue(): Set value to previous value
|
|
2011
|
+
* * setValue(value): Set value of dropdown
|
|
2012
|
+
* * @param {value} - string || number || array
|
|
2013
2013
|
*/
|
|
2014
2014
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
2015
2015
|
current: PropTypes.instanceOf(Element)
|
|
@@ -23,16 +23,16 @@ const {
|
|
|
23
23
|
} = useTheme();
|
|
24
24
|
const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
25
25
|
action = {},
|
|
26
|
+
children,
|
|
27
|
+
className,
|
|
28
|
+
color,
|
|
26
29
|
disabled,
|
|
30
|
+
hoverTooltip,
|
|
31
|
+
id,
|
|
32
|
+
lineClamp,
|
|
27
33
|
readOnly,
|
|
28
34
|
required,
|
|
29
|
-
className,
|
|
30
|
-
children,
|
|
31
35
|
type,
|
|
32
|
-
lineClamp,
|
|
33
|
-
hoverTooltip,
|
|
34
|
-
id,
|
|
35
|
-
color,
|
|
36
36
|
...props
|
|
37
37
|
}, reference) => {
|
|
38
38
|
const ref = useRef(null);
|
|
@@ -6,55 +6,56 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import locale from '../../../locale';
|
|
8
8
|
import { InputBase, Label, HelperText } from '../..';
|
|
9
|
-
import { onValidate } from '../../../utils';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
margin-bottom: 20px;
|
|
16
|
-
`;
|
|
9
|
+
import { classNames, onValidate, refType as ref } from '../../../utils';
|
|
10
|
+
import { displayBlock, positionRelative } from '../../../styles/general';
|
|
11
|
+
import theme from '../../../theme/settings';
|
|
12
|
+
const {
|
|
13
|
+
spacing
|
|
14
|
+
} = theme;
|
|
17
15
|
const regexValidNumber = /[^0-9.,-]/g;
|
|
18
16
|
const regexNumber = /[^0-9]/g;
|
|
19
|
-
const regexThousandNumber = /(\d)(?=(\d{3})+\b)/g;
|
|
17
|
+
const regexThousandNumber = /(\d)(?=(\d{3})+\b)/g; // Clamp number between two values with the following line:
|
|
18
|
+
|
|
19
|
+
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
20
|
+
|
|
20
21
|
const NumberInput = /*#__PURE__*/forwardRef(({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
nonStyle,
|
|
22
|
+
autoFocus,
|
|
23
|
+
autoWidth,
|
|
24
|
+
className,
|
|
25
25
|
decimalDigit,
|
|
26
26
|
decimalSymbol,
|
|
27
|
-
thousandSeparator: thousandSymbol,
|
|
28
|
-
label,
|
|
29
27
|
defaultValue,
|
|
30
|
-
|
|
31
|
-
min,
|
|
32
|
-
max,
|
|
33
|
-
step,
|
|
34
|
-
placeholder,
|
|
35
|
-
startIcon,
|
|
36
|
-
endIcon,
|
|
37
|
-
autoFocus,
|
|
28
|
+
delayOnChange,
|
|
38
29
|
disabled,
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
disabledNegative,
|
|
31
|
+
endIcon,
|
|
32
|
+
error,
|
|
33
|
+
fixedDecimalDigit,
|
|
34
|
+
helperTextProps,
|
|
41
35
|
inputProps,
|
|
36
|
+
inputRef,
|
|
42
37
|
inputStyle,
|
|
43
|
-
|
|
38
|
+
label,
|
|
39
|
+
labelProps,
|
|
40
|
+
max,
|
|
41
|
+
maxDigit,
|
|
42
|
+
min,
|
|
43
|
+
nonStyle,
|
|
44
|
+
onBlur,
|
|
44
45
|
onChange,
|
|
45
46
|
onFocus,
|
|
46
47
|
onInput,
|
|
47
|
-
onBlur,
|
|
48
48
|
onKeyDown,
|
|
49
49
|
onKeyUp,
|
|
50
|
+
placeholder,
|
|
51
|
+
readOnly,
|
|
52
|
+
required,
|
|
53
|
+
startIcon,
|
|
54
|
+
step,
|
|
55
|
+
thousandSeparator: thousandSymbol,
|
|
50
56
|
validates,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
className,
|
|
54
|
-
maxDigit,
|
|
55
|
-
autoWidth,
|
|
56
|
-
labelProps,
|
|
57
|
-
helperTextProps
|
|
57
|
+
value: valueProps,
|
|
58
|
+
viewType
|
|
58
59
|
}, reference) => {
|
|
59
60
|
inputRef = inputRef || useRef(null);
|
|
60
61
|
const pos = useRef(null);
|
|
@@ -75,15 +76,12 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
75
76
|
thousandSymbol = '';
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
const validateResult = validates && onValidate(value, validates, true);
|
|
79
|
-
|
|
80
|
-
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
81
|
-
|
|
79
|
+
const validateResult = validates && onValidate(value, validates, true);
|
|
82
80
|
if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
|
|
83
81
|
/**
|
|
84
82
|
* Convert number to format money
|
|
85
83
|
* @param vl {number} - value
|
|
86
|
-
* @type {function
|
|
84
|
+
* @type {function}
|
|
87
85
|
* @return {string}
|
|
88
86
|
* @example 1200300.123 => 1,200,300.123
|
|
89
87
|
* @example 1200300,123 => 1.200.300,123
|
|
@@ -109,7 +107,7 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
109
107
|
pos.current = 2;
|
|
110
108
|
}
|
|
111
109
|
|
|
112
|
-
number[0] = (_number2 = number) === null || _number2 === void 0 ? void 0 : _number2[0].replace(regexThousandNumber, '$1' + thousandSymbol); // add thousand symbol to number
|
|
110
|
+
number[0] = (_number2 = number) === null || _number2 === void 0 ? void 0 : _number2[0].replace(regexThousandNumber, '$1' + thousandSymbol); // add a thousand symbol to number
|
|
113
111
|
|
|
114
112
|
if (!decimalDigit) number.length = 1;else if (number[1]) number[1] = (_number$ = number[1]) === null || _number$ === void 0 ? void 0 : _number$.slice(0, decimalDigit || 0);
|
|
115
113
|
number = number.join(decimalSymbol); // keep focus position
|
|
@@ -123,7 +121,7 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
123
121
|
/**
|
|
124
122
|
* Convert money to format number
|
|
125
123
|
* @param vl {string} - value
|
|
126
|
-
* @type {function
|
|
124
|
+
* @type {function}
|
|
127
125
|
* @return {number}
|
|
128
126
|
* @example 1,200,300.123 => 1200300.123
|
|
129
127
|
* @example 1.200.300,123 => 1200300.123
|
|
@@ -163,10 +161,11 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
163
161
|
value = convertMoneyToNumber(value);
|
|
164
162
|
|
|
165
163
|
if (Number(value) < min || Number(value) > max) {
|
|
164
|
+
const target = e.target;
|
|
165
|
+
target.value = clamp(value, min, max);
|
|
166
|
+
|
|
166
167
|
_onInput({ ...e,
|
|
167
|
-
target
|
|
168
|
-
value: clamp(value, min, max)
|
|
169
|
-
}
|
|
168
|
+
target
|
|
170
169
|
});
|
|
171
170
|
}
|
|
172
171
|
}
|
|
@@ -209,22 +208,23 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
209
208
|
|
|
210
209
|
const disabledTypingDecimal = ((_value$split = value.split(decimalSymbol)) === null || _value$split === void 0 ? void 0 : (_value$split$ = _value$split[1]) === null || _value$split$ === void 0 ? void 0 : _value$split$.length) >= decimalDigit && // total number after decimal symbol > {decimalDigit}
|
|
211
210
|
selectionStart === value.length; // the focus is at the end of the string
|
|
212
|
-
|
|
211
|
+
|
|
212
|
+
const target = e.target; // key arrow up
|
|
213
213
|
|
|
214
214
|
if (keyCode === 38) {
|
|
215
|
+
target.value = Number(convertMoneyToNumber(value) || 0) + step;
|
|
216
|
+
|
|
215
217
|
_onInput({ ...e,
|
|
216
|
-
target
|
|
217
|
-
value: Number(convertMoneyToNumber(value) || 0) + step
|
|
218
|
-
}
|
|
218
|
+
target
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
e.preventDefault();
|
|
222
222
|
} // key arrow down
|
|
223
223
|
else if (keyCode === 40) {
|
|
224
|
+
target.value = Number(convertMoneyToNumber(value) || 0) - step;
|
|
225
|
+
|
|
224
226
|
_onInput({ ...e,
|
|
225
|
-
target
|
|
226
|
-
value: Number(convertMoneyToNumber(value) || 0) - step
|
|
227
|
-
}
|
|
227
|
+
target
|
|
228
228
|
});
|
|
229
229
|
|
|
230
230
|
e.preventDefault();
|
|
@@ -261,6 +261,7 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
261
261
|
}, [valueProps]);
|
|
262
262
|
useImperativeHandle(reference, () => {
|
|
263
263
|
const currentRef = ref.current || {};
|
|
264
|
+
currentRef.element = ref.current;
|
|
264
265
|
const _instance = {}; // methods
|
|
265
266
|
|
|
266
267
|
_instance.__proto__ = {}; // hidden methods
|
|
@@ -271,7 +272,7 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
271
272
|
return jsx("div", {
|
|
272
273
|
ref: ref,
|
|
273
274
|
css: NumberInputRoot,
|
|
274
|
-
className:
|
|
275
|
+
className: classNames('DGN-UI-NumberInput', className)
|
|
275
276
|
}, !!label && jsx(Label, { ...labelProps,
|
|
276
277
|
required: required,
|
|
277
278
|
disabled: disabled
|
|
@@ -297,12 +298,12 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
297
298
|
delayOnChange: delayOnChange,
|
|
298
299
|
onKeyDown: _onKeyDown,
|
|
299
300
|
onChange: e => {
|
|
301
|
+
const target = e.target;
|
|
302
|
+
target.value = globalRef.current.valueString;
|
|
303
|
+
target.valueString = globalRef.current.returnValue;
|
|
300
304
|
onChange({ ...e,
|
|
301
305
|
value: globalRef.current.value,
|
|
302
|
-
target
|
|
303
|
-
value: globalRef.current.valueString,
|
|
304
|
-
valueString: globalRef.current.returnValue
|
|
305
|
-
}
|
|
306
|
+
target
|
|
306
307
|
});
|
|
307
308
|
},
|
|
308
309
|
onBlur: e => _onBlur(e)
|
|
@@ -312,142 +313,146 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
312
313
|
disabled: disabled
|
|
313
314
|
}, validateResult));
|
|
314
315
|
});
|
|
316
|
+
const NumberInputRoot = css`
|
|
317
|
+
${displayBlock};
|
|
318
|
+
${positionRelative};
|
|
319
|
+
margin-bottom: ${spacing([5])};
|
|
320
|
+
`;
|
|
315
321
|
NumberInput.defaultProps = {
|
|
316
|
-
viewType: 'underlined',
|
|
317
|
-
label: '',
|
|
318
|
-
// placeholder: getGlobal('inputPlaceholder'),
|
|
319
|
-
error: '',
|
|
320
|
-
startIcon: '',
|
|
321
|
-
endIcon: '',
|
|
322
|
-
decimalSymbol: locale.get() === 'vi' ? ',' : '.',
|
|
323
|
-
required: false,
|
|
324
|
-
nonStyle: false,
|
|
325
322
|
autoFocus: false,
|
|
323
|
+
className: '',
|
|
324
|
+
decimalDigit: 0,
|
|
325
|
+
decimalSymbol: locale.get() === 'vi' ? ',' : '.',
|
|
326
326
|
disabled: false,
|
|
327
|
-
readOnly: false,
|
|
328
327
|
disabledNegative: false,
|
|
328
|
+
endIcon: '',
|
|
329
|
+
error: '',
|
|
329
330
|
fixedDecimalDigit: false,
|
|
331
|
+
label: '',
|
|
332
|
+
max: Infinity,
|
|
333
|
+
min: -Infinity,
|
|
334
|
+
nonStyle: false,
|
|
335
|
+
readOnly: false,
|
|
336
|
+
required: false,
|
|
337
|
+
startIcon: '',
|
|
330
338
|
step: 1,
|
|
331
|
-
decimalDigit: 0,
|
|
332
339
|
thousandSeparator: false,
|
|
333
|
-
|
|
334
|
-
max: Infinity,
|
|
335
|
-
className: ''
|
|
340
|
+
viewType: 'underlined'
|
|
336
341
|
};
|
|
337
342
|
NumberInput.propTypes = {
|
|
338
|
-
/** the
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
/** separator symbol */
|
|
342
|
-
decimalSymbol: PropTypes.oneOf([',', '.']),
|
|
343
|
+
/** If `true`, the `input` element is focused during the first mount. */
|
|
344
|
+
autoFocus: PropTypes.bool,
|
|
343
345
|
|
|
344
|
-
/**
|
|
345
|
-
|
|
346
|
+
/** If `true`, width of input will resize according to content. */
|
|
347
|
+
autoWidth: PropTypes.bool,
|
|
346
348
|
|
|
347
|
-
/**
|
|
348
|
-
|
|
349
|
+
/** Class for component. */
|
|
350
|
+
className: PropTypes.string,
|
|
349
351
|
|
|
350
|
-
/**
|
|
352
|
+
/** Number of decimal places allowed. */
|
|
351
353
|
decimalDigit: PropTypes.number,
|
|
352
354
|
|
|
353
|
-
/**
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
/** max of value was allowed */
|
|
357
|
-
max: PropTypes.number,
|
|
355
|
+
/** Separator symbol. */
|
|
356
|
+
decimalSymbol: PropTypes.oneOf([',', '.']),
|
|
358
357
|
|
|
359
|
-
/**
|
|
360
|
-
|
|
358
|
+
/** Default value of the component. */
|
|
359
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
361
360
|
|
|
362
|
-
/**
|
|
363
|
-
|
|
361
|
+
/** The number of milliseconds to wait before call onChange. */
|
|
362
|
+
delayOnChange: PropTypes.number,
|
|
364
363
|
|
|
365
|
-
/**
|
|
366
|
-
|
|
364
|
+
/** If `true`, the component is disabled. */
|
|
365
|
+
disabled: PropTypes.bool,
|
|
367
366
|
|
|
368
|
-
/**
|
|
369
|
-
|
|
367
|
+
/** If `true`, negative numbers are not allowed. */
|
|
368
|
+
disabledNegative: PropTypes.bool,
|
|
370
369
|
|
|
371
|
-
/** icon
|
|
372
|
-
|
|
370
|
+
/** [Icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic--basic) or element placed to the right of input. */
|
|
371
|
+
endIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
373
372
|
|
|
374
|
-
/**
|
|
375
|
-
|
|
373
|
+
/** Error displayed below input. */
|
|
374
|
+
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
376
375
|
|
|
377
|
-
/**
|
|
378
|
-
|
|
376
|
+
/** fixedDecimalDigit. */
|
|
377
|
+
fixedDecimalDigit: PropTypes.bool,
|
|
379
378
|
|
|
380
|
-
/**
|
|
381
|
-
|
|
379
|
+
/** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
|
|
380
|
+
helperTextProps: PropTypes.object,
|
|
382
381
|
|
|
383
|
-
/**
|
|
384
|
-
|
|
382
|
+
/** [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes) applied to the input element. */
|
|
383
|
+
inputProps: PropTypes.object,
|
|
385
384
|
|
|
386
|
-
/**
|
|
387
|
-
|
|
385
|
+
/** Pass a ref to the input element. */
|
|
386
|
+
inputRef: ref,
|
|
388
387
|
|
|
389
|
-
/**
|
|
390
|
-
|
|
388
|
+
/** Style inline of input element. */
|
|
389
|
+
inputStyle: PropTypes.object,
|
|
391
390
|
|
|
392
|
-
/**
|
|
393
|
-
|
|
391
|
+
/** The label of the component. */
|
|
392
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
394
393
|
|
|
395
|
-
/**
|
|
396
|
-
|
|
394
|
+
/** Props applied to the [Label](https://core.diginet.com.vn/ui/?path=/docs/form-control-text-label) element. */
|
|
395
|
+
labelProps: PropTypes.object,
|
|
397
396
|
|
|
398
|
-
/**
|
|
399
|
-
|
|
397
|
+
/** Maximum possible value. */
|
|
398
|
+
max: PropTypes.number,
|
|
400
399
|
|
|
401
|
-
/**
|
|
402
|
-
|
|
403
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
404
|
-
* * array: the validation rule list, insist object/string
|
|
405
|
-
*/
|
|
406
|
-
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
400
|
+
/** Maximum value character (not including separator). */
|
|
401
|
+
maxDigit: PropTypes.number,
|
|
407
402
|
|
|
408
|
-
/**
|
|
409
|
-
|
|
403
|
+
/** Minimal possible value. */
|
|
404
|
+
min: PropTypes.number,
|
|
410
405
|
|
|
411
|
-
/**
|
|
412
|
-
|
|
406
|
+
/** If `true`, component will have no style */
|
|
407
|
+
nonStyle: PropTypes.bool,
|
|
413
408
|
|
|
414
|
-
/**
|
|
415
|
-
|
|
409
|
+
/** Callback fired when the input is blurred. */
|
|
410
|
+
onBlur: PropTypes.func,
|
|
416
411
|
|
|
417
|
-
/**
|
|
412
|
+
/** Callback fired when the value is changed. */
|
|
418
413
|
onChange: PropTypes.func,
|
|
419
414
|
|
|
420
|
-
/**
|
|
415
|
+
/** Callback fired when the input is focused. */
|
|
421
416
|
onFocus: PropTypes.func,
|
|
422
417
|
|
|
423
|
-
/**
|
|
424
|
-
|
|
418
|
+
/** Callback fired when input. */
|
|
419
|
+
onInput: PropTypes.func,
|
|
425
420
|
|
|
426
|
-
/**
|
|
427
|
-
|
|
421
|
+
/** Callback fired when pressing a key. */
|
|
422
|
+
onKeyDown: PropTypes.func,
|
|
428
423
|
|
|
429
|
-
/**
|
|
430
|
-
|
|
424
|
+
/** Callback fired when releases a key. */
|
|
425
|
+
onKeyUp: PropTypes.func,
|
|
431
426
|
|
|
432
|
-
/**
|
|
433
|
-
|
|
427
|
+
/** The short hint displayed in the input before the user enters a value. */
|
|
428
|
+
placeholder: PropTypes.string,
|
|
434
429
|
|
|
435
|
-
/**
|
|
436
|
-
|
|
430
|
+
/** If `true`, the component is readOnly. */
|
|
431
|
+
readOnly: PropTypes.bool,
|
|
437
432
|
|
|
438
|
-
/**
|
|
439
|
-
|
|
433
|
+
/** If `true`, the input element is required. */
|
|
434
|
+
required: PropTypes.bool,
|
|
440
435
|
|
|
441
|
-
/**
|
|
442
|
-
|
|
436
|
+
/** [Icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic--basic) or element placed to the left of input. */
|
|
437
|
+
startIcon: PropTypes.any,
|
|
443
438
|
|
|
444
|
-
/**
|
|
445
|
-
|
|
439
|
+
/** Specify how much the values should increase/decrease upon clicking on up/down button. */
|
|
440
|
+
step: PropTypes.number,
|
|
446
441
|
|
|
447
|
-
/**
|
|
448
|
-
|
|
442
|
+
/** Thousand separator character. */
|
|
443
|
+
thousandSeparator: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['.', ','])]),
|
|
444
|
+
|
|
445
|
+
/** Validation value, argument can:<br/>
|
|
446
|
+
* * string: the validation rule. Example required.<br/>
|
|
447
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
448
|
+
* * array: the validation rule list, insist object/string
|
|
449
|
+
*/
|
|
450
|
+
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
451
|
+
|
|
452
|
+
/** The value of the input element, required for a controlled component. */
|
|
453
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
449
454
|
|
|
450
|
-
/**
|
|
451
|
-
|
|
455
|
+
/** The variant to use. */
|
|
456
|
+
viewType: PropTypes.oneOf(['underlined', 'outlined'])
|
|
452
457
|
};
|
|
453
458
|
export default NumberInput;
|