@synerise/ds-input-number 1.2.1 → 1.2.3
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/CHANGELOG.md +373 -1236
- package/README.md +22 -22
- package/dist/InputNumber.d.ts +1 -1
- package/dist/InputNumber.js +3 -3
- package/dist/InputNumber.styles.d.ts +2 -2
- package/dist/InputNumber.styles.js +1 -1
- package/dist/InputNumber.types.d.ts +2 -2
- package/dist/constants/inputNumber.constants.d.ts +1 -1
- package/dist/utils/inputNumber.utils.d.ts +2 -2
- package/dist/utils/inputNumber.utils.js +6 -2
- package/package.json +5 -5
package/README.md
CHANGED
@@ -13,29 +13,29 @@ Input-Number UI Component
|
|
13
13
|
|
14
14
|
### Props
|
15
15
|
|
16
|
-
| Property | Description
|
17
|
-
| ---------------- |
|
18
|
-
| autoFocus | Get focus when component mounted
|
19
|
-
| decimalSeparator | Decimal separator
|
20
|
-
| defaultValue | Initial value
|
21
|
-
| description | Input description
|
22
|
-
| disabled | Disable the input
|
23
|
-
| errorText | Error message, if provided input will be set in error state
|
24
|
-
| formatter | Specifies the format of the value presented
|
25
|
-
| label | Input label
|
26
|
-
| max | Max value
|
27
|
-
| min | Min value
|
16
|
+
| Property | Description | Type | Default |
|
17
|
+
| ---------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | --------- |
|
18
|
+
| autoFocus | Get focus when component mounted | boolean | `false` |
|
19
|
+
| decimalSeparator | Decimal separator | string | - |
|
20
|
+
| defaultValue | Initial value | number |
|
21
|
+
| description | Input description | string | - |
|
22
|
+
| disabled | Disable the input | boolean | `false` |
|
23
|
+
| errorText | Error message, if provided input will be set in error state | string | - |
|
24
|
+
| formatter | Specifies the format of the value presented | (value: number / string) => string | - |
|
25
|
+
| label | Input label | string | - |
|
26
|
+
| max | Max value | number | Infinity |
|
27
|
+
| min | Min value | number | -Infinity |
|
28
28
|
| onChange | The callback triggered when the value is changed. The return value is either a number or empty string '' if NaN | (value: number / string) => void |
|
29
|
-
| onPressEnter | The callback function that is triggered when Enter key is pressed.
|
30
|
-
| parser | Specifies the value extracted from formatter
|
31
|
-
| precision | Precision of input value
|
32
|
-
| size | Height of input box
|
33
|
-
| step | The number to which the current value is increased or decreased. It can be an integer or decimal.
|
34
|
-
| value | Current value
|
35
|
-
| prefixel | String or ReactNode to set prefix
|
36
|
-
| suffixel | String or ReactNode to set suffix
|
37
|
-
| tooltip | Tooltip content
|
38
|
-
| tooltipConfig | Config of tooltip
|
29
|
+
| onPressEnter | The callback function that is triggered when Enter key is pressed. | (e:Event) => void |
|
30
|
+
| parser | Specifies the value extracted from formatter | (val: number / string) => string | - |
|
31
|
+
| precision | Precision of input value | number | - |
|
32
|
+
| size | Height of input box | string | - |
|
33
|
+
| step | The number to which the current value is increased or decreased. It can be an integer or decimal. | number / string | 1 |
|
34
|
+
| value | Current value | number | - |
|
35
|
+
| prefixel | String or ReactNode to set prefix | string / ReactNode | - |
|
36
|
+
| suffixel | String or ReactNode to set suffix | string / ReactNode | - |
|
37
|
+
| tooltip | Tooltip content | ReactNode | - |
|
38
|
+
| tooltipConfig | Config of tooltip | [TooltipProps](https://design.synerise.com/docs/components/tooltip#api) | - |
|
39
39
|
|
40
40
|
### Methods
|
41
41
|
|
package/dist/InputNumber.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import '@synerise/ds-core/dist/js/style';
|
3
|
+
import { type InputNumberProps } from './InputNumber.types';
|
3
4
|
import './style/index.less';
|
4
|
-
import { InputNumberProps } from './InputNumber.types';
|
5
5
|
declare const InputNumber: ({ label, description, errorText, raw, error, prefixel, suffixel, style, tooltip, tooltipConfig, value, defaultValue, valueFormatOptions, onChange, ...antdProps }: InputNumberProps) => React.JSX.Element;
|
6
6
|
export default InputNumber;
|
package/dist/InputNumber.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
var _excluded = ["label", "description", "errorText", "raw", "error", "prefixel", "suffixel", "style", "tooltip", "tooltipConfig", "value", "defaultValue", "valueFormatOptions", "onChange"];
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
4
|
-
import React, {
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
5
5
|
import { v4 as uuid } from 'uuid';
|
6
6
|
import '@synerise/ds-core/dist/js/style';
|
7
|
-
import FormField from '@synerise/ds-form-field';
|
8
7
|
import { useDataFormat } from '@synerise/ds-data-format';
|
9
|
-
import
|
8
|
+
import FormField from '@synerise/ds-form-field';
|
10
9
|
import * as S from './InputNumber.styles';
|
10
|
+
import "./style/index.css";
|
11
11
|
import { formatNumber, parseFormattedNumber } from './utils/inputNumber.utils';
|
12
12
|
var InputNumber = function InputNumber(_ref) {
|
13
13
|
var label = _ref.label,
|
@@ -1,6 +1,6 @@
|
|
1
|
+
import { type InputNumberProps } from 'antd/lib/input-number';
|
1
2
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
import { ThemeProps } from '@synerise/ds-core';
|
3
|
+
import { type ThemeProps } from '@synerise/ds-core';
|
4
4
|
export declare const InputNumberContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
5
5
|
export declare const AntdInputNumber: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<InputNumberProps<number> & React.RefAttributes<HTMLInputElement>>, any, {
|
6
6
|
error: boolean;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
2
|
+
import BaseAntInputNumber from 'antd/lib/input-number';
|
2
3
|
import React, { forwardRef } from 'react';
|
3
4
|
import styled from 'styled-components';
|
4
|
-
import BaseAntInputNumber from 'antd/lib/input-number';
|
5
5
|
export var InputNumberContainer = styled.div.withConfig({
|
6
6
|
displayName: "InputNumberstyles__InputNumberContainer",
|
7
7
|
componentId: "sc-abrul0-0"
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import type { ReactNode } from 'react';
|
2
1
|
import type { InputNumberProps as AntdInputNumberProps } from 'antd/lib/input-number';
|
3
|
-
import type {
|
2
|
+
import type { ReactNode } from 'react';
|
4
3
|
import type { NumberToFormatOptions } from '@synerise/ds-data-format';
|
4
|
+
import type { FormFieldCommonProps } from '@synerise/ds-form-field';
|
5
5
|
export type InputNumberProps = AntdInputNumberProps<number> & {
|
6
6
|
defaultValue?: number | null;
|
7
7
|
error?: boolean;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ReactText } from 'react';
|
2
|
-
import {
|
1
|
+
import { type ReactText } from 'react';
|
2
|
+
import { type Delimiter, type NumberToFormatOptions } from '@synerise/ds-data-format';
|
3
3
|
export declare const formatNumber: (value: string | number | undefined | null, formatValue: (value: number, options: NumberToFormatOptions) => string, notationThousandDelimiter: Delimiter, notationDecimalDelimiter: Delimiter, valueFormatOptions?: NumberToFormatOptions) => string;
|
4
4
|
export declare const parseFormattedNumber: (value: string | undefined, formatValue: (value: number, options: NumberToFormatOptions) => string, notationThousandDelimiter: Delimiter, notationDecimalDelimiter: Delimiter) => ReactText;
|
@@ -6,8 +6,12 @@ import { MAXIMUM_FRACTION_DIGITS, MAXIMUM_NUMBER_DIGITS, NUMBER_DELIMITER } from
|
|
6
6
|
// output: formatted number string with decimal char
|
7
7
|
export var formatNumber = function formatNumber(value, formatValue, notationThousandDelimiter, notationDecimalDelimiter, valueFormatOptions) {
|
8
8
|
var _value$match, _value$match2;
|
9
|
-
if (value === undefined || value === '' || value === null)
|
10
|
-
|
9
|
+
if (value === undefined || value === '' || value === null) {
|
10
|
+
return '';
|
11
|
+
}
|
12
|
+
if (value === '-') {
|
13
|
+
return '-';
|
14
|
+
}
|
11
15
|
var formatOptions = _extends({
|
12
16
|
maximumFractionDigits: MAXIMUM_FRACTION_DIGITS
|
13
17
|
}, valueFormatOptions);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@synerise/ds-input-number",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.3",
|
4
4
|
"description": "Input-Number UI Component for the Synerise Design System",
|
5
5
|
"license": "ISC",
|
6
6
|
"repository": "Synerise/synerise-design",
|
@@ -34,9 +34,9 @@
|
|
34
34
|
],
|
35
35
|
"types": "dist/index.d.ts",
|
36
36
|
"dependencies": {
|
37
|
-
"@synerise/ds-data-format": "^1.0.
|
38
|
-
"@synerise/ds-form-field": "^1.1.
|
39
|
-
"@synerise/ds-utils": "^1.3.
|
37
|
+
"@synerise/ds-data-format": "^1.0.1",
|
38
|
+
"@synerise/ds-form-field": "^1.1.8",
|
39
|
+
"@synerise/ds-utils": "^1.3.1",
|
40
40
|
"uuid": "^8.3.2"
|
41
41
|
},
|
42
42
|
"peerDependencies": {
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"react": ">=16.9.0 <= 18.3.1",
|
46
46
|
"styled-components": "^5.3.3"
|
47
47
|
},
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "4512641033ba3581a3df208143c547fcfed45895"
|
49
49
|
}
|