@zag-js/popover 0.1.8 → 0.1.9

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,6 +1,6 @@
1
- import { PropTypes, ReactPropTypes } from "@zag-js/types";
1
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
2
2
  import type { Send, State } from "./popover.types";
3
- export declare function connect<T extends PropTypes = ReactPropTypes>(state: State, send: Send, normalize?: import("@zag-js/types").NormalizeProps): {
3
+ export declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
4
4
  portalled: boolean;
5
5
  isOpen: boolean;
6
6
  open(): void;
@@ -1,6 +1,7 @@
1
- import { MachineContext as Ctx } from "./popover.types";
1
+ import type { MachineContext as Ctx } from "./popover.types";
2
2
  export declare const dom: {
3
3
  getDoc: (ctx: Ctx) => Document;
4
+ getWin: (ctx: Ctx) => Window & typeof globalThis;
4
5
  getActiveEl: (ctx: Ctx) => Element;
5
6
  getRootNode: (ctx: Ctx) => Document | ShadowRoot;
6
7
  getAnchorId: (ctx: Ctx) => string;
@@ -1,2 +1,2 @@
1
- import { MachineContext, MachineState, UserDefinedContext } from "./popover.types";
1
+ import type { MachineContext, MachineState, UserDefinedContext } from "./popover.types";
2
2
  export declare function machine(ctx?: UserDefinedContext): import("@zag-js/core").Machine<MachineContext, MachineState, import("@zag-js/core").StateMachine.AnyEventObject>;
@@ -1,4 +1,5 @@
1
1
  import type { StateMachine as S } from "@zag-js/core";
2
+ import type { DismissableElementHandlers } from "@zag-js/dimissable";
2
3
  import type { PositioningOptions, Placement } from "@zag-js/popper";
3
4
  import type { Context, MaybeElement } from "@zag-js/types";
4
5
  declare type ElementIds = Partial<{
@@ -9,7 +10,7 @@ declare type ElementIds = Partial<{
9
10
  description: string;
10
11
  closeBtn: string;
11
12
  }>;
12
- declare type PublicContext = {
13
+ declare type PublicContext = DismissableElementHandlers & {
13
14
  /**
14
15
  * The ids of the elements in the popover. Useful for composition.
15
16
  */
@@ -18,8 +19,8 @@ declare type PublicContext = {
18
19
  * Whether the popover should be modal. When set to `true`:
19
20
  * - interaction with outside elements will be disabled
20
21
  * - only popover content will be visible to screen readers
21
- * - focus is trapped within the popover
22
22
  * - scrolling is blocked
23
+ * - focus is trapped within the popover
23
24
  *
24
25
  * @default false
25
26
  */
@@ -40,7 +41,7 @@ declare type PublicContext = {
40
41
  /**
41
42
  * Whether to close the popover when the user clicks outside of the popover.
42
43
  */
43
- closeOnBlur?: boolean;
44
+ closeOnInteractOutside?: boolean;
44
45
  /**
45
46
  * Whether to close the popover when the escape key is pressed.
46
47
  */
@@ -48,11 +49,7 @@ declare type PublicContext = {
48
49
  /**
49
50
  * Function invoked when the popover is opened.
50
51
  */
51
- onOpen?: () => void;
52
- /**
53
- * Function invoked when the popover is closed.
54
- */
55
- onClose?: () => void;
52
+ onOpenChange?: (open: boolean) => void;
56
53
  /**
57
54
  * The user provided options used to position the popover content
58
55
  */
@@ -60,7 +57,7 @@ declare type PublicContext = {
60
57
  /**
61
58
  * Whether to open the popover on page load
62
59
  */
63
- open?: boolean;
60
+ defaultOpen?: boolean;
64
61
  };
65
62
  export declare type UserDefinedContext = Partial<PublicContext>;
66
63
  declare type ComputedContext = Readonly<{
@@ -90,6 +87,10 @@ declare type PrivateContext = Context<{
90
87
  * Whether the dynamic placement has been computed
91
88
  */
92
89
  isPlacementComplete?: boolean;
90
+ /**
91
+ * Whether to prevent returning focus to the trigger
92
+ */
93
+ focusTriggerOnClose?: boolean;
93
94
  }>;
94
95
  export declare type MachineContext = PublicContext & ComputedContext & PrivateContext;
95
96
  export declare type MachineState = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popover",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Core logic for the popover widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -30,13 +30,13 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@zag-js/aria-hidden": "0.1.0",
33
- "@zag-js/core": "0.1.6",
34
- "@zag-js/dom-utils": "0.1.5",
35
- "@zag-js/popper": "0.1.6",
36
- "@zag-js/remove-scroll": "0.1.0",
37
- "@zag-js/types": "0.2.0",
33
+ "@zag-js/core": "0.1.7",
34
+ "@zag-js/dom-utils": "0.1.6",
35
+ "@zag-js/popper": "0.1.7",
36
+ "@zag-js/remove-scroll": "0.1.1",
37
+ "@zag-js/types": "0.2.1",
38
38
  "@zag-js/utils": "0.1.2",
39
- "focus-trap": "^6.7.1"
39
+ "focus-trap": "6.9.4"
40
40
  },
41
41
  "scripts": {
42
42
  "build:fast": "zag build",