@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.
@@ -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 { 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
- * 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 };
@@ -1,18 +1,4 @@
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 __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
+ });
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/tooltip",
3
- "version": "1.47.0",
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.47.0",
33
- "@zag-js/core": "1.47.0",
34
- "@zag-js/popper": "1.47.0",
35
- "@zag-js/focus-visible": "1.47.0",
36
- "@zag-js/dom-query": "1.47.0",
37
- "@zag-js/utils": "1.47.0",
38
- "@zag-js/types": "1.47.0"
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": "tsup",
72
- "lint": "eslint src",
71
+ "build": "tsdown",
72
+ "lint": "oxlint src",
73
73
  "typecheck": "tsc --noEmit"
74
74
  }
75
75
  }