@zag-js/tooltip 1.47.0 → 1.48.0
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/dist/index.d.mts +6 -9
- package/dist/index.d.ts +6 -9
- package/dist/index.js +12 -38
- package/dist/index.mjs +2 -7
- package/dist/tooltip.anatomy.d.mts +2 -6
- package/dist/tooltip.anatomy.d.ts +2 -6
- package/dist/tooltip.anatomy.js +8 -33
- package/dist/tooltip.anatomy.mjs +4 -7
- package/dist/tooltip.connect.d.mts +4 -8
- package/dist/tooltip.connect.d.ts +4 -8
- package/dist/tooltip.connect.js +179 -186
- package/dist/tooltip.connect.mjs +173 -149
- package/dist/tooltip.dom.d.mts +11 -14
- package/dist/tooltip.dom.d.ts +11 -14
- package/dist/tooltip.dom.js +31 -65
- package/dist/tooltip.dom.mjs +17 -30
- package/dist/tooltip.machine.d.mts +2 -8
- package/dist/tooltip.machine.d.ts +2 -8
- package/dist/tooltip.machine.js +423 -465
- package/dist/tooltip.machine.mjs +416 -427
- package/dist/tooltip.props.d.mts +3 -9
- package/dist/tooltip.props.d.ts +3 -9
- package/dist/tooltip.props.js +29 -54
- package/dist/tooltip.props.mjs +25 -28
- package/dist/tooltip.store.d.mts +5 -9
- package/dist/tooltip.store.d.ts +5 -9
- package/dist/tooltip.store.js +9 -33
- package/dist/tooltip.store.mjs +6 -8
- package/dist/tooltip.types.d.mts +146 -149
- package/dist/tooltip.types.d.ts +146 -149
- package/dist/tooltip.types.js +4 -18
- package/dist/tooltip.types.mjs +1 -0
- package/package.json +10 -10
package/dist/tooltip.types.d.ts
CHANGED
|
@@ -1,157 +1,154 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
interface OpenChangeDetails {
|
|
7
|
-
open: boolean;
|
|
1
|
+
import { EventObject, Machine, Service } from "@zag-js/core";
|
|
2
|
+
import { CommonProperties, DirectionProperty, PropTypes, RequiredBy } from "@zag-js/types";
|
|
3
|
+
import { Placement, PositioningOptions } from "@zag-js/popper";
|
|
4
|
+
export interface OpenChangeDetails {
|
|
5
|
+
open: boolean;
|
|
8
6
|
}
|
|
9
|
-
interface TriggerValueChangeDetails {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
export interface TriggerValueChangeDetails {
|
|
8
|
+
/**
|
|
9
|
+
* The value of the trigger
|
|
10
|
+
*/
|
|
11
|
+
value: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* The trigger element
|
|
14
|
+
*/
|
|
15
|
+
triggerElement: HTMLElement | null;
|
|
18
16
|
}
|
|
19
|
-
interface ElementIds {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
export interface ElementIds {
|
|
18
|
+
trigger?: (string | ((value?: string) => string)) | undefined;
|
|
19
|
+
content?: string | undefined;
|
|
20
|
+
arrow?: string | undefined;
|
|
21
|
+
positioner?: string | undefined;
|
|
24
22
|
}
|
|
25
|
-
interface TooltipProps extends DirectionProperty, CommonProperties {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
23
|
+
export interface TooltipProps extends DirectionProperty, CommonProperties {
|
|
24
|
+
/**
|
|
25
|
+
* The ids of the elements in the tooltip. Useful for composition.
|
|
26
|
+
*/
|
|
27
|
+
ids?: ElementIds | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The open delay of the tooltip.
|
|
30
|
+
* @default 400
|
|
31
|
+
*/
|
|
32
|
+
openDelay?: number | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The close delay of the tooltip.
|
|
35
|
+
* @default 150
|
|
36
|
+
*/
|
|
37
|
+
closeDelay?: number | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Whether to close the tooltip on pointerdown.
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
closeOnPointerDown?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to close the tooltip when the Escape key is pressed.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
closeOnEscape?: boolean | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the tooltip should close on scroll
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
closeOnScroll?: boolean | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the tooltip should close on click
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
closeOnClick?: boolean | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the tooltip's content is interactive.
|
|
60
|
+
* In this mode, the tooltip will remain open when user hovers over the content.
|
|
61
|
+
* @see https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
interactive?: boolean | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Function called when the tooltip is opened.
|
|
68
|
+
*/
|
|
69
|
+
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Custom label for the tooltip.
|
|
72
|
+
*/
|
|
73
|
+
"aria-label"?: string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* The user provided options used to position the popover content
|
|
76
|
+
*/
|
|
77
|
+
positioning?: PositioningOptions | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the tooltip is disabled
|
|
80
|
+
*/
|
|
81
|
+
disabled?: boolean | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* The controlled open state of the tooltip
|
|
84
|
+
*/
|
|
85
|
+
open?: boolean | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* The initial open state of the tooltip when rendered.
|
|
88
|
+
* Use when you don't need to control the open state of the tooltip.
|
|
89
|
+
*/
|
|
90
|
+
defaultOpen?: boolean | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* The controlled trigger value
|
|
93
|
+
*/
|
|
94
|
+
triggerValue?: string | null | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* The initial trigger value when rendered.
|
|
97
|
+
* Use when you don't need to control the trigger value.
|
|
98
|
+
*/
|
|
99
|
+
defaultTriggerValue?: string | null | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Function called when the trigger value changes.
|
|
102
|
+
*/
|
|
103
|
+
onTriggerValueChange?: ((details: TriggerValueChangeDetails) => void) | undefined;
|
|
106
104
|
}
|
|
107
105
|
type PropsWithDefault = "openDelay" | "closeDelay" | "closeOnPointerDown" | "closeOnEscape" | "closeOnScroll" | "closeOnClick" | "interactive" | "id" | "positioning";
|
|
108
|
-
interface TooltipSchema {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
export interface TooltipSchema {
|
|
107
|
+
state: "open" | "closed" | "opening" | "closing";
|
|
108
|
+
props: RequiredBy<TooltipProps, PropsWithDefault>;
|
|
109
|
+
context: {
|
|
110
|
+
currentPlacement: Placement | undefined;
|
|
111
|
+
hasPointerMoveOpened: string | null;
|
|
112
|
+
triggerValue: string | null;
|
|
113
|
+
};
|
|
114
|
+
event: EventObject;
|
|
115
|
+
action: string;
|
|
116
|
+
effect: string;
|
|
117
|
+
guard: string;
|
|
120
118
|
}
|
|
121
|
-
type TooltipService = Service<TooltipSchema>;
|
|
122
|
-
type TooltipMachine = Machine<TooltipSchema>;
|
|
123
|
-
interface TriggerProps {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
export type TooltipService = Service<TooltipSchema>;
|
|
120
|
+
export type TooltipMachine = Machine<TooltipSchema>;
|
|
121
|
+
export interface TriggerProps {
|
|
122
|
+
/**
|
|
123
|
+
* The value that identifies this specific trigger
|
|
124
|
+
*/
|
|
125
|
+
value?: string;
|
|
128
126
|
}
|
|
129
|
-
interface TooltipApi<T extends PropTypes = PropTypes> {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
127
|
+
export interface TooltipApi<T extends PropTypes = PropTypes> {
|
|
128
|
+
/**
|
|
129
|
+
* Whether the tooltip is open.
|
|
130
|
+
*/
|
|
131
|
+
open: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Function to open the tooltip.
|
|
134
|
+
*/
|
|
135
|
+
setOpen: (open: boolean) => void;
|
|
136
|
+
/**
|
|
137
|
+
* The trigger value
|
|
138
|
+
*/
|
|
139
|
+
triggerValue: string | null;
|
|
140
|
+
/**
|
|
141
|
+
* Function to set the trigger value
|
|
142
|
+
*/
|
|
143
|
+
setTriggerValue: (value: string | null) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Function to reposition the popover
|
|
146
|
+
*/
|
|
147
|
+
reposition: (options?: Partial<PositioningOptions>) => void;
|
|
148
|
+
getTriggerProps: (props?: TriggerProps) => T["button"];
|
|
149
|
+
getArrowProps: () => T["element"];
|
|
150
|
+
getArrowTipProps: () => T["element"];
|
|
151
|
+
getPositionerProps: () => T["element"];
|
|
152
|
+
getContentProps: () => T["element"];
|
|
155
153
|
}
|
|
156
|
-
|
|
157
|
-
export type { ElementIds, OpenChangeDetails, TooltipApi, TooltipMachine, TooltipProps, TooltipSchema, TooltipService, TriggerProps, TriggerValueChangeDetails };
|
|
154
|
+
export type { Placement, PositioningOptions };
|
package/dist/tooltip.types.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/tooltip.types.ts
|
|
17
|
-
var tooltip_types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(tooltip_types_exports);
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
package/dist/tooltip.types.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/tooltip",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.0",
|
|
4
4
|
"description": "Core logic for the tooltip widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/anatomy": "1.
|
|
33
|
-
"@zag-js/core": "1.
|
|
34
|
-
"@zag-js/popper": "1.
|
|
35
|
-
"@zag-js/focus-visible": "1.
|
|
36
|
-
"@zag-js/dom-query": "1.
|
|
37
|
-
"@zag-js/utils": "1.
|
|
38
|
-
"@zag-js/types": "1.
|
|
32
|
+
"@zag-js/anatomy": "1.48.0",
|
|
33
|
+
"@zag-js/core": "1.48.0",
|
|
34
|
+
"@zag-js/popper": "1.48.0",
|
|
35
|
+
"@zag-js/focus-visible": "1.48.0",
|
|
36
|
+
"@zag-js/dom-query": "1.48.0",
|
|
37
|
+
"@zag-js/utils": "1.48.0",
|
|
38
|
+
"@zag-js/types": "1.48.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"clean-package": "2.2.0"
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"./package.json": "./package.json"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
|
-
"build": "
|
|
72
|
-
"lint": "
|
|
71
|
+
"build": "tsdown",
|
|
72
|
+
"lint": "oxlint src",
|
|
73
73
|
"typecheck": "tsc --noEmit"
|
|
74
74
|
}
|
|
75
75
|
}
|