@rpg-engine/long-bow 0.8.57 → 0.8.59

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.8.57",
3
+ "version": "0.8.59",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { ReactNode, useCallback } from 'react';
2
2
  import styled, { createGlobalStyle } from 'styled-components';
3
3
  import ModalPortal from './Abstractions/ModalPortal';
4
4
  import { Button, ButtonTypes } from './Button';
@@ -23,24 +23,43 @@ export const ConfirmModal: React.FC<IConfirmModalProps> = ({
23
23
  onClose,
24
24
  message = 'Are you sure?',
25
25
  }) => {
26
- const handleConfirm = () => {
27
- onConfirm();
28
- };
26
+ const handleConfirm = useCallback(
27
+ (e: React.PointerEvent) => {
28
+ e.preventDefault();
29
+ e.stopPropagation();
30
+ onConfirm();
31
+ },
32
+ [onConfirm]
33
+ );
29
34
 
30
- const handleClose = () => {
31
- onClose();
32
- };
35
+ const handleClose = useCallback(
36
+ (e: React.PointerEvent) => {
37
+ e.preventDefault();
38
+ e.stopPropagation();
39
+ onClose();
40
+ },
41
+ [onClose]
42
+ );
33
43
 
34
- const stopPropagation = (e: React.PointerEvent) => {
35
- e.stopPropagation();
36
- };
44
+ const stopPropagation = useCallback(
45
+ (e: React.PointerEvent | React.TouchEvent) => {
46
+ e.stopPropagation();
47
+ },
48
+ []
49
+ );
37
50
 
38
51
  return (
39
52
  <ModalPortal>
40
53
  <GlobalStyle />
41
- <Overlay onClick={handleClose} />
54
+ <Overlay onPointerDown={handleClose} />
42
55
  <ModalContainer>
43
- <ModalContent onPointerDown={stopPropagation}>
56
+ <ModalContent
57
+ onClick={stopPropagation}
58
+ onTouchStart={stopPropagation}
59
+ onTouchEnd={stopPropagation}
60
+ onTouchMove={stopPropagation}
61
+ onPointerDown={stopPropagation}
62
+ >
44
63
  <MessageContainer>
45
64
  {typeof message === 'string' ? (
46
65
  <Message>{message}</Message>
@@ -81,6 +100,7 @@ const Overlay = styled.div`
81
100
  z-index: 1000;
82
101
  animation: fadeIn 0.2s ease-out;
83
102
  cursor: pointer;
103
+ touch-action: none;
84
104
 
85
105
  @keyframes fadeIn {
86
106
  from {