@react-fabric/form 1.0.0-beta.52 → 1.0.0-beta.54

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.
@@ -42,6 +42,10 @@ var useHandleEnter = function useHandleEnter(callback) {
42
42
  if (tree && e.key !== "Escape") {
43
43
  e === null || e === void 0 || e.stopPropagation();
44
44
  }
45
+ // blur input on escape key press
46
+ if (e.key === "Escape") {
47
+ e.currentTarget.blur();
48
+ }
45
49
  if (!e.shiftKey && !e.altKey && !e.metaKey && e.key === "Enter" && callback) {
46
50
  if (stopPropagation) e === null || e === void 0 || e.stopPropagation();
47
51
  cbHandle(e);
@@ -42,6 +42,10 @@ var useHandleEnter = function useHandleEnter(callback) {
42
42
  if (tree && e.key !== "Escape") {
43
43
  e === null || e === void 0 || e.stopPropagation();
44
44
  }
45
+ // blur input on escape key press
46
+ if (e.key === "Escape") {
47
+ e.currentTarget.blur();
48
+ }
45
49
  if (!e.shiftKey && !e.altKey && !e.metaKey && e.key === "Enter" && callback) {
46
50
  if (stopPropagation) e === null || e === void 0 || e.stopPropagation();
47
51
  cbHandle(e);
@@ -3,7 +3,7 @@ import { type KeyboardEvent, type MouseEvent } from "react";
3
3
  export declare const useHandleEnter: (callback?: (e: KeyboardEvent) => void, { stopPropagation, preventDefault, }?: {
4
4
  stopPropagation?: boolean;
5
5
  preventDefault?: boolean;
6
- }) => (e: KeyboardEvent) => false | undefined;
6
+ }) => (e: KeyboardEvent<HTMLInputElement>) => false | undefined;
7
7
  /** ***************** common handler for mouse primary click *******************/
8
8
  export declare const handleClick: (callback?: (e: MouseEvent) => void, { stopPropagation, preventDefault, }?: {
9
9
  stopPropagation?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/form",
3
- "version": "1.0.0-beta.52",
3
+ "version": "1.0.0-beta.54",
4
4
  "description": "RUF: Form package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -41,8 +41,8 @@
41
41
  "@dnd-kit/utilities": "^3.2.2",
42
42
  "@floating-ui/react": "^0.27.9",
43
43
  "@hookform/resolvers": "^3.9.0",
44
- "@react-fabric/core": "^1.0.0-beta.52",
45
- "@react-fabric/date": "^1.0.0-beta.52",
44
+ "@react-fabric/core": "^1.0.0-beta.54",
45
+ "@react-fabric/date": "^1.0.0-beta.54",
46
46
  "@react-fabric/utilities": "^1.0.0-beta.52",
47
47
  "classnames": "^2.5.1",
48
48
  "color": "^4.2.3",
@@ -63,5 +63,5 @@
63
63
  "node": ">=18.12.0",
64
64
  "npm": ">=8.19.0"
65
65
  },
66
- "gitHead": "0eabb9d88d91af93d657bcc209b226fd576e8260"
66
+ "gitHead": "242f15e3de29d365cce6f41f4ef99ab36bb6b995"
67
67
  }
@@ -147,7 +147,7 @@ export const Textarea = ({
147
147
  onBlur={onBlur}
148
148
  onFocus={onFocus}
149
149
  onChange={handleChange}
150
- onKeyDown={handleEnterPressed}
150
+ onKeyDown={handleEnterPressed as any}
151
151
  />
152
152
  </InputWrapper>
153
153
  );
@@ -37,11 +37,15 @@ export const useHandleEnter = (
37
37
  ) => {
38
38
  const cbHandle = useDebounce(callback ?? (() => undefined), [callback], 100);
39
39
  const tree = useFloatingTree();
40
- return (e: KeyboardEvent) => {
40
+ return (e: KeyboardEvent<HTMLInputElement>) => {
41
41
  // prevent propagation of event if input within dropdown (work around for floating-ui typeahead)
42
42
  if (tree && e.key !== "Escape") {
43
43
  e?.stopPropagation();
44
44
  }
45
+ // blur input on escape key press
46
+ if (e.key === "Escape") {
47
+ e.currentTarget.blur();
48
+ }
45
49
  if (
46
50
  !e.shiftKey &&
47
51
  !e.altKey &&