carbon-react 126.4.0 → 126.4.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.
@@ -1,5 +1,5 @@
1
1
  import Input from "./input.component";
2
2
  import InputPresentation from "./input-presentation.component";
3
- export type { InputProps, CommonInputProps } from "./input.component";
3
+ export type { InputProps, CommonInputProps, EnterKeyHintTypes, } from "./input.component";
4
4
  export { Input, InputPresentation };
5
5
  export default Input;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { BorderRadiusType } from "../../components/box/box.component";
3
+ export declare type EnterKeyHintTypes = "enter" | "done" | "go" | "next" | "previous" | "search" | "send";
3
4
  export interface CommonInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
4
5
  align?: "right" | "left";
5
6
  /** The id of the element that describe the input. */
@@ -45,6 +45,7 @@ const Input = /*#__PURE__*/React.forwardRef(({
45
45
  name,
46
46
  validationIconId,
47
47
  inputBorderRadius = "borderRadius050",
48
+ enterKeyHint,
48
49
  ...rest
49
50
  }, ref) => {
50
51
  const context = useContext(InputContext);
@@ -62,7 +63,10 @@ const Input = /*#__PURE__*/React.forwardRef(({
62
63
  if (autoFocus && element) {
63
64
  element.focus();
64
65
  }
65
- }, [autoFocus, ref]);
66
+ if (enterKeyHint && element) {
67
+ element.setAttribute("enterkeyhint", enterKeyHint);
68
+ }
69
+ }, [autoFocus, ref, enterKeyHint]);
66
70
  useEffect(() => {
67
71
  if (inputRef) {
68
72
  inputRef(input);
@@ -1,5 +1,5 @@
1
1
  import Input from "./input.component";
2
2
  import InputPresentation from "./input-presentation.component";
3
- export type { InputProps, CommonInputProps } from "./input.component";
3
+ export type { InputProps, CommonInputProps, EnterKeyHintTypes, } from "./input.component";
4
4
  export { Input, InputPresentation };
5
5
  export default Input;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { BorderRadiusType } from "../../components/box/box.component";
3
+ export declare type EnterKeyHintTypes = "enter" | "done" | "go" | "next" | "previous" | "search" | "send";
3
4
  export interface CommonInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
4
5
  align?: "right" | "left";
5
6
  /** The id of the element that describe the input. */
@@ -54,6 +54,7 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
54
54
  name,
55
55
  validationIconId,
56
56
  inputBorderRadius = "borderRadius050",
57
+ enterKeyHint,
57
58
  ...rest
58
59
  }, ref) => {
59
60
  const context = (0, _react.useContext)(_inputBehaviour.InputContext);
@@ -71,7 +72,10 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
71
72
  if (autoFocus && element) {
72
73
  element.focus();
73
74
  }
74
- }, [autoFocus, ref]);
75
+ if (enterKeyHint && element) {
76
+ element.setAttribute("enterkeyhint", enterKeyHint);
77
+ }
78
+ }, [autoFocus, ref, enterKeyHint]);
75
79
  (0, _react.useEffect)(() => {
76
80
  if (inputRef) {
77
81
  inputRef(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "126.4.0",
3
+ "version": "126.4.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",