@zag-js/popover 1.44.0 → 1.45.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,6 +1,6 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
2
 
3
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"content" | "title" | "anchor" | "arrow" | "arrowTip" | "trigger" | "indicator" | "positioner" | "description" | "closeTrigger">;
4
- declare const parts: Record<"content" | "title" | "anchor" | "arrow" | "arrowTip" | "trigger" | "indicator" | "positioner" | "description" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
3
+ declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "arrow" | "arrowTip" | "anchor" | "trigger" | "indicator" | "positioner" | "content" | "description" | "closeTrigger">;
4
+ declare const parts: Record<"title" | "arrow" | "arrowTip" | "anchor" | "trigger" | "indicator" | "positioner" | "content" | "description" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
5
5
 
6
6
  export { anatomy, parts };
@@ -1,6 +1,6 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
2
 
3
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"content" | "title" | "anchor" | "arrow" | "arrowTip" | "trigger" | "indicator" | "positioner" | "description" | "closeTrigger">;
4
- declare const parts: Record<"content" | "title" | "anchor" | "arrow" | "arrowTip" | "trigger" | "indicator" | "positioner" | "description" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
3
+ declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "arrow" | "arrowTip" | "anchor" | "trigger" | "indicator" | "positioner" | "content" | "description" | "closeTrigger">;
4
+ declare const parts: Record<"title" | "arrow" | "arrowTip" | "anchor" | "trigger" | "indicator" | "positioner" | "content" | "description" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
5
5
 
6
6
  export { anatomy, parts };
@@ -295,7 +295,8 @@ var machine = (0, import_core.createMachine)({
295
295
  getInitialEl: prop("initialFocusEl"),
296
296
  enabled: prop("autoFocus")
297
297
  });
298
- element?.focus({ preventScroll: true });
298
+ if (!element) return;
299
+ element.focus({ preventScroll: true });
299
300
  });
300
301
  },
301
302
  setFinalFocus({ event, prop, scope, context }) {
@@ -261,7 +261,8 @@ var machine = createMachine({
261
261
  getInitialEl: prop("initialFocusEl"),
262
262
  enabled: prop("autoFocus")
263
263
  });
264
- element?.focus({ preventScroll: true });
264
+ if (!element) return;
265
+ element.focus({ preventScroll: true });
265
266
  });
266
267
  },
267
268
  setFinalFocus({ event, prop, scope, context }) {
@@ -65,8 +65,9 @@ interface PopoverProps extends CommonProperties, DirectionProperty, DismissableE
65
65
  autoFocus?: boolean | undefined;
66
66
  /**
67
67
  * The element to focus on when the popover is opened.
68
+ * Return `false` to skip moving focus, or `null` to use the default.
68
69
  */
69
- initialFocusEl?: (() => HTMLElement | null) | undefined;
70
+ initialFocusEl?: (() => HTMLElement | null | false) | undefined;
70
71
  /**
71
72
  * Element to receive focus when the popover is closed.
72
73
  */
@@ -65,8 +65,9 @@ interface PopoverProps extends CommonProperties, DirectionProperty, DismissableE
65
65
  autoFocus?: boolean | undefined;
66
66
  /**
67
67
  * The element to focus on when the popover is opened.
68
+ * Return `false` to skip moving focus, or `null` to use the default.
68
69
  */
69
- initialFocusEl?: (() => HTMLElement | null) | undefined;
70
+ initialFocusEl?: (() => HTMLElement | null | false) | undefined;
70
71
  /**
71
72
  * Element to receive focus when the popover is closed.
72
73
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popover",
3
- "version": "1.44.0",
3
+ "version": "1.45.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.44.0",
33
- "@zag-js/aria-hidden": "1.44.0",
34
- "@zag-js/core": "1.44.0",
35
- "@zag-js/dom-query": "1.44.0",
36
- "@zag-js/utils": "1.44.0",
37
- "@zag-js/dismissable": "1.44.0",
38
- "@zag-js/popper": "1.44.0",
39
- "@zag-js/remove-scroll": "1.44.0",
40
- "@zag-js/types": "1.44.0",
41
- "@zag-js/focus-trap": "1.44.0"
32
+ "@zag-js/anatomy": "1.45.0",
33
+ "@zag-js/aria-hidden": "1.45.0",
34
+ "@zag-js/core": "1.45.0",
35
+ "@zag-js/dom-query": "1.45.0",
36
+ "@zag-js/utils": "1.45.0",
37
+ "@zag-js/dismissable": "1.45.0",
38
+ "@zag-js/popper": "1.45.0",
39
+ "@zag-js/remove-scroll": "1.45.0",
40
+ "@zag-js/types": "1.45.0",
41
+ "@zag-js/focus-trap": "1.45.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "clean-package": "2.2.0"