@primer/behaviors 1.3.0 → 1.3.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.
@@ -1,5 +1,5 @@
1
1
  export declare type Direction = 'previous' | 'next' | 'start' | 'end';
2
- export declare type FocusMovementKeys = 'ArrowLeft' | 'ArrowDown' | 'ArrowUp' | 'ArrowRight' | 'h' | 'j' | 'k' | 'l' | 'a' | 's' | 'w' | 'd' | 'Tab' | 'Home' | 'End' | 'PageUp' | 'PageDown';
2
+ export declare type FocusMovementKeys = 'ArrowLeft' | 'ArrowDown' | 'ArrowUp' | 'ArrowRight' | 'h' | 'j' | 'k' | 'l' | 'a' | 's' | 'w' | 'd' | 'Tab' | 'Home' | 'End' | 'PageUp' | 'PageDown' | 'Backspace';
3
3
  export declare enum FocusKeys {
4
4
  ArrowHorizontal = 1,
5
5
  ArrowVertical = 2,
@@ -10,6 +10,7 @@ export declare enum FocusKeys {
10
10
  WS = 32,
11
11
  AD = 64,
12
12
  Tab = 128,
13
+ Backspace = 512,
13
14
  ArrowAll = 3,
14
15
  HJKL = 12,
15
16
  WASD = 96,
@@ -17,6 +17,7 @@ var FocusKeys;
17
17
  FocusKeys[FocusKeys["WS"] = 32] = "WS";
18
18
  FocusKeys[FocusKeys["AD"] = 64] = "AD";
19
19
  FocusKeys[FocusKeys["Tab"] = 128] = "Tab";
20
+ FocusKeys[FocusKeys["Backspace"] = 512] = "Backspace";
20
21
  FocusKeys[FocusKeys["ArrowAll"] = 3] = "ArrowAll";
21
22
  FocusKeys[FocusKeys["HJKL"] = 12] = "HJKL";
22
23
  FocusKeys[FocusKeys["WASD"] = 96] = "WASD";
@@ -39,7 +40,8 @@ const KEY_TO_BIT = {
39
40
  Home: FocusKeys.HomeAndEnd,
40
41
  End: FocusKeys.HomeAndEnd,
41
42
  PageUp: FocusKeys.PageUpDown,
42
- PageDown: FocusKeys.PageUpDown
43
+ PageDown: FocusKeys.PageUpDown,
44
+ Backspace: FocusKeys.Backspace
43
45
  };
44
46
  const KEY_TO_DIRECTION = {
45
47
  ArrowLeft: 'previous',
@@ -58,7 +60,8 @@ const KEY_TO_DIRECTION = {
58
60
  Home: 'start',
59
61
  End: 'end',
60
62
  PageUp: 'start',
61
- PageDown: 'end'
63
+ PageDown: 'end',
64
+ Backspace: 'previous'
62
65
  };
63
66
  function getDirection(keyboardEvent) {
64
67
  const direction = KEY_TO_DIRECTION[keyboardEvent.key];
@@ -1,5 +1,5 @@
1
1
  export declare type Direction = 'previous' | 'next' | 'start' | 'end';
2
- export declare type FocusMovementKeys = 'ArrowLeft' | 'ArrowDown' | 'ArrowUp' | 'ArrowRight' | 'h' | 'j' | 'k' | 'l' | 'a' | 's' | 'w' | 'd' | 'Tab' | 'Home' | 'End' | 'PageUp' | 'PageDown';
2
+ export declare type FocusMovementKeys = 'ArrowLeft' | 'ArrowDown' | 'ArrowUp' | 'ArrowRight' | 'h' | 'j' | 'k' | 'l' | 'a' | 's' | 'w' | 'd' | 'Tab' | 'Home' | 'End' | 'PageUp' | 'PageDown' | 'Backspace';
3
3
  export declare enum FocusKeys {
4
4
  ArrowHorizontal = 1,
5
5
  ArrowVertical = 2,
@@ -10,6 +10,7 @@ export declare enum FocusKeys {
10
10
  WS = 32,
11
11
  AD = 64,
12
12
  Tab = 128,
13
+ Backspace = 512,
13
14
  ArrowAll = 3,
14
15
  HJKL = 12,
15
16
  WASD = 96,
@@ -14,6 +14,7 @@ export var FocusKeys;
14
14
  FocusKeys[FocusKeys["WS"] = 32] = "WS";
15
15
  FocusKeys[FocusKeys["AD"] = 64] = "AD";
16
16
  FocusKeys[FocusKeys["Tab"] = 128] = "Tab";
17
+ FocusKeys[FocusKeys["Backspace"] = 512] = "Backspace";
17
18
  FocusKeys[FocusKeys["ArrowAll"] = 3] = "ArrowAll";
18
19
  FocusKeys[FocusKeys["HJKL"] = 12] = "HJKL";
19
20
  FocusKeys[FocusKeys["WASD"] = 96] = "WASD";
@@ -36,7 +37,8 @@ const KEY_TO_BIT = {
36
37
  Home: FocusKeys.HomeAndEnd,
37
38
  End: FocusKeys.HomeAndEnd,
38
39
  PageUp: FocusKeys.PageUpDown,
39
- PageDown: FocusKeys.PageUpDown
40
+ PageDown: FocusKeys.PageUpDown,
41
+ Backspace: FocusKeys.Backspace
40
42
  };
41
43
  const KEY_TO_DIRECTION = {
42
44
  ArrowLeft: 'previous',
@@ -55,7 +57,8 @@ const KEY_TO_DIRECTION = {
55
57
  Home: 'start',
56
58
  End: 'end',
57
59
  PageUp: 'start',
58
- PageDown: 'end'
60
+ PageDown: 'end',
61
+ Backspace: 'previous'
59
62
  };
60
63
  function getDirection(keyboardEvent) {
61
64
  const direction = KEY_TO_DIRECTION[keyboardEvent.key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/behaviors",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Shared behaviors for JavaScript components",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",