@contentful/field-editor-number 1.3.36 → 1.4.0
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/dist/cjs/NumberEditor.js
CHANGED
|
@@ -62,7 +62,7 @@ var StepChangeType = /*#__PURE__*/ function(StepChangeType) {
|
|
|
62
62
|
return StepChangeType;
|
|
63
63
|
}(StepChangeType || {});
|
|
64
64
|
const NUMBER_STEP = 1;
|
|
65
|
-
function InnerNumberEditor({ disabled, errors, field, setValue, value: sdkValue }) {
|
|
65
|
+
function InnerNumberEditor({ disabled, errors, field, setValue, value: sdkValue, id }) {
|
|
66
66
|
const [inputValue, setInputValue] = _react.useState((0, _utils.valueToString)(sdkValue));
|
|
67
67
|
const range = (0, _utils.getRangeFromField)(field);
|
|
68
68
|
const inputRef = _react.useRef(null);
|
|
@@ -123,6 +123,7 @@ function InnerNumberEditor({ disabled, errors, field, setValue, value: sdkValue
|
|
|
123
123
|
className: _NumberEditorstyles.styles.container
|
|
124
124
|
}, _react.createElement(_f36components.TextInput, {
|
|
125
125
|
type: "text",
|
|
126
|
+
id: id,
|
|
126
127
|
testId: "number-editor-input",
|
|
127
128
|
className: _NumberEditorstyles.styles.input,
|
|
128
129
|
min: range.min,
|
|
@@ -159,11 +160,12 @@ function InnerNumberEditor({ disabled, errors, field, setValue, value: sdkValue
|
|
|
159
160
|
}))));
|
|
160
161
|
}
|
|
161
162
|
function NumberEditor(props) {
|
|
162
|
-
const { field } = props;
|
|
163
|
+
const { field, id } = props;
|
|
163
164
|
return _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
164
165
|
field: field,
|
|
165
166
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
166
167
|
}, ({ value, errors, disabled, setValue })=>_react.createElement(InnerNumberEditor, {
|
|
168
|
+
id: id,
|
|
167
169
|
disabled: disabled,
|
|
168
170
|
errors: errors,
|
|
169
171
|
field: field,
|
package/dist/esm/NumberEditor.js
CHANGED
|
@@ -11,7 +11,7 @@ var StepChangeType = /*#__PURE__*/ function(StepChangeType) {
|
|
|
11
11
|
return StepChangeType;
|
|
12
12
|
}(StepChangeType || {});
|
|
13
13
|
const NUMBER_STEP = 1;
|
|
14
|
-
function InnerNumberEditor({ disabled, errors, field, setValue, value: sdkValue }) {
|
|
14
|
+
function InnerNumberEditor({ disabled, errors, field, setValue, value: sdkValue, id }) {
|
|
15
15
|
const [inputValue, setInputValue] = React.useState(valueToString(sdkValue));
|
|
16
16
|
const range = getRangeFromField(field);
|
|
17
17
|
const inputRef = React.useRef(null);
|
|
@@ -72,6 +72,7 @@ function InnerNumberEditor({ disabled, errors, field, setValue, value: sdkValue
|
|
|
72
72
|
className: styles.container
|
|
73
73
|
}, React.createElement(TextInput, {
|
|
74
74
|
type: "text",
|
|
75
|
+
id: id,
|
|
75
76
|
testId: "number-editor-input",
|
|
76
77
|
className: styles.input,
|
|
77
78
|
min: range.min,
|
|
@@ -108,11 +109,12 @@ function InnerNumberEditor({ disabled, errors, field, setValue, value: sdkValue
|
|
|
108
109
|
}))));
|
|
109
110
|
}
|
|
110
111
|
export function NumberEditor(props) {
|
|
111
|
-
const { field } = props;
|
|
112
|
+
const { field, id } = props;
|
|
112
113
|
return React.createElement(FieldConnector, {
|
|
113
114
|
field: field,
|
|
114
115
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
115
116
|
}, ({ value, errors, disabled, setValue })=>React.createElement(InnerNumberEditor, {
|
|
117
|
+
id: id,
|
|
116
118
|
disabled: disabled,
|
|
117
119
|
errors: errors,
|
|
118
120
|
field: field,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { FieldAPI } from '@contentful/field-editor-shared';
|
|
2
|
+
import { type FieldAPI } from '@contentful/field-editor-shared';
|
|
3
3
|
export interface NumberEditorProps {
|
|
4
4
|
/**
|
|
5
5
|
* is the field disabled initially
|
|
@@ -9,6 +9,10 @@ export interface NumberEditorProps {
|
|
|
9
9
|
* sdk.field
|
|
10
10
|
*/
|
|
11
11
|
field: FieldAPI;
|
|
12
|
+
/**
|
|
13
|
+
* id used for associating the input field with its label
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
12
16
|
}
|
|
13
17
|
export declare function NumberEditor(props: NumberEditorProps): React.JSX.Element;
|
|
14
18
|
export declare namespace NumberEditor {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-number",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"registry": "https://npm.pkg.github.com/"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "7ec565308c8d4da384b8fec6f5d840bdf6d4927d"
|
|
56
56
|
}
|