@zag-js/popover 1.47.0 → 1.49.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,201 +1,198 @@
1
- import { Machine, EventObject, Service } from '@zag-js/core';
2
- import { DismissableElementHandlers, PersistentElementOptions } from '@zag-js/dismissable';
3
- import { PositioningOptions, Placement } from '@zag-js/popper';
4
- export { Placement, PositioningOptions } from '@zag-js/popper';
5
- import { PropTypes, RequiredBy, CommonProperties, DirectionProperty, MaybeElement } from '@zag-js/types';
6
-
7
- interface OpenChangeDetails {
8
- open: boolean;
1
+ import { EventObject, Machine, Service } from "@zag-js/core";
2
+ import { DismissableElementHandlers, PersistentElementOptions } from "@zag-js/dismissable";
3
+ import { CommonProperties, DirectionProperty, MaybeElement, PropTypes, RequiredBy } from "@zag-js/types";
4
+ import { Placement, PositioningOptions } from "@zag-js/popper";
5
+ export interface OpenChangeDetails {
6
+ open: boolean;
9
7
  }
10
- interface TriggerValueChangeDetails {
11
- /**
12
- * The value of the trigger
13
- */
14
- value: string | null;
15
- /**
16
- * The trigger element
17
- */
18
- triggerElement: HTMLElement | null;
8
+ export interface TriggerValueChangeDetails {
9
+ /**
10
+ * The value of the trigger
11
+ */
12
+ value: string | null;
13
+ /**
14
+ * The trigger element
15
+ */
16
+ triggerElement: HTMLElement | null;
19
17
  }
20
- interface IntlTranslations {
21
- closeTriggerLabel?: string | undefined;
18
+ export interface IntlTranslations {
19
+ closeTriggerLabel?: string | undefined;
22
20
  }
23
- interface ElementIds {
24
- anchor?: string | undefined;
25
- trigger?: (string | ((value?: string) => string)) | undefined;
26
- content?: string | undefined;
27
- title?: string | undefined;
28
- description?: string | undefined;
29
- closeTrigger?: string | undefined;
30
- positioner?: string | undefined;
31
- arrow?: string | undefined;
21
+ export interface ElementIds {
22
+ anchor?: string | undefined;
23
+ trigger?: (string | ((value?: string) => string)) | undefined;
24
+ content?: string | undefined;
25
+ title?: string | undefined;
26
+ description?: string | undefined;
27
+ closeTrigger?: string | undefined;
28
+ positioner?: string | undefined;
29
+ arrow?: string | undefined;
32
30
  }
33
- interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
34
- /**
35
- * Specifies the localized strings that identifies the accessibility elements and their states
36
- */
37
- translations?: IntlTranslations | undefined;
38
- /**
39
- * The ids of the elements in the popover. Useful for composition.
40
- */
41
- ids?: ElementIds | undefined;
42
- /**
43
- * Whether the popover should be modal. When set to `true`:
44
- * - interaction with outside elements will be disabled
45
- * - only popover content will be visible to screen readers
46
- * - scrolling is blocked
47
- * - focus is trapped within the popover
48
- *
49
- * @default false
50
- */
51
- modal?: boolean | undefined;
52
- /**
53
- * Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
54
- * of the popover content.
55
- *
56
- * @default true
57
- */
58
- portalled?: boolean | undefined;
59
- /**
60
- * Whether to automatically set focus on the first focusable
61
- * content within the popover when opened.
62
- *
63
- * @default true
64
- */
65
- autoFocus?: boolean | undefined;
66
- /**
67
- * The element to focus on when the popover is opened.
68
- * Return `false` to skip moving focus, or `null` to use the default.
69
- */
70
- initialFocusEl?: (() => HTMLElement | null | false) | undefined;
71
- /**
72
- * Element to receive focus when the popover is closed.
73
- */
74
- finalFocusEl?: (() => MaybeElement) | undefined;
75
- /**
76
- * Whether to restore focus to the element that had focus before the popover was opened.
77
- *
78
- * @default true
79
- */
80
- restoreFocus?: boolean | undefined;
81
- /**
82
- * Whether to close the popover when the user clicks outside of the popover.
83
- * @default true
84
- */
85
- closeOnInteractOutside?: boolean | undefined;
86
- /**
87
- * Whether to close the popover when the escape key is pressed.
88
- * @default true
89
- */
90
- closeOnEscape?: boolean | undefined;
91
- /**
92
- * Function invoked when the popover opens or closes
93
- */
94
- onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
95
- /**
96
- * The user provided options used to position the popover content
97
- */
98
- positioning?: PositioningOptions | undefined;
99
- /**
100
- * The controlled open state of the popover
101
- */
102
- open?: boolean | undefined;
103
- /**
104
- * The initial open state of the popover when rendered.
105
- * Use when you don't need to control the open state of the popover.
106
- */
107
- defaultOpen?: boolean | undefined;
108
- /**
109
- * The controlled trigger value
110
- */
111
- triggerValue?: string | null | undefined;
112
- /**
113
- * The initial trigger value when rendered.
114
- * Use when you don't need to control the trigger value.
115
- */
116
- defaultTriggerValue?: string | null | undefined;
117
- /**
118
- * Function called when the trigger value changes.
119
- */
120
- onTriggerValueChange?: ((details: TriggerValueChangeDetails) => void) | undefined;
31
+ export interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
32
+ /**
33
+ * Specifies the localized strings that identifies the accessibility elements and their states
34
+ */
35
+ translations?: IntlTranslations | undefined;
36
+ /**
37
+ * The ids of the elements in the popover. Useful for composition.
38
+ */
39
+ ids?: ElementIds | undefined;
40
+ /**
41
+ * Whether the popover should be modal. When set to `true`:
42
+ * - interaction with outside elements will be disabled
43
+ * - only popover content will be visible to screen readers
44
+ * - scrolling is blocked
45
+ * - focus is trapped within the popover
46
+ *
47
+ * @default false
48
+ */
49
+ modal?: boolean | undefined;
50
+ /**
51
+ * Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
52
+ * of the popover content.
53
+ *
54
+ * @default true
55
+ */
56
+ portalled?: boolean | undefined;
57
+ /**
58
+ * Whether to automatically set focus on the first focusable
59
+ * content within the popover when opened.
60
+ *
61
+ * @default true
62
+ */
63
+ autoFocus?: boolean | undefined;
64
+ /**
65
+ * The element to focus on when the popover is opened.
66
+ * Return `false` to skip moving focus, or `null` to use the default.
67
+ */
68
+ initialFocusEl?: (() => HTMLElement | null | false) | undefined;
69
+ /**
70
+ * Element to receive focus when the popover is closed.
71
+ */
72
+ finalFocusEl?: (() => MaybeElement) | undefined;
73
+ /**
74
+ * Whether to restore focus to the element that had focus before the popover was opened.
75
+ *
76
+ * @default true
77
+ */
78
+ restoreFocus?: boolean | undefined;
79
+ /**
80
+ * Whether to close the popover when the user clicks outside of the popover.
81
+ * @default true
82
+ */
83
+ closeOnInteractOutside?: boolean | undefined;
84
+ /**
85
+ * Whether to close the popover when the escape key is pressed.
86
+ * @default true
87
+ */
88
+ closeOnEscape?: boolean | undefined;
89
+ /**
90
+ * Function invoked when the popover opens or closes
91
+ */
92
+ onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
93
+ /**
94
+ * The user provided options used to position the popover content
95
+ */
96
+ positioning?: PositioningOptions | undefined;
97
+ /**
98
+ * The controlled open state of the popover
99
+ */
100
+ open?: boolean | undefined;
101
+ /**
102
+ * The initial open state of the popover when rendered.
103
+ * Use when you don't need to control the open state of the popover.
104
+ */
105
+ defaultOpen?: boolean | undefined;
106
+ /**
107
+ * The controlled trigger value
108
+ */
109
+ triggerValue?: string | null | undefined;
110
+ /**
111
+ * The initial trigger value when rendered.
112
+ * Use when you don't need to control the trigger value.
113
+ */
114
+ defaultTriggerValue?: string | null | undefined;
115
+ /**
116
+ * Function called when the trigger value changes.
117
+ */
118
+ onTriggerValueChange?: ((details: TriggerValueChangeDetails) => void) | undefined;
121
119
  }
122
120
  type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "restoreFocus" | "positioning";
123
121
  type ComputedContext = Readonly<{
124
- /**
125
- * The computed value of `portalled`
126
- */
127
- currentPortalled: boolean;
122
+ /**
123
+ * The computed value of `portalled`
124
+ */
125
+ currentPortalled: boolean;
128
126
  }>;
129
127
  interface PrivateContext {
130
- /**
131
- * The elements that are rendered on mount
132
- */
133
- renderedElements: {
134
- title: boolean;
135
- description: boolean;
136
- };
137
- /**
138
- * The computed placement (maybe different from initial placement)
139
- */
140
- currentPlacement?: Placement | undefined;
141
- /**
142
- * The trigger value
143
- */
144
- triggerValue: string | null;
128
+ /**
129
+ * The elements that are rendered on mount
130
+ */
131
+ renderedElements: {
132
+ title: boolean;
133
+ description: boolean;
134
+ };
135
+ /**
136
+ * The computed placement (maybe different from initial placement)
137
+ */
138
+ currentPlacement?: Placement | undefined;
139
+ /**
140
+ * The trigger value
141
+ */
142
+ triggerValue: string | null;
145
143
  }
146
- interface PopoverSchema {
147
- props: RequiredBy<PopoverProps, PropsWithDefault>;
148
- state: "open" | "closed";
149
- context: PrivateContext;
150
- computed: ComputedContext;
151
- event: EventObject;
152
- action: string;
153
- effect: string;
154
- guard: string;
144
+ export interface PopoverSchema {
145
+ props: RequiredBy<PopoverProps, PropsWithDefault>;
146
+ state: "open" | "closed";
147
+ context: PrivateContext;
148
+ computed: ComputedContext;
149
+ event: EventObject;
150
+ action: string;
151
+ effect: string;
152
+ guard: string;
155
153
  }
156
- type PopoverService = Service<PopoverSchema>;
157
- type PopoverMachine = Machine<PopoverSchema>;
158
- interface TriggerProps {
159
- /**
160
- * The value that identifies this specific trigger
161
- */
162
- value?: string | undefined;
154
+ export type PopoverService = Service<PopoverSchema>;
155
+ export type PopoverMachine = Machine<PopoverSchema>;
156
+ export interface TriggerProps {
157
+ /**
158
+ * The value that identifies this specific trigger
159
+ */
160
+ value?: string | undefined;
163
161
  }
164
- interface PopoverApi<T extends PropTypes = PropTypes> {
165
- /**
166
- * Whether the popover is portalled.
167
- */
168
- portalled: boolean;
169
- /**
170
- * Whether the popover is open
171
- */
172
- open: boolean;
173
- /**
174
- * Function to open or close the popover
175
- */
176
- setOpen: (open: boolean) => void;
177
- /**
178
- * The trigger value
179
- */
180
- triggerValue: string | null;
181
- /**
182
- * Function to set the trigger value
183
- */
184
- setTriggerValue: (value: string | null) => void;
185
- /**
186
- * Function to reposition the popover
187
- */
188
- reposition: (options?: Partial<PositioningOptions>) => void;
189
- getArrowProps: () => T["element"];
190
- getArrowTipProps: () => T["element"];
191
- getAnchorProps: () => T["element"];
192
- getTriggerProps: (props?: TriggerProps) => T["button"];
193
- getIndicatorProps: () => T["element"];
194
- getPositionerProps: () => T["element"];
195
- getContentProps: () => T["element"];
196
- getTitleProps: () => T["element"];
197
- getDescriptionProps: () => T["element"];
198
- getCloseTriggerProps: () => T["button"];
162
+ export interface PopoverApi<T extends PropTypes = PropTypes> {
163
+ /**
164
+ * Whether the popover is portalled.
165
+ */
166
+ portalled: boolean;
167
+ /**
168
+ * Whether the popover is open
169
+ */
170
+ open: boolean;
171
+ /**
172
+ * Function to open or close the popover
173
+ */
174
+ setOpen: (open: boolean) => void;
175
+ /**
176
+ * The trigger value
177
+ */
178
+ triggerValue: string | null;
179
+ /**
180
+ * Function to set the trigger value
181
+ */
182
+ setTriggerValue: (value: string | null) => void;
183
+ /**
184
+ * Function to reposition the popover
185
+ */
186
+ reposition: (options?: Partial<PositioningOptions>) => void;
187
+ getArrowProps: () => T["element"];
188
+ getArrowTipProps: () => T["element"];
189
+ getAnchorProps: () => T["element"];
190
+ getTriggerProps: (props?: TriggerProps) => T["button"];
191
+ getIndicatorProps: () => T["element"];
192
+ getPositionerProps: () => T["element"];
193
+ getContentProps: () => T["element"];
194
+ getTitleProps: () => T["element"];
195
+ getDescriptionProps: () => T["element"];
196
+ getCloseTriggerProps: () => T["button"];
199
197
  }
200
-
201
- export type { ElementIds, IntlTranslations, OpenChangeDetails, PopoverApi, PopoverMachine, PopoverProps, PopoverSchema, PopoverService, TriggerProps, TriggerValueChangeDetails };
198
+ 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/popover.types.ts
17
- var popover_types_exports = {};
18
- module.exports = __toCommonJS(popover_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/popover",
3
- "version": "1.47.0",
3
+ "version": "1.49.0",
4
4
  "description": "Core logic for the popover widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -29,16 +29,16 @@
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/aria-hidden": "1.47.0",
34
- "@zag-js/core": "1.47.0",
35
- "@zag-js/dom-query": "1.47.0",
36
- "@zag-js/utils": "1.47.0",
37
- "@zag-js/dismissable": "1.47.0",
38
- "@zag-js/popper": "1.47.0",
39
- "@zag-js/remove-scroll": "1.47.0",
40
- "@zag-js/types": "1.47.0",
41
- "@zag-js/focus-trap": "1.47.0"
32
+ "@zag-js/anatomy": "1.49.0",
33
+ "@zag-js/aria-hidden": "1.49.0",
34
+ "@zag-js/core": "1.49.0",
35
+ "@zag-js/dom-query": "1.49.0",
36
+ "@zag-js/utils": "1.49.0",
37
+ "@zag-js/dismissable": "1.49.0",
38
+ "@zag-js/popper": "1.49.0",
39
+ "@zag-js/remove-scroll": "1.49.0",
40
+ "@zag-js/types": "1.49.0",
41
+ "@zag-js/focus-trap": "1.49.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "clean-package": "2.2.0"
@@ -71,8 +71,8 @@
71
71
  "./package.json": "./package.json"
72
72
  },
73
73
  "scripts": {
74
- "build": "tsup",
75
- "lint": "eslint src",
74
+ "build": "tsdown",
75
+ "lint": "oxlint src",
76
76
  "typecheck": "tsc --noEmit"
77
77
  }
78
78
  }