grevlingui 0.1.24 → 0.1.26
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.
|
@@ -4,24 +4,36 @@
|
|
|
4
4
|
position: relative;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
.numberSelect_editing {
|
|
8
|
+
z-index: 2;
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
.numberSelect_value {
|
|
8
12
|
position: relative;
|
|
9
13
|
display: flex;
|
|
10
14
|
align-items: center;
|
|
11
15
|
justify-content: center;
|
|
12
16
|
border-radius: 100%;
|
|
13
|
-
z-index:
|
|
17
|
+
z-index: 2;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.numberSelect_input {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
transition: opacity 300ms linear;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.numberSelect_input-hidden {
|
|
26
|
+
opacity: 0;
|
|
27
|
+
pointer-events: none;
|
|
14
28
|
}
|
|
15
29
|
|
|
16
30
|
.numberSelect_increment {
|
|
17
31
|
border-radius: 100%;
|
|
18
32
|
position: absolute;
|
|
19
|
-
z-index:
|
|
33
|
+
z-index: 3;
|
|
20
34
|
}
|
|
21
35
|
|
|
22
36
|
.numberSelect_blur {
|
|
23
37
|
position: absolute;
|
|
24
|
-
opacity: .5;
|
|
25
|
-
/*background: radial-gradient(#1E90FFFF, #1E90FFFF, #1E90FF00, #1E90FF00, #1E90FF00);*/
|
|
26
38
|
z-index: 1;
|
|
27
39
|
}
|
|
@@ -31,10 +31,20 @@ const NumberSelect = _ref => {
|
|
|
31
31
|
color = 'white',
|
|
32
32
|
numberBgColor = '#663399',
|
|
33
33
|
selectorColor = '#1E90FF',
|
|
34
|
-
|
|
35
|
-
top = -16
|
|
34
|
+
timeout = 1000
|
|
36
35
|
} = _ref;
|
|
37
36
|
const [editing, setEditing] = (0, _react.useState)(false);
|
|
37
|
+
const [closeTimeout, setCloseTimeout] = (0, _react.useState)();
|
|
38
|
+
|
|
39
|
+
const startTimeout = () => {
|
|
40
|
+
if (!timeout) return;
|
|
41
|
+
clearTimeout(closeTimeout);
|
|
42
|
+
setCloseTimeout(setTimeout(() => {
|
|
43
|
+
setEditing(false);
|
|
44
|
+
setCloseTimeout(undefined);
|
|
45
|
+
}, timeout));
|
|
46
|
+
};
|
|
47
|
+
|
|
38
48
|
const fullSize = "".concat(size, "rem");
|
|
39
49
|
const incrementorSize = "".concat(size * .8, "rem");
|
|
40
50
|
const incrementorVerticalOffset = "-".concat(size * .9, "rem");
|
|
@@ -57,7 +67,7 @@ const NumberSelect = _ref => {
|
|
|
57
67
|
});
|
|
58
68
|
|
|
59
69
|
const blurStyle = {
|
|
60
|
-
background: "radial-gradient(".concat(
|
|
70
|
+
background: "radial-gradient(".concat(numberBgColor, "FF, ").concat(numberBgColor, "00, ").concat(numberBgColor, "00)"),
|
|
61
71
|
left: minusHalfSize,
|
|
62
72
|
right: minusHalfSize,
|
|
63
73
|
top: incrementorVerticalOffset,
|
|
@@ -74,13 +84,17 @@ const NumberSelect = _ref => {
|
|
|
74
84
|
d: "M480-345 240-585l43-43 197 198 197-197 43 43-240 239Z"
|
|
75
85
|
}));
|
|
76
86
|
|
|
77
|
-
const increment = change => () =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
const increment = change => () => {
|
|
88
|
+
startTimeout();
|
|
89
|
+
const nv = change + value;
|
|
90
|
+
if (nv > max || nv < min) return;
|
|
91
|
+
setValue(nv);
|
|
92
|
+
};
|
|
81
93
|
|
|
82
|
-
const renderInputs = () => /*#__PURE__*/_react.default.createElement(
|
|
83
|
-
className: "
|
|
94
|
+
const renderInputs = () => /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
className: "numberSelect_input ".concat(editing ? '' : 'numberSelect_input-hidden')
|
|
96
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
97
|
+
className: "numberSelect_increment numberSelect_add ".concat(editing ? 'numberSelect_editing' : ''),
|
|
84
98
|
style: addStyle,
|
|
85
99
|
onClick: increment(1)
|
|
86
100
|
}, icon(true)), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -96,7 +110,10 @@ const NumberSelect = _ref => {
|
|
|
96
110
|
className: "numberSelect"
|
|
97
111
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
98
112
|
className: "numberSelect_value",
|
|
99
|
-
onClick: () =>
|
|
113
|
+
onClick: () => {
|
|
114
|
+
if (!editing) startTimeout();
|
|
115
|
+
setEditing(!editing);
|
|
116
|
+
},
|
|
100
117
|
style: {
|
|
101
118
|
height: fullSize,
|
|
102
119
|
width: fullSize,
|
|
@@ -104,7 +121,7 @@ const NumberSelect = _ref => {
|
|
|
104
121
|
backgroundColor: numberBgColor,
|
|
105
122
|
fontSize: "".concat(size / 2, "rem")
|
|
106
123
|
}
|
|
107
|
-
}, value),
|
|
124
|
+
}, value), renderInputs());
|
|
108
125
|
};
|
|
109
126
|
|
|
110
127
|
exports.NumberSelect = NumberSelect;
|