@aria-ui/tooltip
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -87,2 +87,14 @@ import * as _aria_ui_core from '@aria-ui/core'; | ||
closeDelay: number; | ||
/** | ||
* Whether the popover is open. | ||
* | ||
* @default false | ||
*/ | ||
open: boolean; | ||
/** | ||
* Event handler called then the open state changes because of a user interaction. | ||
* | ||
* @default null | ||
*/ | ||
onOpenChange: ((open: boolean) => void) | null; | ||
} | ||
@@ -95,2 +107,4 @@ /** | ||
closeDelay: 300; | ||
open: false; | ||
onOpenChange: null; | ||
}>; | ||
@@ -97,0 +111,0 @@ |
@@ -54,3 +54,5 @@ // src/tooltip-content.element.gen.ts | ||
openDelay: 700, | ||
closeDelay: 300 | ||
closeDelay: 300, | ||
open: false, | ||
onOpenChange: null | ||
}); | ||
@@ -80,2 +82,8 @@ | ||
const id = nanoid(); | ||
const updateOpen = (value) => { | ||
var _a; | ||
if (open.peek() === value) return; | ||
open.set(value); | ||
(_a = state.onOpenChange.peek()) == null ? void 0 : _a(value); | ||
}; | ||
const check = () => { | ||
@@ -89,3 +97,3 @@ const now = Date.now(); | ||
) { | ||
open.set(true); | ||
updateOpen(true); | ||
if (openingTooltip && openingId !== id) { | ||
@@ -99,3 +107,3 @@ openingTooltip.set(false); | ||
if (now - deactivatedAt >= state.closeDelay.peek()) { | ||
open.set(false); | ||
updateOpen(false); | ||
if (openingId === id) { | ||
@@ -124,3 +132,6 @@ openingTooltip = null; | ||
focusedContext.provide(element, focused); | ||
openContext.provide(element, open); | ||
openContext.provide( | ||
element, | ||
createComputed(() => open.get()) | ||
); | ||
idContext.provide(element, createSignal(id)); | ||
@@ -127,0 +138,0 @@ return state; |
{ | ||
"name": "@aria-ui/tooltip", | ||
"type": "module", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"private": false, | ||
@@ -18,4 +18,9 @@ "sideEffects": false, | ||
"devDependencies": { | ||
"@testing-library/dom": "^10.1.0", | ||
"@testing-library/user-event": "^14.5.2", | ||
"@vitest/browser": "^1.6.0", | ||
"lit-html": "^3.1.4", | ||
"tsup": "^8.1.0", | ||
"typescript": "^5.4.5" | ||
"typescript": "^5.4.5", | ||
"@aria-ui/config": "0.0.0" | ||
}, | ||
@@ -22,0 +27,0 @@ "publishConfig": { |
@@ -54,2 +54,4 @@ # @aria-ui/tooltip | ||
| `closeDelay` | `number` | <p>The delay in milliseconds before the tooltip closes.</p><p>**Default**</p><code>300</code> | | ||
| `onOpenChange` | `null` \| (`open`: `boolean`) => `void` | <p>Event handler called then the open state changes because of a user interaction.</p><p>**Default**</p><code>null</code> | | ||
| `open` | `boolean` | <p>Whether the popover is open.</p><p>**Default**</p><code>false</code> | | ||
| `openDelay` | `number` | <p>The delay in milliseconds before the tooltip opens.</p><p>**Default**</p><code>700</code> | | ||
@@ -56,0 +58,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15775
341
67
7