grevlingui 0.1.27 → 0.1.29

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.
@@ -31,18 +31,26 @@ const NumberSelect = _ref => {
31
31
  color = 'white',
32
32
  numberBgColor = '#663399',
33
33
  selectorColor = '#1E90FF',
34
- timeout = 1000
34
+ timeout = 1000,
35
+ onOpenInput,
36
+ closed
35
37
  } = _ref;
36
38
  const [editing, setEditing] = (0, _react.useState)(false);
37
39
  const [closeTimeout, setCloseTimeout] = (0, _react.useState)();
40
+ (0, _react.useEffect)(() => {
41
+ if (closed) close();
42
+ }, [closed]);
43
+
44
+ const close = () => {
45
+ clearTimeout(closeTimeout);
46
+ setEditing(false);
47
+ setCloseTimeout(undefined);
48
+ };
38
49
 
39
50
  const startTimeout = () => {
40
51
  if (!timeout) return;
41
52
  clearTimeout(closeTimeout);
42
- setCloseTimeout(setTimeout(() => {
43
- setEditing(false);
44
- setCloseTimeout(undefined);
45
- }, timeout));
53
+ setCloseTimeout(setTimeout(close, timeout));
46
54
  };
47
55
 
48
56
  const fullSize = "".concat(size, "rem");
@@ -111,7 +119,11 @@ const NumberSelect = _ref => {
111
119
  }, /*#__PURE__*/_react.default.createElement("div", {
112
120
  className: "numberSelect_value",
113
121
  onClick: () => {
114
- if (!editing) startTimeout();
122
+ if (!editing) {
123
+ startTimeout();
124
+ onOpenInput === null || onOpenInput === void 0 ? void 0 : onOpenInput();
125
+ }
126
+
115
127
  setEditing(!editing);
116
128
  },
117
129
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grevlingui",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "GUI elements",
5
5
  "module": "index.js",
6
6
  "dependencies": {