@zag-js/popover 0.74.2 → 0.76.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.
package/dist/index.d.mts CHANGED
@@ -26,7 +26,7 @@ interface PublicContext extends CommonProperties, DirectionProperty, Dismissable
26
26
  /**
27
27
  * The ids of the elements in the popover. Useful for composition.
28
28
  */
29
- ids?: ElementIds;
29
+ ids?: ElementIds | undefined;
30
30
  /**
31
31
  * Whether the popover should be modal. When set to `true`:
32
32
  * - interaction with outside elements will be disabled
@@ -36,39 +36,39 @@ interface PublicContext extends CommonProperties, DirectionProperty, Dismissable
36
36
  *
37
37
  * @default false
38
38
  */
39
- modal?: boolean;
39
+ modal?: boolean | undefined;
40
40
  /**
41
41
  * Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
42
42
  * of the popover content.
43
43
  *
44
44
  * @default true
45
45
  */
46
- portalled?: boolean;
46
+ portalled?: boolean | undefined;
47
47
  /**
48
48
  * Whether to automatically set focus on the first focusable
49
49
  * content within the popover when opened.
50
50
  *
51
51
  * @default true
52
52
  */
53
- autoFocus?: boolean;
53
+ autoFocus?: boolean | undefined;
54
54
  /**
55
55
  * The element to focus on when the popover is opened.
56
56
  */
57
- initialFocusEl?: () => HTMLElement | null;
57
+ initialFocusEl?: (() => HTMLElement | null) | undefined;
58
58
  /**
59
59
  * Whether to close the popover when the user clicks outside of the popover.
60
60
  * @default true
61
61
  */
62
- closeOnInteractOutside?: boolean;
62
+ closeOnInteractOutside?: boolean | undefined;
63
63
  /**
64
64
  * Whether to close the popover when the escape key is pressed.
65
65
  * @default true
66
66
  */
67
- closeOnEscape?: boolean;
67
+ closeOnEscape?: boolean | undefined;
68
68
  /**
69
69
  * Function invoked when the popover opens or closes
70
70
  */
71
- onOpenChange?: (details: OpenChangeDetails) => void;
71
+ onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
72
72
  /**
73
73
  * The user provided options used to position the popover content
74
74
  */
@@ -76,11 +76,11 @@ interface PublicContext extends CommonProperties, DirectionProperty, Dismissable
76
76
  /**
77
77
  * Whether the popover is open
78
78
  */
79
- open?: boolean;
79
+ open?: boolean | undefined;
80
80
  /**
81
81
  * Whether the popover is controlled by the user
82
82
  */
83
- "open.controlled"?: boolean;
83
+ "open.controlled"?: boolean | undefined;
84
84
  }
85
85
  type UserDefinedContext = RequiredBy<PublicContext, "id">;
86
86
  type ComputedContext = Readonly<{
package/dist/index.d.ts CHANGED
@@ -26,7 +26,7 @@ interface PublicContext extends CommonProperties, DirectionProperty, Dismissable
26
26
  /**
27
27
  * The ids of the elements in the popover. Useful for composition.
28
28
  */
29
- ids?: ElementIds;
29
+ ids?: ElementIds | undefined;
30
30
  /**
31
31
  * Whether the popover should be modal. When set to `true`:
32
32
  * - interaction with outside elements will be disabled
@@ -36,39 +36,39 @@ interface PublicContext extends CommonProperties, DirectionProperty, Dismissable
36
36
  *
37
37
  * @default false
38
38
  */
39
- modal?: boolean;
39
+ modal?: boolean | undefined;
40
40
  /**
41
41
  * Whether the popover is portalled. This will proxy the tabbing behavior regardless of the DOM position
42
42
  * of the popover content.
43
43
  *
44
44
  * @default true
45
45
  */
46
- portalled?: boolean;
46
+ portalled?: boolean | undefined;
47
47
  /**
48
48
  * Whether to automatically set focus on the first focusable
49
49
  * content within the popover when opened.
50
50
  *
51
51
  * @default true
52
52
  */
53
- autoFocus?: boolean;
53
+ autoFocus?: boolean | undefined;
54
54
  /**
55
55
  * The element to focus on when the popover is opened.
56
56
  */
57
- initialFocusEl?: () => HTMLElement | null;
57
+ initialFocusEl?: (() => HTMLElement | null) | undefined;
58
58
  /**
59
59
  * Whether to close the popover when the user clicks outside of the popover.
60
60
  * @default true
61
61
  */
62
- closeOnInteractOutside?: boolean;
62
+ closeOnInteractOutside?: boolean | undefined;
63
63
  /**
64
64
  * Whether to close the popover when the escape key is pressed.
65
65
  * @default true
66
66
  */
67
- closeOnEscape?: boolean;
67
+ closeOnEscape?: boolean | undefined;
68
68
  /**
69
69
  * Function invoked when the popover opens or closes
70
70
  */
71
- onOpenChange?: (details: OpenChangeDetails) => void;
71
+ onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
72
72
  /**
73
73
  * The user provided options used to position the popover content
74
74
  */
@@ -76,11 +76,11 @@ interface PublicContext extends CommonProperties, DirectionProperty, Dismissable
76
76
  /**
77
77
  * Whether the popover is open
78
78
  */
79
- open?: boolean;
79
+ open?: boolean | undefined;
80
80
  /**
81
81
  * Whether the popover is controlled by the user
82
82
  */
83
- "open.controlled"?: boolean;
83
+ "open.controlled"?: boolean | undefined;
84
84
  }
85
85
  type UserDefinedContext = RequiredBy<PublicContext, "id">;
86
86
  type ComputedContext = Readonly<{
package/dist/index.js CHANGED
@@ -97,6 +97,11 @@ function connect(state, send, normalize) {
97
97
  "aria-expanded": open,
98
98
  "data-state": open ? "open" : "closed",
99
99
  "aria-controls": dom.getContentId(state.context),
100
+ onPointerDown(event) {
101
+ if (domQuery.isSafari()) {
102
+ event.currentTarget.focus();
103
+ }
104
+ },
100
105
  onClick(event) {
101
106
  if (event.defaultPrevented) return;
102
107
  send("TOGGLE");
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createAnatomy } from '@zag-js/anatomy';
2
- import { createScope, getFocusables, dataAttr, proxyTabFocus, nextTick, getInitialFocus, raf } from '@zag-js/dom-query';
2
+ import { createScope, getFocusables, isSafari, dataAttr, proxyTabFocus, nextTick, getInitialFocus, raf } from '@zag-js/dom-query';
3
3
  import { getPlacementStyles, getPlacement } from '@zag-js/popper';
4
4
  import { ariaHidden } from '@zag-js/aria-hidden';
5
5
  import { createMachine } from '@zag-js/core';
@@ -95,6 +95,11 @@ function connect(state, send, normalize) {
95
95
  "aria-expanded": open,
96
96
  "data-state": open ? "open" : "closed",
97
97
  "aria-controls": dom.getContentId(state.context),
98
+ onPointerDown(event) {
99
+ if (isSafari()) {
100
+ event.currentTarget.focus();
101
+ }
102
+ },
98
103
  onClick(event) {
99
104
  if (event.defaultPrevented) return;
100
105
  send("TOGGLE");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popover",
3
- "version": "0.74.2",
3
+ "version": "0.76.0",
4
4
  "description": "Core logic for the popover widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -27,15 +27,15 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "focus-trap": "7.6.0",
30
- "@zag-js/anatomy": "0.74.2",
31
- "@zag-js/aria-hidden": "0.74.2",
32
- "@zag-js/core": "0.74.2",
33
- "@zag-js/dom-query": "0.74.2",
34
- "@zag-js/utils": "0.74.2",
35
- "@zag-js/dismissable": "0.74.2",
36
- "@zag-js/popper": "0.74.2",
37
- "@zag-js/remove-scroll": "0.74.2",
38
- "@zag-js/types": "0.74.2"
30
+ "@zag-js/anatomy": "0.76.0",
31
+ "@zag-js/aria-hidden": "0.76.0",
32
+ "@zag-js/core": "0.76.0",
33
+ "@zag-js/dom-query": "0.76.0",
34
+ "@zag-js/utils": "0.76.0",
35
+ "@zag-js/dismissable": "0.76.0",
36
+ "@zag-js/popper": "0.76.0",
37
+ "@zag-js/remove-scroll": "0.76.0",
38
+ "@zag-js/types": "0.76.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "clean-package": "2.2.0"