@etsoo/react 1.4.7 → 1.4.8
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/lib/mu/TooltipClick.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ import React from 'react';
|
|
|
3
3
|
/**
|
|
4
4
|
* Tooltip with click visibility props
|
|
5
5
|
*/
|
|
6
|
-
export interface TooltipClickProps extends Omit<TooltipProps, 'children' | 'open' | 'disableFocusListener' | '
|
|
6
|
+
export interface TooltipClickProps extends Omit<TooltipProps, 'children' | 'open' | 'disableFocusListener' | 'disableTouchListener'> {
|
|
7
7
|
children: (openTooltip: (newTitle?: string) => void) => React.ReactElement<any, any>;
|
|
8
|
+
disableHoverListener?: boolean;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Tooltip with click visibility
|
package/lib/mu/TooltipClick.js
CHANGED
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
export function TooltipClick(props) {
|
|
9
9
|
// Destruct
|
|
10
10
|
// leaveDelay set to 5 seconds to hide the tooltip automatically
|
|
11
|
-
const { children, leaveDelay = 5000, onClose, title, ...rest } = props;
|
|
11
|
+
const { children, disableHoverListener = true, leaveDelay = 5000, onClose, title, ...rest } = props;
|
|
12
12
|
// State
|
|
13
13
|
const [localTitle, setTitle] = React.useState(title);
|
|
14
14
|
const [open, setOpen] = React.useState(false);
|
|
@@ -42,5 +42,5 @@ export function TooltipClick(props) {
|
|
|
42
42
|
setOpen(false);
|
|
43
43
|
if (onClose)
|
|
44
44
|
onClose(event);
|
|
45
|
-
}, title: localTitle, open: open, disableFocusListener: true,
|
|
45
|
+
}, title: localTitle, open: open, disableFocusListener: true, disableTouchListener: true, disableHoverListener: disableHoverListener, ...rest }, children(openTooltip))));
|
|
46
46
|
}
|
|
@@ -10,7 +10,7 @@ export declare type EditPageRouterProps = IdRouterProps & WildcardRouterProps;
|
|
|
10
10
|
* @param type Target data type
|
|
11
11
|
* @returns Data
|
|
12
12
|
*/
|
|
13
|
-
export declare function getEditPageId<T extends DataTypes.BasicNames
|
|
13
|
+
export declare function getEditPageId<T extends DataTypes.BasicNames>(props: EditPageRouterProps, type: T): DataTypes.BasicConditional<T> | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* Id router props, include 'id' (/:id) query parameter
|
|
16
16
|
*/
|
package/package.json
CHANGED
package/src/mu/TooltipClick.tsx
CHANGED
|
@@ -7,15 +7,13 @@ import React from 'react';
|
|
|
7
7
|
export interface TooltipClickProps
|
|
8
8
|
extends Omit<
|
|
9
9
|
TooltipProps,
|
|
10
|
-
| '
|
|
11
|
-
| 'open'
|
|
12
|
-
| 'disableFocusListener'
|
|
13
|
-
| 'disableHoverListener'
|
|
14
|
-
| 'disableTouchListener'
|
|
10
|
+
'children' | 'open' | 'disableFocusListener' | 'disableTouchListener'
|
|
15
11
|
> {
|
|
16
12
|
children: (
|
|
17
13
|
openTooltip: (newTitle?: string) => void
|
|
18
14
|
) => React.ReactElement<any, any>;
|
|
15
|
+
|
|
16
|
+
disableHoverListener?: boolean;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
/**
|
|
@@ -26,7 +24,14 @@ export interface TooltipClickProps
|
|
|
26
24
|
export function TooltipClick(props: TooltipClickProps) {
|
|
27
25
|
// Destruct
|
|
28
26
|
// leaveDelay set to 5 seconds to hide the tooltip automatically
|
|
29
|
-
const {
|
|
27
|
+
const {
|
|
28
|
+
children,
|
|
29
|
+
disableHoverListener = true,
|
|
30
|
+
leaveDelay = 5000,
|
|
31
|
+
onClose,
|
|
32
|
+
title,
|
|
33
|
+
...rest
|
|
34
|
+
} = props;
|
|
30
35
|
|
|
31
36
|
// State
|
|
32
37
|
const [localTitle, setTitle] = React.useState(title);
|
|
@@ -74,8 +79,8 @@ export function TooltipClick(props: TooltipClickProps) {
|
|
|
74
79
|
title={localTitle}
|
|
75
80
|
open={open}
|
|
76
81
|
disableFocusListener
|
|
77
|
-
disableHoverListener
|
|
78
82
|
disableTouchListener
|
|
83
|
+
disableHoverListener={disableHoverListener}
|
|
79
84
|
{...rest}
|
|
80
85
|
>
|
|
81
86
|
{children(openTooltip)}
|
|
@@ -13,7 +13,7 @@ export type EditPageRouterProps = IdRouterProps & WildcardRouterProps;
|
|
|
13
13
|
* @param type Target data type
|
|
14
14
|
* @returns Data
|
|
15
15
|
*/
|
|
16
|
-
export function getEditPageId<T extends DataTypes.BasicNames
|
|
16
|
+
export function getEditPageId<T extends DataTypes.BasicNames>(
|
|
17
17
|
props: EditPageRouterProps,
|
|
18
18
|
type: T
|
|
19
19
|
): DataTypes.BasicConditional<T> | undefined {
|