@ainias42/react-bootstrap-mobile 0.1.23 → 0.1.25
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 +22 -20
- package/dist/bootstrapReactMobile.js.map +1 -1
- package/dist/src/Components/Clickable/Clickable.d.ts +6 -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 +32 -29
- package/src/Components/Layout/View.tsx +2 -2
- package/src/Components/Layout/ViewWithoutListeners.tsx +2 -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,7 @@ export type ClickableProps<OnClickData, OnMouseDownData, OnMouseMoveData, OnMous
|
|
|
14
14
|
preventDefault?: boolean;
|
|
15
15
|
stopPropagation?: boolean;
|
|
16
16
|
useReactOnMouseLeave?: boolean;
|
|
17
|
-
|
|
17
|
+
id?: string;
|
|
18
|
+
} & 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
19
|
declare const ClickableMemo: import("../../helper/withForwardRef").RefComponent<ClickableProps<unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, string | undefined>, HTMLAnchorElement | HTMLSpanElement>;
|
|
19
20
|
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.25",
|
|
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
|
|
|
@@ -35,10 +35,11 @@ export type ClickableProps<
|
|
|
35
35
|
preventDefault?: boolean;
|
|
36
36
|
stopPropagation?: boolean;
|
|
37
37
|
useReactOnMouseLeave?: boolean;
|
|
38
|
+
id?: string;
|
|
38
39
|
} & OnClickListener<OnClickData> &
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
OnPointerDownListener<OnMouseDownData> &
|
|
41
|
+
OnPointerMoveListener<OnMouseMoveData> &
|
|
42
|
+
OnPointerUpListener<OnMouseUpData> &
|
|
42
43
|
OnDropListener<OnDropData> &
|
|
43
44
|
OnDragOverListener<OnDragOverData> &
|
|
44
45
|
OptionalListener<'onClickCapture', OnClickCaptureData> &
|
|
@@ -49,9 +50,9 @@ export type ClickableProps<
|
|
|
49
50
|
|
|
50
51
|
function Clickable<
|
|
51
52
|
OnClickData,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
OnPointerDownData,
|
|
54
|
+
OnPointerMoveData,
|
|
55
|
+
OnPointerUpData,
|
|
55
56
|
OnClickCaptureData,
|
|
56
57
|
OnDropData,
|
|
57
58
|
OnDragOverData,
|
|
@@ -66,12 +67,13 @@ function Clickable<
|
|
|
66
67
|
style,
|
|
67
68
|
href,
|
|
68
69
|
target,
|
|
70
|
+
id,
|
|
69
71
|
interactable = true,
|
|
70
72
|
preventDefault = false,
|
|
71
73
|
stopPropagation = true,
|
|
72
74
|
useReactOnMouseLeave = false,
|
|
73
75
|
...clickData
|
|
74
|
-
}: ClickableProps<OnClickData,
|
|
76
|
+
}: ClickableProps<OnClickData, OnPointerDownData, OnPointerMoveData, OnPointerUpData, OnClickCaptureData, OnDropData, OnDragOverData,OnMouseEnterData, OnMouseLeaveData, OnDoubleClickData, HrefType>,
|
|
75
77
|
ref: ForwardedRef<HrefType extends string ? HTMLAnchorElement : HTMLSpanElement>
|
|
76
78
|
) {
|
|
77
79
|
// Variables
|
|
@@ -98,52 +100,52 @@ function Clickable<
|
|
|
98
100
|
[clickData.onClick, onClickInner, preventDefault, stopPropagation]
|
|
99
101
|
);
|
|
100
102
|
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
+
const onPointerDownInner = useListener<'onPointerDown', OnPointerDownData>('onPointerDown', clickData);
|
|
104
|
+
const realOnPointerDown = useCallback(
|
|
103
105
|
(e: ReactMouseEvent) => {
|
|
104
|
-
if (clickData.
|
|
106
|
+
if (clickData.onPointerDown) {
|
|
105
107
|
if (stopPropagation) {
|
|
106
108
|
e.stopPropagation();
|
|
107
109
|
}
|
|
108
110
|
if (preventDefault) {
|
|
109
111
|
e.preventDefault();
|
|
110
112
|
}
|
|
111
|
-
|
|
113
|
+
onPointerDownInner(e);
|
|
112
114
|
}
|
|
113
115
|
},
|
|
114
|
-
[clickData.
|
|
116
|
+
[clickData.onPointerDown, onPointerDownInner, preventDefault, stopPropagation]
|
|
115
117
|
);
|
|
116
118
|
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
+
const onPointerMoveInner = useListener<'onPointerMove', OnPointerMoveData>('onPointerMove', clickData);
|
|
120
|
+
const realOnPointerMove = useCallback(
|
|
119
121
|
(e: ReactMouseEvent) => {
|
|
120
|
-
if (clickData.
|
|
122
|
+
if (clickData.onPointerMove) {
|
|
121
123
|
if (stopPropagation) {
|
|
122
124
|
e.stopPropagation();
|
|
123
125
|
}
|
|
124
126
|
if (preventDefault) {
|
|
125
127
|
e.preventDefault();
|
|
126
128
|
}
|
|
127
|
-
|
|
129
|
+
onPointerMoveInner(e);
|
|
128
130
|
}
|
|
129
131
|
},
|
|
130
|
-
[clickData.
|
|
132
|
+
[clickData.onPointerMove, onPointerMoveInner, preventDefault, stopPropagation]
|
|
131
133
|
);
|
|
132
134
|
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
+
const onPointerUpInner = useListener<'onPointerUp', OnPointerUpData>('onPointerUp', clickData);
|
|
136
|
+
const realOnPointerUp = useCallback(
|
|
135
137
|
(e: ReactMouseEvent) => {
|
|
136
|
-
if (clickData.
|
|
138
|
+
if (clickData.onPointerUp) {
|
|
137
139
|
if (stopPropagation) {
|
|
138
140
|
e.stopPropagation();
|
|
139
141
|
}
|
|
140
142
|
if (preventDefault) {
|
|
141
143
|
e.preventDefault();
|
|
142
144
|
}
|
|
143
|
-
|
|
145
|
+
onPointerUpInner(e);
|
|
144
146
|
}
|
|
145
147
|
},
|
|
146
|
-
[clickData.
|
|
148
|
+
[clickData.onPointerUp, onPointerUpInner, preventDefault, stopPropagation]
|
|
147
149
|
);
|
|
148
150
|
|
|
149
151
|
const onClickCaptureInner = useListener<'onClickCapture', OnClickCaptureData>('onClickCapture', clickData);
|
|
@@ -260,13 +262,14 @@ function Clickable<
|
|
|
260
262
|
const props = {
|
|
261
263
|
style,
|
|
262
264
|
target,
|
|
265
|
+
id,
|
|
263
266
|
role: interactable ? 'button' : undefined,
|
|
264
267
|
'aria-hidden': interactable ? undefined : true,
|
|
265
268
|
className: classNames(styles.clickable, className),
|
|
266
269
|
onClick: realOnClick,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
+
onPointerDown: realOnPointerDown,
|
|
271
|
+
onPointerMove: realOnPointerMove,
|
|
272
|
+
onPointerUp: realOnPointerUp,
|
|
270
273
|
onClickCapture: realOnClickCapture,
|
|
271
274
|
onDrop: realOnDrop,
|
|
272
275
|
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 };
|