kitzo 2.1.5 → 2.1.6
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 +3 -3
- package/dist/react.esm.js +5 -0
- 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.6/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.
|
|
@@ -248,7 +248,7 @@ function App() {
|
|
|
248
248
|
<h1>Tooltip api</h1>
|
|
249
249
|
|
|
250
250
|
<div>
|
|
251
|
-
<Tooltip content="Tooltip" position="top" offset="10">
|
|
251
|
+
<Tooltip content="Tooltip" position="top" offset="10" hideOnTouch={true}>
|
|
252
252
|
<button>Hover me</button>
|
|
253
253
|
</Tooltip>
|
|
254
254
|
</div>
|
|
@@ -257,4 +257,4 @@ function App() {
|
|
|
257
257
|
}
|
|
258
258
|
```
|
|
259
259
|
|
|
260
|
-
>
|
|
260
|
+
> You can provide your own custom jsx element as `content`. e.g. `content={<div>Custom tooltip</div>}`
|
package/dist/react.esm.js
CHANGED
|
@@ -657,8 +657,13 @@ function Tooltip({
|
|
|
657
657
|
content = 'Tooltip',
|
|
658
658
|
position = '',
|
|
659
659
|
offset = 8,
|
|
660
|
+
hideOnTouch = true,
|
|
660
661
|
children
|
|
661
662
|
}) {
|
|
663
|
+
if (typeof hideOnTouch !== 'boolean') hideOnTouch = true;
|
|
664
|
+
const isTouch = window.matchMedia('(pointer: coarse)').matches;
|
|
665
|
+
if (isTouch && hideOnTouch) return children;
|
|
666
|
+
|
|
662
667
|
// sanitize props
|
|
663
668
|
if (typeof position !== 'string') {
|
|
664
669
|
console.warn(`[kitzo/react]: Tooltip position ignored due to invalid data type.`);
|