@citygross/components 0.8.9 → 0.8.10
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/build/cjs/components/src/components/QuantitySelector/QuantitySelector.js +6 -1
- package/build/cjs/components/src/components/QuantitySelector/QuantitySelector.js.map +1 -1
- package/build/es/components/src/components/QuantitySelector/QuantitySelector.js +7 -2
- package/build/es/components/src/components/QuantitySelector/QuantitySelector.js.map +1 -1
- package/package.json +2 -2
|
@@ -13,12 +13,17 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
13
13
|
function QuantitySelector(_a) {
|
|
14
14
|
var onAdd = _a.onAdd, onSubtract = _a.onSubtract, onChange = _a.onChange, maxValue = _a.maxValue, value = _a.value, onBlur = _a.onBlur;
|
|
15
15
|
var _b = React.useState(false), customFocus = _b[0], setCustomFocus = _b[1];
|
|
16
|
+
var inputRef = React.useRef(null);
|
|
16
17
|
return (React__default["default"].createElement(QuantitySelector_styles.QuantitySelectorContainer, null,
|
|
17
18
|
React__default["default"].createElement(QuantitySelector_styles.QuantityButton, { direction: "left", disabled: value <= 0, onClick: onSubtract, tabIndex: -1 },
|
|
18
19
|
React__default["default"].createElement(QuantitySelector_styles.IconContainer, null,
|
|
19
20
|
React__default["default"].createElement(icons.Icons.Minus, { width: 16, height: 16 }))),
|
|
20
|
-
React__default["default"].createElement(QuantitySelector_styles.QuantityInput, { customFocus: customFocus, max: maxValue, value: value, type: "number", onMouseDown: function () {
|
|
21
|
+
React__default["default"].createElement(QuantitySelector_styles.QuantityInput, { customFocus: customFocus, max: maxValue, value: value, ref: inputRef, type: "number", onMouseDown: function () {
|
|
21
22
|
setCustomFocus(true);
|
|
23
|
+
}, onClick: function () {
|
|
24
|
+
if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) {
|
|
25
|
+
inputRef.current.select();
|
|
26
|
+
}
|
|
22
27
|
}, onKeyDown: function (event) {
|
|
23
28
|
if (event.key === 'Enter' || event.key === 'Escape') {
|
|
24
29
|
event.currentTarget.blur();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuantitySelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QuantitySelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
2
|
import { QuantitySelectorContainer, QuantityButton, IconContainer, QuantityInput } from './QuantitySelector.styles.js';
|
|
3
3
|
import { Icons } from '@citygross/icons';
|
|
4
4
|
|
|
5
5
|
function QuantitySelector(_a) {
|
|
6
6
|
var onAdd = _a.onAdd, onSubtract = _a.onSubtract, onChange = _a.onChange, maxValue = _a.maxValue, value = _a.value, onBlur = _a.onBlur;
|
|
7
7
|
var _b = useState(false), customFocus = _b[0], setCustomFocus = _b[1];
|
|
8
|
+
var inputRef = useRef(null);
|
|
8
9
|
return (React.createElement(QuantitySelectorContainer, null,
|
|
9
10
|
React.createElement(QuantityButton, { direction: "left", disabled: value <= 0, onClick: onSubtract, tabIndex: -1 },
|
|
10
11
|
React.createElement(IconContainer, null,
|
|
11
12
|
React.createElement(Icons.Minus, { width: 16, height: 16 }))),
|
|
12
|
-
React.createElement(QuantityInput, { customFocus: customFocus, max: maxValue, value: value, type: "number", onMouseDown: function () {
|
|
13
|
+
React.createElement(QuantityInput, { customFocus: customFocus, max: maxValue, value: value, ref: inputRef, type: "number", onMouseDown: function () {
|
|
13
14
|
setCustomFocus(true);
|
|
15
|
+
}, onClick: function () {
|
|
16
|
+
if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) {
|
|
17
|
+
inputRef.current.select();
|
|
18
|
+
}
|
|
14
19
|
}, onKeyDown: function (event) {
|
|
15
20
|
if (event.key === 'Enter' || event.key === 'Escape') {
|
|
16
21
|
event.currentTarget.blur();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuantitySelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QuantitySelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citygross/components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./build/cjs/components/src/index.js",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"react-slick": "^0.30.1",
|
|
77
77
|
"slick-carousel": "^1.8.1"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "1c892d32f97f739e8dbf1e344be03ca9702ad8ee"
|
|
80
80
|
}
|