@contentful/field-editor-single-line 1.5.5 → 1.6.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.
@@ -57,7 +57,7 @@ function isSupportedFieldTypes(val) {
57
57
  return val === 'Symbol' || val === 'Text';
58
58
  }
59
59
  function SingleLineEditor(props) {
60
- const { field, isDisabled, isInitiallyDisabled = true, locales, onBlur, onFocus, withCharInformation = true, withCharValidation = true } = props;
60
+ const { field, isDisabled, isInitiallyDisabled = true, locales, onBlur, onFocus, withCharInformation = true, withCharValidation = true, id } = props;
61
61
  if (!isSupportedFieldTypes(field.type)) {
62
62
  throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
63
63
  }
@@ -73,6 +73,7 @@ function SingleLineEditor(props) {
73
73
  return _react.createElement("div", {
74
74
  "data-test-id": "single-line-editor"
75
75
  }, _react.createElement(_f36components.TextInput, {
76
+ id: id,
76
77
  className: direction === 'rtl' ? _styles.rightToLeft : '',
77
78
  isRequired: field.required,
78
79
  isInvalid: errors.length > 0,
@@ -6,7 +6,7 @@ function isSupportedFieldTypes(val) {
6
6
  return val === 'Symbol' || val === 'Text';
7
7
  }
8
8
  export function SingleLineEditor(props) {
9
- const { field, isDisabled, isInitiallyDisabled = true, locales, onBlur, onFocus, withCharInformation = true, withCharValidation = true } = props;
9
+ const { field, isDisabled, isInitiallyDisabled = true, locales, onBlur, onFocus, withCharInformation = true, withCharValidation = true, id } = props;
10
10
  if (!isSupportedFieldTypes(field.type)) {
11
11
  throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
12
12
  }
@@ -22,6 +22,7 @@ export function SingleLineEditor(props) {
22
22
  return React.createElement("div", {
23
23
  "data-test-id": "single-line-editor"
24
24
  }, React.createElement(TextInput, {
25
+ id: id,
25
26
  className: direction === 'rtl' ? styles.rightToLeft : '',
26
27
  isRequired: field.required,
27
28
  isInvalid: errors.length > 0,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { FieldAPI, LocalesAPI } from '@contentful/field-editor-shared';
2
+ import { type FieldAPI, type LocalesAPI } from '@contentful/field-editor-shared';
3
3
  export interface SingleLineEditorProps {
4
4
  /**
5
5
  * is the field disabled initially
@@ -33,5 +33,9 @@ export interface SingleLineEditorProps {
33
33
  * focus event handler
34
34
  */
35
35
  onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
36
+ /**
37
+ * id used for associating the input field with its label
38
+ */
39
+ id?: string;
36
40
  }
37
41
  export declare function SingleLineEditor(props: SingleLineEditorProps): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-single-line",
3
- "version": "1.5.5",
3
+ "version": "1.6.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
  "lodash": "^4.17.15"
43
43
  },
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "registry": "https://npm.pkg.github.com/"
52
52
  },
53
- "gitHead": "1d0dc6dc10cf4ad43aa48b04fa67d29ab7edaee8"
53
+ "gitHead": "6bee4a59a3c19a95d2cadde3ef0c78112788626e"
54
54
  }