@thecb/components 12.1.0-beta.13 → 12.1.0-beta.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "12.1.0-beta.13",
3
+ "version": "12.1.0-beta.14",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -2,7 +2,7 @@ import React, { useState, forwardRef } from "react";
2
2
  import styled, { css } from "styled-components";
3
3
  import { fallbackValues } from "./Checkbox.theme";
4
4
  import { noop } from "../../../util/general";
5
- import { ENTER } from "../../../constants/keyboard";
5
+ import { ENTER_KEY, SPACE_KEY } from "../../../constants/keyboard";
6
6
  import Box from "../layouts/Box";
7
7
  import Text from "../text";
8
8
  import { themeComponent } from "../../../util/themeUtils";
@@ -118,7 +118,8 @@ const Checkbox = forwardRef(
118
118
  const [focused, setFocused] = useState(false);
119
119
 
120
120
  const handleClick = (e, func) => {
121
- if (e.keyCode === ENTER) {
121
+ if (e.key === SPACE_KEY) {
122
+ e.preventDefault();
122
123
  func();
123
124
  }
124
125
  };
@@ -3,5 +3,7 @@ export const ARROW_UP = 38;
3
3
  export const ARROW_RIGHT = 39;
4
4
  export const ARROW_DOWN = 40;
5
5
  export const ENTER = 13;
6
+ export const ENTER_KEY = "Enter";
6
7
  export const ESCAPE = 27;
7
8
  export const SPACEBAR = 32;
9
+ export const SPACE_KEY = " ";