kitzo 2.1.5 → 2.1.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/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.5/dist/kitzo.umd.min.js"></script>
29
+ <script src="https://cdn.jsdelivr.net/npm/kitzo@2.1.8/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
- > what short description about this api need to written here bro?
260
+ > You can provide your own custom jsx element as `content`. e.g. `content={<div>Custom tooltip</div>}`
package/dist/react.d.ts CHANGED
@@ -35,6 +35,7 @@ export interface TooltipProps {
35
35
  content: string | ReactNode;
36
36
  position?: 'top' | 'right' | 'bottom' | 'left';
37
37
  offset?: number;
38
+ hideOnTouch?: boolean;
38
39
  }
39
40
 
40
41
  export declare function Tooltip(props: TooltipProps): JSX.Element;
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.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitzo",
3
- "version": "2.1.5",
3
+ "version": "2.1.8",
4
4
  "description": "A lightweight JavaScript UI micro-library.",
5
5
  "type": "module",
6
6
  "main": "./dist/kitzo.umd.js",