@contentful/field-editor-number 1.3.36 → 1.4.1

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.
@@ -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,
@@ -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.36",
3
+ "version": "1.4.1",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@contentful/f36-components": "^4.70.0",
39
39
  "@contentful/f36-tokens": "^4.0.5",
40
- "@contentful/field-editor-shared": "^2.4.1",
40
+ "@contentful/field-editor-shared": "^2.4.2",
41
41
  "emotion": "^10.0.17"
42
42
  },
43
43
  "devDependencies": {
@@ -52,5 +52,5 @@
52
52
  "publishConfig": {
53
53
  "registry": "https://npm.pkg.github.com/"
54
54
  },
55
- "gitHead": "1d0dc6dc10cf4ad43aa48b04fa67d29ab7edaee8"
55
+ "gitHead": "6bee4a59a3c19a95d2cadde3ef0c78112788626e"
56
56
  }