zero-tooltip 1.4.3 → 2.0.0
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/README.md +152 -152
- package/dist/types/tooltipConfig.d.ts +51 -0
- package/dist/types/tooltipLocalConfig.d.ts +10 -0
- package/dist/zero-tooltip.js +83 -79
- package/dist/zero-tooltip.umd.cjs +1 -1
- package/package.json +65 -65
- package/src/composables/useHideOnResize.ts +38 -38
- package/src/composables/useHideOnScroll.ts +60 -60
- package/src/composables/useRepositionOnResize.ts +16 -16
- package/src/index.ts +27 -27
- package/src/tooltip.ts +711 -691
- package/src/types/scrollContainer.ts +5 -5
- package/src/types/tooltipConfig.ts +91 -24
- package/src/types/tooltipLocalConfig.ts +21 -9
- package/src/types/tooltipPosition.ts +4 -4
- package/src/types/tooltipPositions.ts +10 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type ScrollContainer = {
|
|
2
|
-
'element': HTMLElement | Window,
|
|
3
|
-
'eventController': AbortController
|
|
4
|
-
}
|
|
5
|
-
|
|
1
|
+
export type ScrollContainer = {
|
|
2
|
+
'element': HTMLElement | Window,
|
|
3
|
+
'eventController': AbortController
|
|
4
|
+
}
|
|
5
|
+
|
|
6
6
|
export type ScrollContainers = ScrollContainer[]
|
|
@@ -1,24 +1,91 @@
|
|
|
1
|
-
import TooltipPosition from "./tooltipPosition"
|
|
2
|
-
import TooltipPositions from "./tooltipPositions"
|
|
3
|
-
|
|
4
|
-
type TooltipConfig = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import TooltipPosition from "./tooltipPosition"
|
|
2
|
+
import TooltipPositions from "./tooltipPositions"
|
|
3
|
+
|
|
4
|
+
type TooltipConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* A valid CSS query selector to specify where Tooltip gets appended.
|
|
7
|
+
*/
|
|
8
|
+
appendTo?: string,
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Position of tooltip component relative to element that is being hovered.
|
|
12
|
+
*/
|
|
13
|
+
defaultPosition?: TooltipPosition,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Ordered list of fallback positions in case tooltip does not have enough space in default position. If none of given positions will have enough space for tooltip, then it will not be rendered.
|
|
17
|
+
*/
|
|
18
|
+
positions?: Partial<TooltipPositions>,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Tooltip offset in px from element that's being hovered *(arrow size is not added to this value)*
|
|
22
|
+
*/
|
|
23
|
+
offsetFromSource?: number,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Minimal allowed tooltip offset in `px` from viewport sides
|
|
27
|
+
*/
|
|
28
|
+
offsetFromViewport?: number,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Minimal tooltip width in `px` that will be allowed to render
|
|
32
|
+
*/
|
|
33
|
+
minWidth?: number,
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Maximal tooltip width in `px` that will be allowed to render
|
|
37
|
+
*/
|
|
38
|
+
maxWidth?: number,
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Tooltip container border width in `px`
|
|
42
|
+
*/
|
|
43
|
+
tooltipBorderWidth?: number,
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* List of classes that will be added to tooltip element
|
|
47
|
+
*/
|
|
48
|
+
tooltipClasses?: string,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* List of classes that will be added to text element
|
|
52
|
+
*/
|
|
53
|
+
textClasses?: string,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Length of arrow hypotenuse in `px` (arrow is generated using border width property, creating square which gets divided in four triangles, thus `arrowSize` is length of square side)
|
|
57
|
+
*/
|
|
58
|
+
arrowSize?: number,
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* List of classes that will be added to arrow element
|
|
62
|
+
*/
|
|
63
|
+
arrowClasses?: string,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Minimal allowed arrow offset in `px` from tooltip corner. Used in situations when tooltip does not have enough space to be centered relative to element that is being hover, thus arrow is rendered closer to one of the tooltip corners
|
|
67
|
+
*/
|
|
68
|
+
arrowMinOffsetFromTooltipCorner?: number,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* `z-index` css property value of tooltip
|
|
72
|
+
*/
|
|
73
|
+
zIndex?: number | string,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Delay in milliseconds after which to show tooltip while hovering over element
|
|
77
|
+
*/
|
|
78
|
+
showDelay?: number,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Delay in milliseconds after which to hide tooltip when leaving element boundaries
|
|
82
|
+
*/
|
|
83
|
+
hideDelay?: number,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Whether to show warning about empty tooltip text value in cases when tooltip was expected to be shown
|
|
87
|
+
*/
|
|
88
|
+
showWarnings?: boolean,
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default TooltipConfig
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import TooltipConfig from "./tooltipConfig"
|
|
2
|
-
|
|
3
|
-
type TooltipLocalConfig = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import TooltipConfig from "./tooltipConfig"
|
|
2
|
+
|
|
3
|
+
type TooltipLocalConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* Tooltip text. Text is rendered as HTML, thus it's possible to give simple HTML structure, e.g., `<h1>Tooltip text</h1>`
|
|
6
|
+
*/
|
|
7
|
+
content: string,
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Define whether tooltip should be shown on hover (enabled/disabled). Default value is `false` if `alwaysOn` is set, otherwise it's `true`.
|
|
11
|
+
*/
|
|
12
|
+
show?: boolean,
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Define whether to show tooltip (on mount) without needing hover trigger
|
|
16
|
+
* If `alwaysOn` is set, `show` will be set to `false` by default.
|
|
17
|
+
*/
|
|
18
|
+
alwaysOn?: boolean,
|
|
19
|
+
} & TooltipConfig
|
|
20
|
+
|
|
21
|
+
export default TooltipLocalConfig
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type TooltipPosition = 'left' | 'top' | 'right' | 'bottom'
|
|
2
|
-
|
|
3
|
-
export default TooltipPosition
|
|
4
|
-
|
|
1
|
+
type TooltipPosition = 'left' | 'top' | 'right' | 'bottom'
|
|
2
|
+
|
|
3
|
+
export default TooltipPosition
|
|
4
|
+
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import TooltipPosition from "./tooltipPosition"
|
|
2
|
-
|
|
3
|
-
type TooltipPositions = {
|
|
4
|
-
left: [ TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition]
|
|
5
|
-
top: [ TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition]
|
|
6
|
-
right: [ TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition]
|
|
7
|
-
bottom: [ TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default TooltipPositions
|
|
1
|
+
import TooltipPosition from "./tooltipPosition"
|
|
2
|
+
|
|
3
|
+
type TooltipPositions = {
|
|
4
|
+
left: [ TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition]
|
|
5
|
+
top: [ TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition]
|
|
6
|
+
right: [ TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition]
|
|
7
|
+
bottom: [ TooltipPosition, TooltipPosition, TooltipPosition, TooltipPosition]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default TooltipPositions
|