@zag-js/tooltip 1.34.1 → 1.35.1

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 CHANGED
@@ -1,130 +1,9 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
- import * as _zag_js_core from '@zag-js/core';
3
- import { Machine, EventObject, Service } from '@zag-js/core';
4
- import { PropTypes, RequiredBy, DirectionProperty, CommonProperties, NormalizeProps } from '@zag-js/types';
5
- import { PositioningOptions, Placement } from '@zag-js/popper';
1
+ export { anatomy } from './tooltip.anatomy.mjs';
2
+ export { connect } from './tooltip.connect.mjs';
3
+ export { machine } from './tooltip.machine.mjs';
4
+ export { props, splitProps } from './tooltip.props.mjs';
5
+ export { TooltipApi as Api, ElementIds, TooltipMachine as Machine, OpenChangeDetails, TooltipProps as Props, TooltipService as Service } from './tooltip.types.mjs';
6
6
  export { Placement, PositioningOptions } from '@zag-js/popper';
7
-
8
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"trigger" | "arrow" | "arrowTip" | "positioner" | "content">;
9
-
10
- interface OpenChangeDetails {
11
- open: boolean;
12
- }
13
- type ElementIds = Partial<{
14
- trigger: string;
15
- content: string;
16
- arrow: string;
17
- positioner: string;
18
- }>;
19
- interface TooltipProps extends DirectionProperty, CommonProperties {
20
- /**
21
- * The ids of the elements in the tooltip. Useful for composition.
22
- */
23
- ids?: ElementIds | undefined;
24
- /**
25
- * The open delay of the tooltip.
26
- * @default 400
27
- */
28
- openDelay?: number | undefined;
29
- /**
30
- * The close delay of the tooltip.
31
- * @default 150
32
- */
33
- closeDelay?: number | undefined;
34
- /**
35
- * Whether to close the tooltip on pointerdown.
36
- * @default true
37
- */
38
- closeOnPointerDown?: boolean | undefined;
39
- /**
40
- * Whether to close the tooltip when the Escape key is pressed.
41
- * @default true
42
- */
43
- closeOnEscape?: boolean | undefined;
44
- /**
45
- * Whether the tooltip should close on scroll
46
- * @default true
47
- */
48
- closeOnScroll?: boolean | undefined;
49
- /**
50
- * Whether the tooltip should close on click
51
- * @default true
52
- */
53
- closeOnClick?: boolean | undefined;
54
- /**
55
- * Whether the tooltip's content is interactive.
56
- * In this mode, the tooltip will remain open when user hovers over the content.
57
- * @see https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus
58
- *
59
- * @default false
60
- */
61
- interactive?: boolean | undefined;
62
- /**
63
- * Function called when the tooltip is opened.
64
- */
65
- onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
66
- /**
67
- * Custom label for the tooltip.
68
- */
69
- "aria-label"?: string | undefined;
70
- /**
71
- * The user provided options used to position the popover content
72
- */
73
- positioning?: PositioningOptions | undefined;
74
- /**
75
- * Whether the tooltip is disabled
76
- */
77
- disabled?: boolean | undefined;
78
- /**
79
- * The controlled open state of the tooltip
80
- */
81
- open?: boolean | undefined;
82
- /**
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.
85
- */
86
- defaultOpen?: boolean | undefined;
87
- }
88
- type PropsWithDefault = "openDelay" | "closeDelay" | "closeOnPointerDown" | "closeOnEscape" | "closeOnScroll" | "closeOnClick" | "interactive" | "id" | "positioning";
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;
100
- }
101
- type TooltipService = Service<TooltipSchema>;
102
- type TooltipMachine = Machine<TooltipSchema>;
103
- interface TooltipApi<T extends PropTypes = PropTypes> {
104
- /**
105
- * Whether the tooltip is open.
106
- */
107
- open: boolean;
108
- /**
109
- * Function to open the tooltip.
110
- */
111
- setOpen: (open: boolean) => void;
112
- /**
113
- * Function to reposition the popover
114
- */
115
- reposition: (options?: Partial<PositioningOptions>) => void;
116
- getTriggerProps: () => T["button"];
117
- getArrowProps: () => T["element"];
118
- getArrowTipProps: () => T["element"];
119
- getPositionerProps: () => T["element"];
120
- getContentProps: () => T["element"];
121
- }
122
-
123
- declare function connect<P extends PropTypes>(service: Service<TooltipSchema>, normalize: NormalizeProps<P>): TooltipApi<P>;
124
-
125
- declare const machine: _zag_js_core.Machine<TooltipSchema>;
126
-
127
- declare const props: (keyof TooltipProps)[];
128
- declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
129
-
130
- export { type TooltipApi as Api, type ElementIds, type TooltipMachine as Machine, type OpenChangeDetails, type TooltipProps as Props, type TooltipService as Service, anatomy, connect, machine, props, splitProps };
7
+ import '@zag-js/anatomy';
8
+ import '@zag-js/core';
9
+ import '@zag-js/types';
package/dist/index.d.ts CHANGED
@@ -1,130 +1,9 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
- import * as _zag_js_core from '@zag-js/core';
3
- import { Machine, EventObject, Service } from '@zag-js/core';
4
- import { PropTypes, RequiredBy, DirectionProperty, CommonProperties, NormalizeProps } from '@zag-js/types';
5
- import { PositioningOptions, Placement } from '@zag-js/popper';
1
+ export { anatomy } from './tooltip.anatomy.js';
2
+ export { connect } from './tooltip.connect.js';
3
+ export { machine } from './tooltip.machine.js';
4
+ export { props, splitProps } from './tooltip.props.js';
5
+ export { TooltipApi as Api, ElementIds, TooltipMachine as Machine, OpenChangeDetails, TooltipProps as Props, TooltipService as Service } from './tooltip.types.js';
6
6
  export { Placement, PositioningOptions } from '@zag-js/popper';
7
-
8
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"trigger" | "arrow" | "arrowTip" | "positioner" | "content">;
9
-
10
- interface OpenChangeDetails {
11
- open: boolean;
12
- }
13
- type ElementIds = Partial<{
14
- trigger: string;
15
- content: string;
16
- arrow: string;
17
- positioner: string;
18
- }>;
19
- interface TooltipProps extends DirectionProperty, CommonProperties {
20
- /**
21
- * The ids of the elements in the tooltip. Useful for composition.
22
- */
23
- ids?: ElementIds | undefined;
24
- /**
25
- * The open delay of the tooltip.
26
- * @default 400
27
- */
28
- openDelay?: number | undefined;
29
- /**
30
- * The close delay of the tooltip.
31
- * @default 150
32
- */
33
- closeDelay?: number | undefined;
34
- /**
35
- * Whether to close the tooltip on pointerdown.
36
- * @default true
37
- */
38
- closeOnPointerDown?: boolean | undefined;
39
- /**
40
- * Whether to close the tooltip when the Escape key is pressed.
41
- * @default true
42
- */
43
- closeOnEscape?: boolean | undefined;
44
- /**
45
- * Whether the tooltip should close on scroll
46
- * @default true
47
- */
48
- closeOnScroll?: boolean | undefined;
49
- /**
50
- * Whether the tooltip should close on click
51
- * @default true
52
- */
53
- closeOnClick?: boolean | undefined;
54
- /**
55
- * Whether the tooltip's content is interactive.
56
- * In this mode, the tooltip will remain open when user hovers over the content.
57
- * @see https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus
58
- *
59
- * @default false
60
- */
61
- interactive?: boolean | undefined;
62
- /**
63
- * Function called when the tooltip is opened.
64
- */
65
- onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
66
- /**
67
- * Custom label for the tooltip.
68
- */
69
- "aria-label"?: string | undefined;
70
- /**
71
- * The user provided options used to position the popover content
72
- */
73
- positioning?: PositioningOptions | undefined;
74
- /**
75
- * Whether the tooltip is disabled
76
- */
77
- disabled?: boolean | undefined;
78
- /**
79
- * The controlled open state of the tooltip
80
- */
81
- open?: boolean | undefined;
82
- /**
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.
85
- */
86
- defaultOpen?: boolean | undefined;
87
- }
88
- type PropsWithDefault = "openDelay" | "closeDelay" | "closeOnPointerDown" | "closeOnEscape" | "closeOnScroll" | "closeOnClick" | "interactive" | "id" | "positioning";
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;
100
- }
101
- type TooltipService = Service<TooltipSchema>;
102
- type TooltipMachine = Machine<TooltipSchema>;
103
- interface TooltipApi<T extends PropTypes = PropTypes> {
104
- /**
105
- * Whether the tooltip is open.
106
- */
107
- open: boolean;
108
- /**
109
- * Function to open the tooltip.
110
- */
111
- setOpen: (open: boolean) => void;
112
- /**
113
- * Function to reposition the popover
114
- */
115
- reposition: (options?: Partial<PositioningOptions>) => void;
116
- getTriggerProps: () => T["button"];
117
- getArrowProps: () => T["element"];
118
- getArrowTipProps: () => T["element"];
119
- getPositionerProps: () => T["element"];
120
- getContentProps: () => T["element"];
121
- }
122
-
123
- declare function connect<P extends PropTypes>(service: Service<TooltipSchema>, normalize: NormalizeProps<P>): TooltipApi<P>;
124
-
125
- declare const machine: _zag_js_core.Machine<TooltipSchema>;
126
-
127
- declare const props: (keyof TooltipProps)[];
128
- declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
129
-
130
- export { type TooltipApi as Api, type ElementIds, type TooltipMachine as Machine, type OpenChangeDetails, type TooltipProps as Props, type TooltipService as Service, anatomy, connect, machine, props, splitProps };
7
+ import '@zag-js/anatomy';
8
+ import '@zag-js/core';
9
+ import '@zag-js/types';