@zag-js/tooltip 0.82.1 → 1.0.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 +33 -40
- package/dist/index.d.ts +33 -40
- package/dist/index.js +374 -347
- package/dist/index.mjs +378 -351
- package/package.json +17 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _zag_js_anatomy from '@zag-js/anatomy';
|
|
2
|
-
import { RequiredBy, PropTypes, DirectionProperty, CommonProperties, NormalizeProps } from '@zag-js/types';
|
|
3
2
|
import * as _zag_js_core from '@zag-js/core';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Service, EventObject } from '@zag-js/core';
|
|
4
|
+
import { DirectionProperty, CommonProperties, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
|
|
5
|
+
import { PositioningOptions, Placement } from '@zag-js/popper';
|
|
6
6
|
export { Placement, PositioningOptions } from '@zag-js/popper';
|
|
7
7
|
|
|
8
8
|
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"trigger" | "arrow" | "arrowTip" | "positioner" | "content">;
|
|
@@ -16,30 +16,26 @@ type ElementIds = Partial<{
|
|
|
16
16
|
arrow: string;
|
|
17
17
|
positioner: string;
|
|
18
18
|
}>;
|
|
19
|
-
interface
|
|
19
|
+
interface TooltipProps extends DirectionProperty, CommonProperties {
|
|
20
20
|
/**
|
|
21
21
|
* The ids of the elements in the tooltip. Useful for composition.
|
|
22
22
|
*/
|
|
23
23
|
ids?: ElementIds | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* The `id` of the tooltip.
|
|
26
|
-
*/
|
|
27
|
-
id: string;
|
|
28
24
|
/**
|
|
29
25
|
* The open delay of the tooltip.
|
|
30
26
|
* @default 1000
|
|
31
27
|
*/
|
|
32
|
-
openDelay
|
|
28
|
+
openDelay?: number | undefined;
|
|
33
29
|
/**
|
|
34
30
|
* The close delay of the tooltip.
|
|
35
31
|
* @default 500
|
|
36
32
|
*/
|
|
37
|
-
closeDelay
|
|
33
|
+
closeDelay?: number | undefined;
|
|
38
34
|
/**
|
|
39
35
|
* Whether to close the tooltip on pointerdown.
|
|
40
36
|
* @default true
|
|
41
37
|
*/
|
|
42
|
-
closeOnPointerDown
|
|
38
|
+
closeOnPointerDown?: boolean | undefined;
|
|
43
39
|
/**
|
|
44
40
|
* Whether to close the tooltip when the Escape key is pressed.
|
|
45
41
|
* @default true
|
|
@@ -62,11 +58,11 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
62
58
|
*
|
|
63
59
|
* @default false
|
|
64
60
|
*/
|
|
65
|
-
interactive
|
|
61
|
+
interactive?: boolean | undefined;
|
|
66
62
|
/**
|
|
67
63
|
* Function called when the tooltip is opened.
|
|
68
64
|
*/
|
|
69
|
-
onOpenChange
|
|
65
|
+
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
70
66
|
/**
|
|
71
67
|
* Custom label for the tooltip.
|
|
72
68
|
*/
|
|
@@ -74,39 +70,36 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
74
70
|
/**
|
|
75
71
|
* The user provided options used to position the popover content
|
|
76
72
|
*/
|
|
77
|
-
positioning
|
|
73
|
+
positioning?: PositioningOptions | undefined;
|
|
78
74
|
/**
|
|
79
75
|
* Whether the tooltip is disabled
|
|
80
76
|
*/
|
|
81
77
|
disabled?: boolean | undefined;
|
|
82
78
|
/**
|
|
83
|
-
*
|
|
79
|
+
* The controlled open state of the tooltip
|
|
84
80
|
*/
|
|
85
81
|
open?: boolean | undefined;
|
|
86
82
|
/**
|
|
87
|
-
*
|
|
83
|
+
* The initial open state of the tooltip when rendered.
|
|
84
|
+
* Use when you don't need to control the open state of the tooltip.
|
|
88
85
|
*/
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
92
|
-
type ComputedContext = Readonly<{
|
|
93
|
-
/**
|
|
94
|
-
* @computed Whether an `aria-label` is set.
|
|
95
|
-
*/
|
|
96
|
-
hasAriaLabel: boolean;
|
|
97
|
-
}>;
|
|
98
|
-
interface PrivateContext {
|
|
99
|
-
}
|
|
100
|
-
interface MachineContext extends PublicContext, ComputedContext, PrivateContext {
|
|
86
|
+
defaultOpen?: boolean | undefined;
|
|
101
87
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
type PropsWithDefault = "openDelay" | "closeDelay" | "closeOnPointerDown" | "closeOnEscape" | "closeOnScroll" | "closeOnClick" | "interactive" | "id";
|
|
89
|
+
interface TooltipSchema {
|
|
90
|
+
state: "open" | "closed" | "opening" | "closing";
|
|
91
|
+
props: RequiredBy<TooltipProps, PropsWithDefault>;
|
|
92
|
+
context: {
|
|
93
|
+
currentPlacement: Placement | undefined;
|
|
94
|
+
hasPointerMoveOpened: boolean;
|
|
95
|
+
};
|
|
96
|
+
event: EventObject;
|
|
97
|
+
action: string;
|
|
98
|
+
effect: string;
|
|
99
|
+
guard: string;
|
|
105
100
|
}
|
|
106
|
-
type
|
|
107
|
-
|
|
108
|
-
type Service = Machine<MachineContext, MachineState, StateMachine.AnyEventObject>;
|
|
109
|
-
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
101
|
+
type TooltipService = Service<TooltipSchema>;
|
|
102
|
+
interface TooltipApi<T extends PropTypes = PropTypes> {
|
|
110
103
|
/**
|
|
111
104
|
* Whether the tooltip is open.
|
|
112
105
|
*/
|
|
@@ -126,11 +119,11 @@ interface MachineApi<T extends PropTypes = PropTypes> {
|
|
|
126
119
|
getContentProps(): T["element"];
|
|
127
120
|
}
|
|
128
121
|
|
|
129
|
-
declare function connect<
|
|
122
|
+
declare function connect<P extends PropTypes>(service: Service<TooltipSchema>, normalize: NormalizeProps<P>): TooltipApi<P>;
|
|
130
123
|
|
|
131
|
-
declare
|
|
124
|
+
declare const machine: _zag_js_core.MachineConfig<TooltipSchema>;
|
|
132
125
|
|
|
133
|
-
declare const props: (
|
|
134
|
-
declare const splitProps: <Props extends Partial<
|
|
126
|
+
declare const props: (keyof TooltipProps)[];
|
|
127
|
+
declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
|
|
135
128
|
|
|
136
|
-
export { type
|
|
129
|
+
export { type TooltipApi as Api, type ElementIds, type OpenChangeDetails, type TooltipProps as Props, type TooltipService as Service, anatomy, connect, machine, props, splitProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _zag_js_anatomy from '@zag-js/anatomy';
|
|
2
|
-
import { RequiredBy, PropTypes, DirectionProperty, CommonProperties, NormalizeProps } from '@zag-js/types';
|
|
3
2
|
import * as _zag_js_core from '@zag-js/core';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Service, EventObject } from '@zag-js/core';
|
|
4
|
+
import { DirectionProperty, CommonProperties, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
|
|
5
|
+
import { PositioningOptions, Placement } from '@zag-js/popper';
|
|
6
6
|
export { Placement, PositioningOptions } from '@zag-js/popper';
|
|
7
7
|
|
|
8
8
|
declare const anatomy: _zag_js_anatomy.AnatomyInstance<"trigger" | "arrow" | "arrowTip" | "positioner" | "content">;
|
|
@@ -16,30 +16,26 @@ type ElementIds = Partial<{
|
|
|
16
16
|
arrow: string;
|
|
17
17
|
positioner: string;
|
|
18
18
|
}>;
|
|
19
|
-
interface
|
|
19
|
+
interface TooltipProps extends DirectionProperty, CommonProperties {
|
|
20
20
|
/**
|
|
21
21
|
* The ids of the elements in the tooltip. Useful for composition.
|
|
22
22
|
*/
|
|
23
23
|
ids?: ElementIds | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* The `id` of the tooltip.
|
|
26
|
-
*/
|
|
27
|
-
id: string;
|
|
28
24
|
/**
|
|
29
25
|
* The open delay of the tooltip.
|
|
30
26
|
* @default 1000
|
|
31
27
|
*/
|
|
32
|
-
openDelay
|
|
28
|
+
openDelay?: number | undefined;
|
|
33
29
|
/**
|
|
34
30
|
* The close delay of the tooltip.
|
|
35
31
|
* @default 500
|
|
36
32
|
*/
|
|
37
|
-
closeDelay
|
|
33
|
+
closeDelay?: number | undefined;
|
|
38
34
|
/**
|
|
39
35
|
* Whether to close the tooltip on pointerdown.
|
|
40
36
|
* @default true
|
|
41
37
|
*/
|
|
42
|
-
closeOnPointerDown
|
|
38
|
+
closeOnPointerDown?: boolean | undefined;
|
|
43
39
|
/**
|
|
44
40
|
* Whether to close the tooltip when the Escape key is pressed.
|
|
45
41
|
* @default true
|
|
@@ -62,11 +58,11 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
62
58
|
*
|
|
63
59
|
* @default false
|
|
64
60
|
*/
|
|
65
|
-
interactive
|
|
61
|
+
interactive?: boolean | undefined;
|
|
66
62
|
/**
|
|
67
63
|
* Function called when the tooltip is opened.
|
|
68
64
|
*/
|
|
69
|
-
onOpenChange
|
|
65
|
+
onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
|
|
70
66
|
/**
|
|
71
67
|
* Custom label for the tooltip.
|
|
72
68
|
*/
|
|
@@ -74,39 +70,36 @@ interface PublicContext extends DirectionProperty, CommonProperties {
|
|
|
74
70
|
/**
|
|
75
71
|
* The user provided options used to position the popover content
|
|
76
72
|
*/
|
|
77
|
-
positioning
|
|
73
|
+
positioning?: PositioningOptions | undefined;
|
|
78
74
|
/**
|
|
79
75
|
* Whether the tooltip is disabled
|
|
80
76
|
*/
|
|
81
77
|
disabled?: boolean | undefined;
|
|
82
78
|
/**
|
|
83
|
-
*
|
|
79
|
+
* The controlled open state of the tooltip
|
|
84
80
|
*/
|
|
85
81
|
open?: boolean | undefined;
|
|
86
82
|
/**
|
|
87
|
-
*
|
|
83
|
+
* The initial open state of the tooltip when rendered.
|
|
84
|
+
* Use when you don't need to control the open state of the tooltip.
|
|
88
85
|
*/
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
92
|
-
type ComputedContext = Readonly<{
|
|
93
|
-
/**
|
|
94
|
-
* @computed Whether an `aria-label` is set.
|
|
95
|
-
*/
|
|
96
|
-
hasAriaLabel: boolean;
|
|
97
|
-
}>;
|
|
98
|
-
interface PrivateContext {
|
|
99
|
-
}
|
|
100
|
-
interface MachineContext extends PublicContext, ComputedContext, PrivateContext {
|
|
86
|
+
defaultOpen?: boolean | undefined;
|
|
101
87
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
type PropsWithDefault = "openDelay" | "closeDelay" | "closeOnPointerDown" | "closeOnEscape" | "closeOnScroll" | "closeOnClick" | "interactive" | "id";
|
|
89
|
+
interface TooltipSchema {
|
|
90
|
+
state: "open" | "closed" | "opening" | "closing";
|
|
91
|
+
props: RequiredBy<TooltipProps, PropsWithDefault>;
|
|
92
|
+
context: {
|
|
93
|
+
currentPlacement: Placement | undefined;
|
|
94
|
+
hasPointerMoveOpened: boolean;
|
|
95
|
+
};
|
|
96
|
+
event: EventObject;
|
|
97
|
+
action: string;
|
|
98
|
+
effect: string;
|
|
99
|
+
guard: string;
|
|
105
100
|
}
|
|
106
|
-
type
|
|
107
|
-
|
|
108
|
-
type Service = Machine<MachineContext, MachineState, StateMachine.AnyEventObject>;
|
|
109
|
-
interface MachineApi<T extends PropTypes = PropTypes> {
|
|
101
|
+
type TooltipService = Service<TooltipSchema>;
|
|
102
|
+
interface TooltipApi<T extends PropTypes = PropTypes> {
|
|
110
103
|
/**
|
|
111
104
|
* Whether the tooltip is open.
|
|
112
105
|
*/
|
|
@@ -126,11 +119,11 @@ interface MachineApi<T extends PropTypes = PropTypes> {
|
|
|
126
119
|
getContentProps(): T["element"];
|
|
127
120
|
}
|
|
128
121
|
|
|
129
|
-
declare function connect<
|
|
122
|
+
declare function connect<P extends PropTypes>(service: Service<TooltipSchema>, normalize: NormalizeProps<P>): TooltipApi<P>;
|
|
130
123
|
|
|
131
|
-
declare
|
|
124
|
+
declare const machine: _zag_js_core.MachineConfig<TooltipSchema>;
|
|
132
125
|
|
|
133
|
-
declare const props: (
|
|
134
|
-
declare const splitProps: <Props extends Partial<
|
|
126
|
+
declare const props: (keyof TooltipProps)[];
|
|
127
|
+
declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
|
|
135
128
|
|
|
136
|
-
export { type
|
|
129
|
+
export { type TooltipApi as Api, type ElementIds, type OpenChangeDetails, type TooltipProps as Props, type TooltipService as Service, anatomy, connect, machine, props, splitProps };
|