@ainias42/react-bootstrap-mobile 0.1.22 → 0.1.24
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/dist/bootstrapReactMobile.js +28 -20
- package/dist/bootstrapReactMobile.js.map +1 -1
- package/dist/src/Components/Clickable/Clickable.d.ts +5 -5
- package/dist/src/Components/Layout/Block.d.ts +1 -1
- package/dist/src/Components/Layout/Flex.d.ts +1 -1
- package/dist/src/Components/Layout/Inline.d.ts +1 -1
- package/dist/src/Components/Layout/InlineBlock.d.ts +1 -1
- package/dist/src/Components/Layout/View.d.ts +2 -2
- package/dist/src/Components/Layout/ViewWithoutListeners.d.ts +2 -2
- package/package.json +3 -4
- package/src/Components/Clickable/Clickable.tsx +29 -29
- package/src/Components/Layout/View.tsx +2 -2
- package/src/Components/Layout/ViewWithoutListeners.tsx +2 -2
- package/src/Components/Menu/Menu.tsx +6 -2
- package/tsconfig.json +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
2
2
|
import { OptionalListener } from '../Hooks/useListener';
|
|
3
|
-
import { MouseEvent as ReactMouseEvent, MouseEvent } from 'react';
|
|
3
|
+
import { MouseEvent as ReactMouseEvent, MouseEvent, PointerEvent } from 'react';
|
|
4
4
|
type OnClickListener<Data> = OptionalListener<'onClick', Data>;
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type
|
|
5
|
+
type OnPointerDownListener<Data> = OptionalListener<'onPointerDown', Data, PointerEvent>;
|
|
6
|
+
type OnPointerUpListener<Data> = OptionalListener<'onPointerUp', Data, PointerEvent>;
|
|
7
|
+
type OnPointerMoveListener<Data> = OptionalListener<'onPointerMove', Data, PointerEvent>;
|
|
8
8
|
type OnDropListener<Data> = OptionalListener<'onDrop', Data>;
|
|
9
9
|
type OnDragOverListener<Data> = OptionalListener<'onDragOver', Data>;
|
|
10
10
|
export type ClickableProps<OnClickData, OnMouseDownData, OnMouseMoveData, OnMouseUpData, OnClickCaptureData, OnDropData, OnDragOverData, OnMouseEnterData, OnMouseLeaveData, OnDoubleClickData, HrefType extends string | undefined> = RbmComponentProps<{
|
|
@@ -14,6 +14,6 @@ export type ClickableProps<OnClickData, OnMouseDownData, OnMouseMoveData, OnMous
|
|
|
14
14
|
preventDefault?: boolean;
|
|
15
15
|
stopPropagation?: boolean;
|
|
16
16
|
useReactOnMouseLeave?: boolean;
|
|
17
|
-
} & OnClickListener<OnClickData> &
|
|
17
|
+
} & OnClickListener<OnClickData> & OnPointerDownListener<OnMouseDownData> & OnPointerMoveListener<OnMouseMoveData> & OnPointerUpListener<OnMouseUpData> & OnDropListener<OnDropData> & OnDragOverListener<OnDragOverData> & OptionalListener<'onClickCapture', OnClickCaptureData> & OptionalListener<'onMouseEnter', OnMouseEnterData> & OptionalListener<'onMouseLeave', OnMouseLeaveData, MouseEvent | ReactMouseEvent> & OptionalListener<'onDoubleClick', OnDoubleClickData>>;
|
|
18
18
|
declare const ClickableMemo: import("../../helper/withForwardRef").RefComponent<ClickableProps<unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, string | undefined>, HTMLAnchorElement | HTMLSpanElement>;
|
|
19
19
|
export { ClickableMemo as Clickable };
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
4
4
|
import { ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
5
5
|
export type BlockProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<ViewWithoutListenersProps<AsType>>;
|
|
6
|
-
declare const BlockMemo: import("../../helper/withForwardRef").RefComponent<BlockProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement |
|
|
6
|
+
declare const BlockMemo: import("../../helper/withForwardRef").RefComponent<BlockProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement | HTMLStyleElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLParamElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableDataCellElement | HTMLTextAreaElement | HTMLTableHeaderCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLWebViewElement | SVGSVGElement | SVGCircleElement | SVGClipPathElement | SVGDefsElement | SVGDescElement | SVGEllipseElement | SVGFEBlendElement | SVGFEColorMatrixElement | SVGFEComponentTransferElement | SVGFECompositeElement | SVGFEConvolveMatrixElement | SVGFEDiffuseLightingElement | SVGFEDisplacementMapElement | SVGFEDistantLightElement | SVGFEDropShadowElement | SVGFEFloodElement | SVGFEFuncAElement | SVGFEFuncBElement | SVGFEFuncGElement | SVGFEFuncRElement | SVGFEGaussianBlurElement | SVGFEImageElement | SVGFEMergeElement | SVGFEMergeNodeElement | SVGFEMorphologyElement | SVGFEOffsetElement | SVGFEPointLightElement | SVGFESpecularLightingElement | SVGFESpotLightElement | SVGFETileElement | SVGFETurbulenceElement | SVGFilterElement | SVGForeignObjectElement | SVGGElement | SVGImageElement | SVGLineElement | SVGLinearGradientElement | SVGMarkerElement | SVGMaskElement | SVGMetadataElement | SVGPathElement | SVGPatternElement | SVGPolygonElement | SVGPolylineElement | SVGRadialGradientElement | SVGRectElement | SVGStopElement | SVGSwitchElement | SVGTextPathElement | SVGTSpanElement | SVGUseElement | SVGViewElement>;
|
|
7
7
|
export { BlockMemo as Block };
|
|
@@ -6,5 +6,5 @@ export type FlexProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponent
|
|
|
6
6
|
horizontal?: boolean;
|
|
7
7
|
grow?: boolean;
|
|
8
8
|
}>;
|
|
9
|
-
declare const tmp: import("../../helper/withForwardRef").RefComponent<FlexProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement |
|
|
9
|
+
declare const tmp: import("../../helper/withForwardRef").RefComponent<FlexProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement | HTMLStyleElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLParamElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableDataCellElement | HTMLTextAreaElement | HTMLTableHeaderCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLWebViewElement | SVGSVGElement | SVGCircleElement | SVGClipPathElement | SVGDefsElement | SVGDescElement | SVGEllipseElement | SVGFEBlendElement | SVGFEColorMatrixElement | SVGFEComponentTransferElement | SVGFECompositeElement | SVGFEConvolveMatrixElement | SVGFEDiffuseLightingElement | SVGFEDisplacementMapElement | SVGFEDistantLightElement | SVGFEDropShadowElement | SVGFEFloodElement | SVGFEFuncAElement | SVGFEFuncBElement | SVGFEFuncGElement | SVGFEFuncRElement | SVGFEGaussianBlurElement | SVGFEImageElement | SVGFEMergeElement | SVGFEMergeNodeElement | SVGFEMorphologyElement | SVGFEOffsetElement | SVGFEPointLightElement | SVGFESpecularLightingElement | SVGFESpotLightElement | SVGFETileElement | SVGFETurbulenceElement | SVGFilterElement | SVGForeignObjectElement | SVGGElement | SVGImageElement | SVGLineElement | SVGLinearGradientElement | SVGMarkerElement | SVGMaskElement | SVGMetadataElement | SVGPathElement | SVGPatternElement | SVGPolygonElement | SVGPolylineElement | SVGRadialGradientElement | SVGRectElement | SVGStopElement | SVGSwitchElement | SVGTextPathElement | SVGTSpanElement | SVGUseElement | SVGViewElement>;
|
|
10
10
|
export { tmp as Flex };
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
4
4
|
import { ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
5
5
|
export type InlineProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<ViewWithoutListenersProps<AsType>>;
|
|
6
|
-
declare const InlineMemo: import("../../helper/withForwardRef").RefComponent<InlineProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement |
|
|
6
|
+
declare const InlineMemo: import("../../helper/withForwardRef").RefComponent<InlineProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement | HTMLStyleElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLParamElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableDataCellElement | HTMLTextAreaElement | HTMLTableHeaderCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLWebViewElement | SVGSVGElement | SVGCircleElement | SVGClipPathElement | SVGDefsElement | SVGDescElement | SVGEllipseElement | SVGFEBlendElement | SVGFEColorMatrixElement | SVGFEComponentTransferElement | SVGFECompositeElement | SVGFEConvolveMatrixElement | SVGFEDiffuseLightingElement | SVGFEDisplacementMapElement | SVGFEDistantLightElement | SVGFEDropShadowElement | SVGFEFloodElement | SVGFEFuncAElement | SVGFEFuncBElement | SVGFEFuncGElement | SVGFEFuncRElement | SVGFEGaussianBlurElement | SVGFEImageElement | SVGFEMergeElement | SVGFEMergeNodeElement | SVGFEMorphologyElement | SVGFEOffsetElement | SVGFEPointLightElement | SVGFESpecularLightingElement | SVGFESpotLightElement | SVGFETileElement | SVGFETurbulenceElement | SVGFilterElement | SVGForeignObjectElement | SVGGElement | SVGImageElement | SVGLineElement | SVGLinearGradientElement | SVGMarkerElement | SVGMaskElement | SVGMetadataElement | SVGPathElement | SVGPatternElement | SVGPolygonElement | SVGPolylineElement | SVGRadialGradientElement | SVGRectElement | SVGStopElement | SVGSwitchElement | SVGTextPathElement | SVGTSpanElement | SVGUseElement | SVGViewElement>;
|
|
7
7
|
export { InlineMemo as Inline };
|
|
@@ -5,5 +5,5 @@ import { ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
|
5
5
|
export type InlineBlockProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<ViewWithoutListenersProps<AsType> & {
|
|
6
6
|
id?: string;
|
|
7
7
|
}>;
|
|
8
|
-
declare const InlineBlockMemo: import("../../helper/withForwardRef").RefComponent<InlineBlockProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement |
|
|
8
|
+
declare const InlineBlockMemo: import("../../helper/withForwardRef").RefComponent<InlineBlockProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement | HTMLStyleElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLParamElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableDataCellElement | HTMLTextAreaElement | HTMLTableHeaderCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLWebViewElement | SVGSVGElement | SVGCircleElement | SVGClipPathElement | SVGDefsElement | SVGDescElement | SVGEllipseElement | SVGFEBlendElement | SVGFEColorMatrixElement | SVGFEComponentTransferElement | SVGFECompositeElement | SVGFEConvolveMatrixElement | SVGFEDiffuseLightingElement | SVGFEDisplacementMapElement | SVGFEDistantLightElement | SVGFEDropShadowElement | SVGFEFloodElement | SVGFEFuncAElement | SVGFEFuncBElement | SVGFEFuncGElement | SVGFEFuncRElement | SVGFEGaussianBlurElement | SVGFEImageElement | SVGFEMergeElement | SVGFEMergeNodeElement | SVGFEMorphologyElement | SVGFEOffsetElement | SVGFEPointLightElement | SVGFESpecularLightingElement | SVGFESpotLightElement | SVGFETileElement | SVGFETurbulenceElement | SVGFilterElement | SVGForeignObjectElement | SVGGElement | SVGImageElement | SVGLineElement | SVGLinearGradientElement | SVGMarkerElement | SVGMaskElement | SVGMetadataElement | SVGPathElement | SVGPatternElement | SVGPolygonElement | SVGPolylineElement | SVGRadialGradientElement | SVGRectElement | SVGStopElement | SVGSwitchElement | SVGTextPathElement | SVGTSpanElement | SVGUseElement | SVGViewElement>;
|
|
9
9
|
export { InlineBlockMemo as InlineBlock };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentRef, PropsWithChildren,
|
|
2
|
+
import { ComponentRef, PropsWithChildren, ReactNode, RefAttributes } from 'react';
|
|
3
3
|
import { Override } from '../../TypeHelpers';
|
|
4
4
|
export type ViewProps<AsType extends keyof JSX.IntrinsicElements> = PropsWithChildren<Override<React.ComponentPropsWithoutRef<AsType>, {
|
|
5
5
|
as?: AsType;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
}>>;
|
|
8
|
-
declare const ViewMemo: <AsType extends keyof JSX.IntrinsicElements>(props: ViewProps<AsType> & RefAttributes<ComponentRef<AsType>>) =>
|
|
8
|
+
declare const ViewMemo: <AsType extends keyof JSX.IntrinsicElements>(props: ViewProps<AsType> & RefAttributes<ComponentRef<AsType>>) => ReactNode | null;
|
|
9
9
|
export { ViewMemo as View };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentRef, DOMAttributes,
|
|
2
|
+
import { ComponentRef, DOMAttributes, ReactNode, RefAttributes } from 'react';
|
|
3
3
|
import { ViewProps } from './View';
|
|
4
4
|
export type ViewWithoutListenersProps<AsType extends keyof JSX.IntrinsicElements> = Omit<ViewProps<AsType>, keyof DOMAttributes<AsType>> & {
|
|
5
5
|
children?: React.ReactNode;
|
|
@@ -7,5 +7,5 @@ export type ViewWithoutListenersProps<AsType extends keyof JSX.IntrinsicElements
|
|
|
7
7
|
__html: string | TrustedHTML;
|
|
8
8
|
} | undefined;
|
|
9
9
|
};
|
|
10
|
-
declare const ViewWithoutListenersMemo: <AsType extends keyof JSX.IntrinsicElements>(props: ViewWithoutListenersProps<AsType> & RefAttributes<ComponentRef<AsType>>) =>
|
|
10
|
+
declare const ViewWithoutListenersMemo: <AsType extends keyof JSX.IntrinsicElements>(props: ViewWithoutListenersProps<AsType> & RefAttributes<ComponentRef<AsType>>) => ReactNode;
|
|
11
11
|
export { ViewWithoutListenersMemo as ViewWithoutListeners };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainias42/react-bootstrap-mobile",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "Mobile React Components using Bootstrap",
|
|
5
5
|
"main": "dist/bootstrapReactMobile",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "node bin/build.js && webpack",
|
|
9
9
|
"build:production": "node bin/build.js && webpack --env production",
|
|
10
10
|
"update packages": "node bin/updateCopies.js",
|
|
11
|
-
"typecheck": "tsc --
|
|
11
|
+
"typecheck": "tsc --noEmit"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -72,8 +72,7 @@
|
|
|
72
72
|
"style-loader": "^3.3.1",
|
|
73
73
|
"terser-webpack-plugin": "^5.3.1",
|
|
74
74
|
"ts-loader": "^9.2.9",
|
|
75
|
-
"
|
|
76
|
-
"typescript": "^4.5.2",
|
|
75
|
+
"typescript": "^5.2.2",
|
|
77
76
|
"webpack": "^5.72.0",
|
|
78
77
|
"webpack-cli": "^4.9.2",
|
|
79
78
|
"webpack-dev-server": "^4.8.1"
|
|
@@ -4,14 +4,14 @@ import {OptionalListener, useListener} from '../Hooks/useListener';
|
|
|
4
4
|
|
|
5
5
|
import styles from './clickable.scss';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import {useCallback, MouseEvent as ReactMouseEvent, ForwardedRef, useEffect, MouseEvent} from 'react';
|
|
7
|
+
import { useCallback, MouseEvent as ReactMouseEvent, ForwardedRef, useEffect, MouseEvent, PointerEvent } from 'react';
|
|
8
8
|
import {withForwardRef} from '../../helper/withForwardRef';
|
|
9
9
|
import {useComposedRef} from "../Hooks/useComposedRef";
|
|
10
10
|
|
|
11
11
|
type OnClickListener<Data> = OptionalListener<'onClick', Data>;
|
|
12
|
-
type
|
|
13
|
-
type
|
|
14
|
-
type
|
|
12
|
+
type OnPointerDownListener<Data> = OptionalListener<'onPointerDown', Data, PointerEvent>;
|
|
13
|
+
type OnPointerUpListener<Data> = OptionalListener<'onPointerUp', Data, PointerEvent>;
|
|
14
|
+
type OnPointerMoveListener<Data> = OptionalListener<'onPointerMove', Data, PointerEvent>;
|
|
15
15
|
type OnDropListener<Data> = OptionalListener<'onDrop', Data>;
|
|
16
16
|
type OnDragOverListener<Data> = OptionalListener<'onDragOver', Data>;
|
|
17
17
|
|
|
@@ -36,9 +36,9 @@ export type ClickableProps<
|
|
|
36
36
|
stopPropagation?: boolean;
|
|
37
37
|
useReactOnMouseLeave?: boolean;
|
|
38
38
|
} & OnClickListener<OnClickData> &
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
OnPointerDownListener<OnMouseDownData> &
|
|
40
|
+
OnPointerMoveListener<OnMouseMoveData> &
|
|
41
|
+
OnPointerUpListener<OnMouseUpData> &
|
|
42
42
|
OnDropListener<OnDropData> &
|
|
43
43
|
OnDragOverListener<OnDragOverData> &
|
|
44
44
|
OptionalListener<'onClickCapture', OnClickCaptureData> &
|
|
@@ -49,9 +49,9 @@ export type ClickableProps<
|
|
|
49
49
|
|
|
50
50
|
function Clickable<
|
|
51
51
|
OnClickData,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
OnPointerDownData,
|
|
53
|
+
OnPointerMoveData,
|
|
54
|
+
OnPointerUpData,
|
|
55
55
|
OnClickCaptureData,
|
|
56
56
|
OnDropData,
|
|
57
57
|
OnDragOverData,
|
|
@@ -71,7 +71,7 @@ function Clickable<
|
|
|
71
71
|
stopPropagation = true,
|
|
72
72
|
useReactOnMouseLeave = false,
|
|
73
73
|
...clickData
|
|
74
|
-
}: ClickableProps<OnClickData,
|
|
74
|
+
}: ClickableProps<OnClickData, OnPointerDownData, OnPointerMoveData, OnPointerUpData, OnClickCaptureData, OnDropData, OnDragOverData,OnMouseEnterData, OnMouseLeaveData, OnDoubleClickData, HrefType>,
|
|
75
75
|
ref: ForwardedRef<HrefType extends string ? HTMLAnchorElement : HTMLSpanElement>
|
|
76
76
|
) {
|
|
77
77
|
// Variables
|
|
@@ -98,52 +98,52 @@ function Clickable<
|
|
|
98
98
|
[clickData.onClick, onClickInner, preventDefault, stopPropagation]
|
|
99
99
|
);
|
|
100
100
|
|
|
101
|
-
const
|
|
102
|
-
const
|
|
101
|
+
const onPointerDownInner = useListener<'onPointerDown', OnPointerDownData>('onPointerDown', clickData);
|
|
102
|
+
const realOnPointerDown = useCallback(
|
|
103
103
|
(e: ReactMouseEvent) => {
|
|
104
|
-
if (clickData.
|
|
104
|
+
if (clickData.onPointerDown) {
|
|
105
105
|
if (stopPropagation) {
|
|
106
106
|
e.stopPropagation();
|
|
107
107
|
}
|
|
108
108
|
if (preventDefault) {
|
|
109
109
|
e.preventDefault();
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
onPointerDownInner(e);
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
|
-
[clickData.
|
|
114
|
+
[clickData.onPointerDown, onPointerDownInner, preventDefault, stopPropagation]
|
|
115
115
|
);
|
|
116
116
|
|
|
117
|
-
const
|
|
118
|
-
const
|
|
117
|
+
const onPointerMoveInner = useListener<'onPointerMove', OnPointerMoveData>('onPointerMove', clickData);
|
|
118
|
+
const realOnPointerMove = useCallback(
|
|
119
119
|
(e: ReactMouseEvent) => {
|
|
120
|
-
if (clickData.
|
|
120
|
+
if (clickData.onPointerMove) {
|
|
121
121
|
if (stopPropagation) {
|
|
122
122
|
e.stopPropagation();
|
|
123
123
|
}
|
|
124
124
|
if (preventDefault) {
|
|
125
125
|
e.preventDefault();
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
onPointerMoveInner(e);
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
|
-
[clickData.
|
|
130
|
+
[clickData.onPointerMove, onPointerMoveInner, preventDefault, stopPropagation]
|
|
131
131
|
);
|
|
132
132
|
|
|
133
|
-
const
|
|
134
|
-
const
|
|
133
|
+
const onPointerUpInner = useListener<'onPointerUp', OnPointerUpData>('onPointerUp', clickData);
|
|
134
|
+
const realOnPointerUp = useCallback(
|
|
135
135
|
(e: ReactMouseEvent) => {
|
|
136
|
-
if (clickData.
|
|
136
|
+
if (clickData.onPointerUp) {
|
|
137
137
|
if (stopPropagation) {
|
|
138
138
|
e.stopPropagation();
|
|
139
139
|
}
|
|
140
140
|
if (preventDefault) {
|
|
141
141
|
e.preventDefault();
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
onPointerUpInner(e);
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
|
-
[clickData.
|
|
146
|
+
[clickData.onPointerUp, onPointerUpInner, preventDefault, stopPropagation]
|
|
147
147
|
);
|
|
148
148
|
|
|
149
149
|
const onClickCaptureInner = useListener<'onClickCapture', OnClickCaptureData>('onClickCapture', clickData);
|
|
@@ -264,9 +264,9 @@ function Clickable<
|
|
|
264
264
|
'aria-hidden': interactable ? undefined : true,
|
|
265
265
|
className: classNames(styles.clickable, className),
|
|
266
266
|
onClick: realOnClick,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
onPointerDown: realOnPointerDown,
|
|
268
|
+
onPointerMove: realOnPointerMove,
|
|
269
|
+
onPointerUp: realOnPointerUp,
|
|
270
270
|
onClickCapture: realOnClickCapture,
|
|
271
271
|
onDrop: realOnDrop,
|
|
272
272
|
onDragOver: realOnDragOver,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentRef, ForwardedRef, PropsWithChildren, ReactElement, RefAttributes } from 'react';
|
|
2
|
+
import { ComponentRef, ForwardedRef, PropsWithChildren, ReactElement, ReactNode, RefAttributes } from 'react';
|
|
3
3
|
import { Override } from '../../TypeHelpers';
|
|
4
4
|
|
|
5
5
|
export type ViewProps<AsType extends keyof JSX.IntrinsicElements> = PropsWithChildren<
|
|
@@ -36,5 +36,5 @@ function View<AsType extends keyof JSX.IntrinsicElements>(
|
|
|
36
36
|
// Need ViewMemo for autocompletion of phpstorm
|
|
37
37
|
const ViewMemo: <AsType extends keyof JSX.IntrinsicElements>(
|
|
38
38
|
props: ViewProps<AsType> & RefAttributes<ComponentRef<AsType>>
|
|
39
|
-
) =>
|
|
39
|
+
) => ReactNode | null = React.memo(React.forwardRef(View));
|
|
40
40
|
export { ViewMemo as View };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentRef, DOMAttributes, ForwardedRef, ReactElement, RefAttributes } from 'react';
|
|
2
|
+
import { ComponentRef, DOMAttributes, ForwardedRef, ReactElement, ReactNode, RefAttributes } from 'react';
|
|
3
3
|
import { View, ViewProps } from './View';
|
|
4
4
|
|
|
5
5
|
export type ViewWithoutListenersProps<AsType extends keyof JSX.IntrinsicElements> = Omit<
|
|
@@ -40,5 +40,5 @@ function ViewWithoutListeners<AsType extends keyof JSX.IntrinsicElements>(
|
|
|
40
40
|
// Need ViewWithoutListenersMemo for autocompletion of phpstorm
|
|
41
41
|
const ViewWithoutListenersMemo: <AsType extends keyof JSX.IntrinsicElements>(
|
|
42
42
|
props: ViewWithoutListenersProps<AsType> & RefAttributes<ComponentRef<AsType>>
|
|
43
|
-
) =>
|
|
43
|
+
) => ReactNode = React.memo(React.forwardRef(ViewWithoutListeners));
|
|
44
44
|
export { ViewWithoutListenersMemo as ViewWithoutListeners };
|
|
@@ -70,13 +70,17 @@ export const Menu = withMemo(
|
|
|
70
70
|
// Effects
|
|
71
71
|
useEffect(() => {
|
|
72
72
|
if (isOpen) {
|
|
73
|
-
const listener = (e: MouseEvent) => {
|
|
73
|
+
const listener = (e: MouseEvent|TouchEvent) => {
|
|
74
74
|
if (!menuRef.current?.contains(e.target as Node)) {
|
|
75
75
|
onClose();
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
window?.addEventListener('mousedown', listener, {capture: true});
|
|
79
|
-
|
|
79
|
+
window?.addEventListener('touchstart', listener, {capture: true});
|
|
80
|
+
return () => {
|
|
81
|
+
window?.removeEventListener('mousedown', listener, {capture: true})
|
|
82
|
+
window?.removeEventListener('touchstart', listener, {capture: true})
|
|
83
|
+
};
|
|
80
84
|
}
|
|
81
85
|
return undefined;
|
|
82
86
|
}, [isOpen, onClose, window]);
|