kitzo 2.1.24 → 2.1.27
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 +1 -1
- package/dist/react/react.esm.js +6 -4
- package/dist/react/types/tooltip.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ npm i kitzo
|
|
|
26
26
|
or
|
|
27
27
|
|
|
28
28
|
```javascript
|
|
29
|
-
<script src="https://cdn.jsdelivr.net/npm/kitzo@2.1.
|
|
29
|
+
<script src="https://cdn.jsdelivr.net/npm/kitzo@2.1.26/dist/kitzo.umd.min.js"></script>
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
> Vanilla: Attach this script tag in the html head tag and you are good to go.
|
package/dist/react/react.esm.js
CHANGED
|
@@ -797,8 +797,6 @@ function Tooltip({
|
|
|
797
797
|
style = {},
|
|
798
798
|
children
|
|
799
799
|
}) {
|
|
800
|
-
const isTouch = window.matchMedia('(pointer: coarse)').matches;
|
|
801
|
-
if (isTouch && finalOptions.hideOnTouch) return children;
|
|
802
800
|
if (typeof content === 'string') {
|
|
803
801
|
if (!content.trim()) throw new Error('kitzo/react: tooltip content is required');
|
|
804
802
|
} else if (!content) {
|
|
@@ -809,16 +807,20 @@ function Tooltip({
|
|
|
809
807
|
position = 'top',
|
|
810
808
|
offset = 8,
|
|
811
809
|
hideOnTouch = true,
|
|
812
|
-
arrow =
|
|
810
|
+
arrow = false,
|
|
813
811
|
smartHover = true
|
|
814
812
|
} = tooltipOptions ?? {};
|
|
815
813
|
const finalOptions = {
|
|
816
814
|
position: typeof position === 'string' ? position.trim().toLowerCase() : 'top',
|
|
817
815
|
offset: !isNaN(Number(offset)) ? Number(offset) : 8,
|
|
818
|
-
arrow: typeof arrow === 'boolean' ? arrow :
|
|
816
|
+
arrow: typeof arrow === 'boolean' ? arrow : false,
|
|
819
817
|
smartHover: typeof smartHover === 'boolean' ? smartHover : true,
|
|
820
818
|
hideOnTouch: typeof hideOnTouch === 'boolean' ? hideOnTouch : true
|
|
821
819
|
};
|
|
820
|
+
|
|
821
|
+
// Hide on touch device
|
|
822
|
+
const isTouch = window.matchMedia('(pointer: coarse)').matches;
|
|
823
|
+
if (isTouch && finalOptions.hideOnTouch) return children;
|
|
822
824
|
const positionClass = getPositionClass(finalOptions.position);
|
|
823
825
|
|
|
824
826
|
// Define animations
|