@occmundial/occ-atomic 3.0.0-beta.18 → 3.0.0-beta.19

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [3.0.0-beta.19](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.18...v3.0.0-beta.19) (2024-06-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Prevent default to avoid scroll on key down ([9ee17d2](https://github.com/occmundial/occ-atomic/commit/9ee17d2a247a02a7be7e1c743669c8833d3f5748))
7
+
1
8
  # [3.0.0-beta.18](https://github.com/occmundial/occ-atomic/compare/v3.0.0-beta.17...v3.0.0-beta.18) (2024-06-21)
2
9
 
3
10
 
@@ -57,6 +57,7 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
57
57
  undetermined: props.undetermined
58
58
  };
59
59
  _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
60
+ _this.handleKeyUp = _this.handleKeyUp.bind(_assertThisInitialized(_this));
60
61
  return _this;
61
62
  }
62
63
 
@@ -85,19 +86,23 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
85
86
  if (onChange) onChange(value, id);
86
87
  }
87
88
  }
89
+ }, {
90
+ key: "handleKeyDown",
91
+ value: function handleKeyDown(e) {
92
+ if (e.keyCode == 13 || e.keyCode == 32) {
93
+ e.preventDefault();
94
+ }
95
+ }
88
96
  }, {
89
97
  key: "handleKeyUp",
90
98
  value: function handleKeyUp(e) {
91
99
  if (e.keyCode == 13 || e.keyCode == 32) {
92
- e.preventDefault();
93
100
  this.toggle();
94
101
  }
95
102
  }
96
103
  }, {
97
104
  key: "render",
98
105
  value: function render() {
99
- var _this2 = this;
100
-
101
106
  var _this$state = this.state,
102
107
  value = _this$state.value,
103
108
  undetermined = _this$state.undetermined;
@@ -118,9 +123,8 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
118
123
  return /*#__PURE__*/_react["default"].createElement("div", _extends({
119
124
  id: id,
120
125
  tabIndex: disabled ? -1 : 0,
121
- onKeyUp: function onKeyUp(e) {
122
- return _this2.handleKeyUp(e);
123
- },
126
+ onKeyDown: this.handleKeyDown,
127
+ onKeyUp: this.handleKeyUp,
124
128
  className: "".concat(classes.cont).concat(iconClass).concat(disabled ? " ".concat(classes.disabled) : '').concat(className ? " ".concat(className) : ''),
125
129
  onClick: this.toggle,
126
130
  style: style,
@@ -54,6 +54,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
54
54
  selected: props.selected
55
55
  };
56
56
  _this.onChange = _this.onChange.bind(_assertThisInitialized(_this));
57
+ _this.handleKeyUp = _this.handleKeyUp.bind(_assertThisInitialized(_this));
57
58
  return _this;
58
59
  }
59
60
 
@@ -77,11 +78,17 @@ var Radio = /*#__PURE__*/function (_React$Component) {
77
78
  if (onChange) onChange(option.value);
78
79
  }
79
80
  }
81
+ }, {
82
+ key: "handleKeyDown",
83
+ value: function handleKeyDown(e) {
84
+ if (e.keyCode == 13 || e.keyCode == 32) {
85
+ e.preventDefault();
86
+ }
87
+ }
80
88
  }, {
81
89
  key: "handleKeyUp",
82
90
  value: function handleKeyUp(e, option) {
83
91
  if (e.keyCode == 13 || e.keyCode == 32) {
84
- e.preventDefault();
85
92
  this.onChange(option);
86
93
  }
87
94
  }
@@ -106,6 +113,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
106
113
  id: option.trk,
107
114
  key: option.value,
108
115
  tabIndex: option.disabled ? -1 : 0,
116
+ onKeyDown: _this2.handleKeyDown,
109
117
  onKeyUp: function onKeyUp(e) {
110
118
  return _this2.handleKeyUp(e, option);
111
119
  },
@@ -56,6 +56,7 @@ var SlideToggle = /*#__PURE__*/function (_React$Component) {
56
56
  value: props.value
57
57
  };
58
58
  _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));
59
+ _this.handleKeyUp = _this.handleKeyUp.bind(_assertThisInitialized(_this));
59
60
  return _this;
60
61
  }
61
62
 
@@ -83,19 +84,23 @@ var SlideToggle = /*#__PURE__*/function (_React$Component) {
83
84
  if (onChange) onChange(value, id);
84
85
  }
85
86
  }
87
+ }, {
88
+ key: "handleKeyDown",
89
+ value: function handleKeyDown(e) {
90
+ if (e.keyCode == 13 || e.keyCode == 32) {
91
+ e.preventDefault();
92
+ }
93
+ }
86
94
  }, {
87
95
  key: "handleKeyUp",
88
96
  value: function handleKeyUp(e) {
89
97
  if (e.keyCode == 13 || e.keyCode == 32) {
90
- e.preventDefault();
91
98
  this.toggle();
92
99
  }
93
100
  }
94
101
  }, {
95
102
  key: "render",
96
103
  value: function render() {
97
- var _this2 = this;
98
-
99
104
  var value = this.state.value;
100
105
  var _this$props2 = this.props,
101
106
  classes = _this$props2.classes,
@@ -111,9 +116,8 @@ var SlideToggle = /*#__PURE__*/function (_React$Component) {
111
116
  return /*#__PURE__*/_react["default"].createElement("div", {
112
117
  id: id,
113
118
  tabIndex: disabled ? -1 : 0,
114
- onKeyUp: function onKeyUp(e) {
115
- return _this2.handleKeyUp(e);
116
- },
119
+ onKeyDown: this.handleKeyDown,
120
+ onKeyUp: this.handleKeyUp,
117
121
  onClick: this.toggle,
118
122
  className: "".concat(classes.cont).concat(disabled ? " ".concat(classes.disabled) : '').concat(className ? " ".concat(className) : ''),
119
123
  style: style
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occmundial/occ-atomic",
3
- "version": "3.0.0-beta.18",
3
+ "version": "3.0.0-beta.19",
4
4
  "description": "Collection of shareable styled React components for OCC applications.",
5
5
  "homepage": "http://occmundial.github.io/occ-atomic",
6
6
  "main": "build/index.js",