@dtdot/lego 0.17.4 → 0.17.5
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.
|
@@ -46,7 +46,7 @@ const LiveList = ({ value: inputValue, name, onChange: propsOnChange }) => {
|
|
|
46
46
|
}
|
|
47
47
|
}, [propsOnChange, contextOnChange]);
|
|
48
48
|
useEffect(() => {
|
|
49
|
-
if (!
|
|
49
|
+
if (!value?.length) {
|
|
50
50
|
wrappedOnChange([{ id: uuidv4(), value: '' }]);
|
|
51
51
|
}
|
|
52
52
|
}, [value, wrappedOnChange]);
|
|
@@ -65,7 +65,7 @@ const LiveList = ({ value: inputValue, name, onChange: propsOnChange }) => {
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
const focusedValue = value.find((val) => val.id === focusedId);
|
|
68
|
-
if (focusedValue
|
|
68
|
+
if (focusedValue?.value) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
const focusedIndex = value.findIndex((val) => val.id === focusedId);
|
|
@@ -97,7 +97,7 @@ const LiveList = ({ value: inputValue, name, onChange: propsOnChange }) => {
|
|
|
97
97
|
const newItem = { id: uuidv4(), value: '' };
|
|
98
98
|
wrappedOnChange([...value, newItem]);
|
|
99
99
|
};
|
|
100
|
-
if (!
|
|
100
|
+
if (!value?.length) {
|
|
101
101
|
return null;
|
|
102
102
|
}
|
|
103
103
|
return (React.createElement("div", null,
|
|
@@ -30,7 +30,7 @@ const Identicon = ({ value }) => {
|
|
|
30
30
|
const hexColours = [colours.red, colours.green, colours.blue, colours.yellow];
|
|
31
31
|
const convertedColours = hexColours.map((hex) => {
|
|
32
32
|
const rgb = hexToRgb(hex);
|
|
33
|
-
return [rgb
|
|
33
|
+
return [rgb?.r, rgb?.g, rgb?.b, 255];
|
|
34
34
|
});
|
|
35
35
|
const hash = SparkMD5.hash(value || 'unknown user');
|
|
36
36
|
const colourIndex = Math.floor(Math.random() * 4);
|
|
@@ -45,7 +45,7 @@ const QrCode = ({ value }) => {
|
|
|
45
45
|
if (hintTimeoutRef.current) {
|
|
46
46
|
window.clearTimeout(hintTimeoutRef.current);
|
|
47
47
|
}
|
|
48
|
-
if (inputRef
|
|
48
|
+
if (inputRef?.current) {
|
|
49
49
|
inputRef.current.select();
|
|
50
50
|
document.execCommand('copy');
|
|
51
51
|
}
|
|
@@ -4,14 +4,13 @@ const useKeypress = (key, handler) => {
|
|
|
4
4
|
useEffect(() => {
|
|
5
5
|
eventListenerRef.current = (event) => {
|
|
6
6
|
if (key === event.key) {
|
|
7
|
-
handler
|
|
7
|
+
handler?.();
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
}, [key, handler]);
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
const eventListener = (event) => {
|
|
13
|
-
|
|
14
|
-
(_a = eventListenerRef.current) === null || _a === void 0 ? void 0 : _a.call(eventListenerRef, event);
|
|
13
|
+
eventListenerRef.current?.(event);
|
|
15
14
|
};
|
|
16
15
|
window.addEventListener('keydown', eventListener);
|
|
17
16
|
return () => {
|