@versini/ui-tooltip 2.1.4 → 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 CHANGED
@@ -1,17 +1,28 @@
1
1
  # @versini/ui-tooltip
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@versini/ui-tooltip?style=flat-square)](https://www.npmjs.com/package/@versini/ui-tooltip)
4
+ ![npm package minimized gzipped size](<https://img.shields.io/bundlejs/size/%40versini%2Fui-tooltip?style=flat-square&label=size%20(gzip)>)
4
5
 
5
6
  > An accessible React tooltip component built with TypeScript and TailwindCSS.
6
7
 
7
- The Tooltip component provides contextual help and information with proper accessibility support and customizable positioning.
8
-
8
+ The Tooltip component provides contextual help and information with proper accessibility support, adaptive placement, delayed appearance, and theme awareness.
9
9
 
10
10
  ## Table of Contents
11
11
 
12
12
  - [Features](#features)
13
13
  - [Installation](#installation)
14
14
  - [Usage](#usage)
15
+ - [Examples](#examples)
16
+ - [API](#api)
17
+
18
+ ## Features
19
+
20
+ - **🧭 Smart Positioning**: Uses Floating UI for collision-aware placement & arrow positioning
21
+ - **⏱️ Show Delay**: Configurable appearance delay (`delay` prop)
22
+ - **♿ Accessible**: Proper `role="tooltip"`, hover & focus behavior, optional disabling period
23
+ - **🎨 Theming**: Supports light / dark / system / alt-system modes
24
+ - **🪶 Lightweight**: Minimal DOM & style footprint; only renders when visible
25
+ - **⚡ Adaptive**: Auto flips / shifts to remain within viewport
15
26
 
16
27
  ## Installation
17
28
 
@@ -19,7 +30,7 @@ The Tooltip component provides contextual help and information with proper acces
19
30
  npm install @versini/ui-tooltip
20
31
  ```
21
32
 
22
- > **Note**: This component requires TailwindCSS and the `@versini/ui-styles` plugin for proper styling. See the [root README](../../README.md#tailwindcss-setup) for complete setup instructions.
33
+ > **Note**: This component requires TailwindCSS and the `@versini/ui-styles` plugin for proper styling. See the [installation documentation](https://versini-org.github.io/ui-components/?path=/docs/getting-started-installation--docs) for complete setup instructions.
23
34
 
24
35
  ## Usage
25
36
 
@@ -27,10 +38,62 @@ npm install @versini/ui-tooltip
27
38
  import { Tooltip } from "@versini/ui-tooltip";
28
39
 
29
40
  function App() {
30
- return (
31
- <Tooltip content="This is a helpful tooltip">
32
- <button>Hover me</button>
33
- </Tooltip>
34
- );
41
+ return <Tooltip label="Helpful tip" trigger={<button>Hover me</button>} />;
35
42
  }
36
43
  ```
44
+
45
+ ## Examples
46
+
47
+ ### Different Placements
48
+
49
+ ```tsx
50
+ <div className="flex flex-wrap gap-4">
51
+ <Tooltip label="Top" placement="top" trigger={<button>Top</button>} />
52
+ <Tooltip label="Right" placement="right" trigger={<button>Right</button>} />
53
+ <Tooltip
54
+ label="Bottom"
55
+ placement="bottom"
56
+ trigger={<button>Bottom</button>}
57
+ />
58
+ <Tooltip label="Left" placement="left" trigger={<button>Left</button>} />
59
+ </div>
60
+ ```
61
+
62
+ ### Custom Delay & Dark Mode
63
+
64
+ ```tsx
65
+ <Tooltip
66
+ label="Appears after 1s"
67
+ delay={1000}
68
+ mode="dark"
69
+ trigger={<button>Delayed</button>}
70
+ />
71
+ ```
72
+
73
+ ### Styling the Tooltip & Arrow
74
+
75
+ ```tsx
76
+ <Tooltip
77
+ label="Custom styled"
78
+ tooltipClassName="bg-indigo-600 text-white text-sm"
79
+ arrowClassName="bg-indigo-600"
80
+ trigger={<button>Custom</button>}
81
+ />
82
+ ```
83
+
84
+ ## API
85
+
86
+ ### Tooltip Props
87
+
88
+ | Prop | Type | Default | Description |
89
+ | ------------------ | --------------------------------------- | ------- | -------------------------------------------------- | ------------- | ---------- | ------------------------------ |
90
+ | `label` | `string` | - | Text content of the tooltip. |
91
+ | `trigger` | `React.ReactNode` | - | Element that the tooltip is anchored to. |
92
+ | `placement` | `Placement` (from `@floating-ui/react`) | `"top"` | Preferred initial placement (auto flips / shifts). |
93
+ | `mode` | `"dark" | "light" | "system" | "alt-system"` | `"system"` | Theme mode controlling colors. |
94
+ | `delay` | `number` | `300` | Milliseconds before showing tooltip. |
95
+ | `className` | `string` | - | Extra classes for outer wrapper. |
96
+ | `tooltipClassName` | `string` | - | Extra classes for tooltip bubble. |
97
+ | `arrowClassName` | `string` | - | Extra classes for tooltip arrow element. |
98
+
99
+ > Tooltip appears on hover/focus, hides on leave/click, and temporarily disables after click to prevent flicker.
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { TOOLTIP_ARROW_CLASSNAME as T, TOOLTIP_CLASSNAME as I, Tooltip as e } from "./components/Tooltip/Tooltip.js";
2
2
  /*!
3
- @versini/ui-tooltip v2.1.4
3
+ @versini/ui-tooltip v2.1.6
4
4
  © 2025 gizmette.com
5
5
  */
6
6
  try {
7
7
  window.__VERSINI_UI_TOOLTIP__ || (window.__VERSINI_UI_TOOLTIP__ = {
8
- version: "2.1.4",
9
- buildTime: "08/23/2025 09:10 AM EDT",
8
+ version: "2.1.6",
9
+ buildTime: "08/23/2025 12:24 PM EDT",
10
10
  homepage: "https://github.com/aversini/ui-components",
11
11
  license: "MIT"
12
12
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-tooltip",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -54,5 +54,5 @@
54
54
  "sideEffects": [
55
55
  "**/*.css"
56
56
  ],
57
- "gitHead": "7bbfa99a4441ef5b0828a37d190f694e199b663d"
57
+ "gitHead": "d568e20474c6c87f836c4cb6548f2cc0143a353c"
58
58
  }