@zag-js/tooltip 1.46.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.
@@ -1,9 +1,3 @@
1
- import { TooltipProps } from './tooltip.types.mjs';
2
- import '@zag-js/core';
3
- import '@zag-js/popper';
4
- import '@zag-js/types';
5
-
6
- declare const props: (keyof TooltipProps)[];
7
- declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
8
-
9
- export { props, splitProps };
1
+ import { TooltipProps } from "./tooltip.types.mjs";
2
+ export declare const props: (keyof TooltipProps)[];
3
+ export declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
@@ -1,9 +1,3 @@
1
- import { TooltipProps } from './tooltip.types.js';
2
- import '@zag-js/core';
3
- import '@zag-js/popper';
4
- import '@zag-js/types';
5
-
6
- declare const props: (keyof TooltipProps)[];
7
- declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
8
-
9
- export { props, splitProps };
1
+ import { TooltipProps } from "./tooltip.types.js";
2
+ export declare const props: (keyof TooltipProps)[];
3
+ export declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
@@ -1,56 +1,31 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/tooltip.props.ts
21
- var tooltip_props_exports = {};
22
- __export(tooltip_props_exports, {
23
- props: () => props,
24
- splitProps: () => splitProps
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
25
4
  });
26
- module.exports = __toCommonJS(tooltip_props_exports);
27
- var import_types = require("@zag-js/types");
28
- var import_utils = require("@zag-js/utils");
29
- var props = (0, import_types.createProps)()([
30
- "aria-label",
31
- "closeDelay",
32
- "closeOnClick",
33
- "closeOnEscape",
34
- "closeOnPointerDown",
35
- "closeOnScroll",
36
- "defaultOpen",
37
- "defaultTriggerValue",
38
- "dir",
39
- "disabled",
40
- "getRootNode",
41
- "id",
42
- "ids",
43
- "interactive",
44
- "onOpenChange",
45
- "onTriggerValueChange",
46
- "open",
47
- "openDelay",
48
- "positioning",
49
- "triggerValue"
5
+ let _zag_js_utils = require("@zag-js/utils");
6
+ // src/tooltip.props.ts
7
+ const props = (0, require("@zag-js/types").createProps)()([
8
+ "aria-label",
9
+ "closeDelay",
10
+ "closeOnClick",
11
+ "closeOnEscape",
12
+ "closeOnPointerDown",
13
+ "closeOnScroll",
14
+ "defaultOpen",
15
+ "defaultTriggerValue",
16
+ "dir",
17
+ "disabled",
18
+ "getRootNode",
19
+ "id",
20
+ "ids",
21
+ "interactive",
22
+ "onOpenChange",
23
+ "onTriggerValueChange",
24
+ "open",
25
+ "openDelay",
26
+ "positioning",
27
+ "triggerValue"
50
28
  ]);
51
- var splitProps = (0, import_utils.createSplitProps)(props);
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
54
- props,
55
- splitProps
56
- });
29
+ const splitProps = (0, _zag_js_utils.createSplitProps)(props);
30
+ exports.props = props;
31
+ exports.splitProps = splitProps;
@@ -1,30 +1,27 @@
1
- // src/tooltip.props.ts
2
- import { createProps } from "@zag-js/types";
3
1
  import { createSplitProps } from "@zag-js/utils";
4
- var props = createProps()([
5
- "aria-label",
6
- "closeDelay",
7
- "closeOnClick",
8
- "closeOnEscape",
9
- "closeOnPointerDown",
10
- "closeOnScroll",
11
- "defaultOpen",
12
- "defaultTriggerValue",
13
- "dir",
14
- "disabled",
15
- "getRootNode",
16
- "id",
17
- "ids",
18
- "interactive",
19
- "onOpenChange",
20
- "onTriggerValueChange",
21
- "open",
22
- "openDelay",
23
- "positioning",
24
- "triggerValue"
2
+ import { createProps } from "@zag-js/types";
3
+ // src/tooltip.props.ts
4
+ const props = createProps()([
5
+ "aria-label",
6
+ "closeDelay",
7
+ "closeOnClick",
8
+ "closeOnEscape",
9
+ "closeOnPointerDown",
10
+ "closeOnScroll",
11
+ "defaultOpen",
12
+ "defaultTriggerValue",
13
+ "dir",
14
+ "disabled",
15
+ "getRootNode",
16
+ "id",
17
+ "ids",
18
+ "interactive",
19
+ "onOpenChange",
20
+ "onTriggerValueChange",
21
+ "open",
22
+ "openDelay",
23
+ "positioning",
24
+ "triggerValue"
25
25
  ]);
26
- var splitProps = createSplitProps(props);
27
- export {
28
- props,
29
- splitProps
30
- };
26
+ const splitProps = createSplitProps(props);
27
+ export { props, splitProps };
@@ -1,9 +1,5 @@
1
- import * as _zag_js_utils from '@zag-js/utils';
2
-
3
- declare const store: _zag_js_utils.Store<{
4
- id: string | null;
5
- prevId: string | null;
6
- instant: boolean;
7
- }>;
8
-
9
- export { store };
1
+ export declare const store: import("@zag-js/utils").Store<{
2
+ id: string | null;
3
+ prevId: string | null;
4
+ instant: boolean;
5
+ }>;
@@ -1,9 +1,5 @@
1
- import * as _zag_js_utils from '@zag-js/utils';
2
-
3
- declare const store: _zag_js_utils.Store<{
4
- id: string | null;
5
- prevId: string | null;
6
- instant: boolean;
7
- }>;
8
-
9
- export { store };
1
+ export declare const store: import("@zag-js/utils").Store<{
2
+ id: string | null;
3
+ prevId: string | null;
4
+ instant: boolean;
5
+ }>;
@@ -1,35 +1,11 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/tooltip.store.ts
21
- var tooltip_store_exports = {};
22
- __export(tooltip_store_exports, {
23
- store: () => store
24
- });
25
- module.exports = __toCommonJS(tooltip_store_exports);
26
- var import_utils = require("@zag-js/utils");
27
- var store = (0, import_utils.createStore)({
28
- id: null,
29
- prevId: null,
30
- instant: false
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
31
4
  });
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- store
5
+ // src/tooltip.store.ts
6
+ const store = (0, require("@zag-js/utils").createStore)({
7
+ id: null,
8
+ prevId: null,
9
+ instant: false
35
10
  });
11
+ exports.store = store;
@@ -1,10 +1,8 @@
1
- // src/tooltip.store.ts
2
1
  import { createStore } from "@zag-js/utils";
3
- var store = createStore({
4
- id: null,
5
- prevId: null,
6
- instant: false
2
+ // src/tooltip.store.ts
3
+ const store = createStore({
4
+ id: null,
5
+ prevId: null,
6
+ instant: false
7
7
  });
8
- export {
9
- store
10
- };
8
+ export { store };
@@ -1,157 +1,154 @@
1
- import { Machine, EventObject, Service } from '@zag-js/core';
2
- import { PositioningOptions, Placement } from '@zag-js/popper';
3
- export { Placement, PositioningOptions } from '@zag-js/popper';
4
- import { PropTypes, RequiredBy, DirectionProperty, CommonProperties } from '@zag-js/types';
5
-
6
- interface OpenChangeDetails {
7
- open: boolean;
1
+ import { Placement, PositioningOptions } from "@zag-js/popper";
2
+ import { EventObject, Machine, Service } from "@zag-js/core";
3
+ import { CommonProperties, DirectionProperty, PropTypes, RequiredBy } from "@zag-js/types";
4
+ export interface OpenChangeDetails {
5
+ open: boolean;
8
6
  }
9
- interface TriggerValueChangeDetails {
10
- /**
11
- * The value of the trigger
12
- */
13
- value: string | null;
14
- /**
15
- * The trigger element
16
- */
17
- triggerElement: HTMLElement | null;
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
- trigger?: (string | ((value?: string) => string)) | undefined;
21
- content?: string | undefined;
22
- arrow?: string | undefined;
23
- positioner?: string | undefined;
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
- * The ids of the elements in the tooltip. Useful for composition.
28
- */
29
- ids?: ElementIds | undefined;
30
- /**
31
- * The open delay of the tooltip.
32
- * @default 400
33
- */
34
- openDelay?: number | undefined;
35
- /**
36
- * The close delay of the tooltip.
37
- * @default 150
38
- */
39
- closeDelay?: number | undefined;
40
- /**
41
- * Whether to close the tooltip on pointerdown.
42
- * @default true
43
- */
44
- closeOnPointerDown?: boolean | undefined;
45
- /**
46
- * Whether to close the tooltip when the Escape key is pressed.
47
- * @default true
48
- */
49
- closeOnEscape?: boolean | undefined;
50
- /**
51
- * Whether the tooltip should close on scroll
52
- * @default true
53
- */
54
- closeOnScroll?: boolean | undefined;
55
- /**
56
- * Whether the tooltip should close on click
57
- * @default true
58
- */
59
- closeOnClick?: boolean | undefined;
60
- /**
61
- * Whether the tooltip's content is interactive.
62
- * In this mode, the tooltip will remain open when user hovers over the content.
63
- * @see https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus
64
- *
65
- * @default false
66
- */
67
- interactive?: boolean | undefined;
68
- /**
69
- * Function called when the tooltip is opened.
70
- */
71
- onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
72
- /**
73
- * Custom label for the tooltip.
74
- */
75
- "aria-label"?: string | undefined;
76
- /**
77
- * The user provided options used to position the popover content
78
- */
79
- positioning?: PositioningOptions | undefined;
80
- /**
81
- * Whether the tooltip is disabled
82
- */
83
- disabled?: boolean | undefined;
84
- /**
85
- * The controlled open state of the tooltip
86
- */
87
- open?: boolean | undefined;
88
- /**
89
- * The initial open state of the tooltip when rendered.
90
- * Use when you don't need to control the open state of the tooltip.
91
- */
92
- defaultOpen?: boolean | undefined;
93
- /**
94
- * The controlled trigger value
95
- */
96
- triggerValue?: string | null | undefined;
97
- /**
98
- * The initial trigger value when rendered.
99
- * Use when you don't need to control the trigger value.
100
- */
101
- defaultTriggerValue?: string | null | undefined;
102
- /**
103
- * Function called when the trigger value changes.
104
- */
105
- onTriggerValueChange?: ((details: TriggerValueChangeDetails) => void) | undefined;
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
- state: "open" | "closed" | "opening" | "closing";
110
- props: RequiredBy<TooltipProps, PropsWithDefault>;
111
- context: {
112
- currentPlacement: Placement | undefined;
113
- hasPointerMoveOpened: string | null;
114
- triggerValue: string | null;
115
- };
116
- event: EventObject;
117
- action: string;
118
- effect: string;
119
- guard: string;
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
- * The value that identifies this specific trigger
126
- */
127
- value?: string;
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
- * Whether the tooltip is open.
132
- */
133
- open: boolean;
134
- /**
135
- * Function to open the tooltip.
136
- */
137
- setOpen: (open: boolean) => void;
138
- /**
139
- * The trigger value
140
- */
141
- triggerValue: string | null;
142
- /**
143
- * Function to set the trigger value
144
- */
145
- setTriggerValue: (value: string | null) => void;
146
- /**
147
- * Function to reposition the popover
148
- */
149
- reposition: (options?: Partial<PositioningOptions>) => void;
150
- getTriggerProps: (props?: TriggerProps) => T["button"];
151
- getArrowProps: () => T["element"];
152
- getArrowTipProps: () => T["element"];
153
- getPositionerProps: () => T["element"];
154
- getContentProps: () => T["element"];
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 };