@zag-js/popover 1.48.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.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
+ import { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from "@zag-js/dismissable";
1
2
  import { anatomy } from "./popover.anatomy.mjs";
2
3
  import { connect } from "./popover.connect.mjs";
3
4
  import { machine } from "./popover.machine.mjs";
4
5
  import { props, splitProps } from "./popover.props.mjs";
5
6
  import { ElementIds, IntlTranslations, OpenChangeDetails, Placement, PopoverApi, PopoverMachine, PopoverProps, PopoverService, PositioningOptions, TriggerProps, TriggerValueChangeDetails } from "./popover.types.mjs";
6
- import { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from "@zag-js/dismissable";
7
7
  export { type PopoverApi as Api, type ElementIds, type FocusOutsideEvent, type InteractOutsideEvent, type IntlTranslations, type PopoverMachine as Machine, type OpenChangeDetails, type Placement, type PointerDownOutsideEvent, type PositioningOptions, type PopoverProps as Props, type PopoverService as Service, type TriggerProps, type TriggerValueChangeDetails, anatomy, connect, machine, props, splitProps };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from "@zag-js/dismissable";
1
2
  import { anatomy } from "./popover.anatomy.js";
2
3
  import { connect } from "./popover.connect.js";
3
4
  import { machine } from "./popover.machine.js";
4
5
  import { props, splitProps } from "./popover.props.js";
5
6
  import { ElementIds, IntlTranslations, OpenChangeDetails, Placement, PopoverApi, PopoverMachine, PopoverProps, PopoverService, PositioningOptions, TriggerProps, TriggerValueChangeDetails } from "./popover.types.js";
6
- import { FocusOutsideEvent, InteractOutsideEvent, PointerDownOutsideEvent } from "@zag-js/dismissable";
7
7
  export { type PopoverApi as Api, type ElementIds, type FocusOutsideEvent, type InteractOutsideEvent, type IntlTranslations, type PopoverMachine as Machine, type OpenChangeDetails, type Placement, type PointerDownOutsideEvent, type PositioningOptions, type PopoverProps as Props, type PopoverService as Service, type TriggerProps, type TriggerValueChangeDetails, anatomy, connect, machine, props, splitProps };
@@ -1,3 +1,3 @@
1
- import { PopoverApi, PopoverService } from "./popover.types.mjs";
2
1
  import { NormalizeProps, PropTypes } from "@zag-js/types";
2
+ import { PopoverApi, PopoverService } from "./popover.types.mjs";
3
3
  export declare function connect<T extends PropTypes>(service: PopoverService, normalize: NormalizeProps<T>): PopoverApi<T>;
@@ -1,3 +1,3 @@
1
- import { PopoverApi, PopoverService } from "./popover.types.js";
2
1
  import { NormalizeProps, PropTypes } from "@zag-js/types";
2
+ import { PopoverApi, PopoverService } from "./popover.types.js";
3
3
  export declare function connect<T extends PropTypes>(service: PopoverService, normalize: NormalizeProps<T>): PopoverApi<T>;
@@ -2,11 +2,11 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_popover_anatomy = require("./popover.anatomy.js");
6
- const require_popover_dom = require("./popover.dom.js");
7
5
  let _zag_js_dom_query = require("@zag-js/dom-query");
8
6
  let _zag_js_popper = require("@zag-js/popper");
9
7
  let _zag_js_utils = require("@zag-js/utils");
8
+ const require_popover_anatomy = require("./popover.anatomy.js");
9
+ const require_popover_dom = require("./popover.dom.js");
10
10
  // src/popover.connect.ts
11
11
  const defaultTranslations = { closeTriggerLabel: "close" };
12
12
  function connect(service, normalize) {
@@ -1,8 +1,8 @@
1
- import { parts } from "./popover.anatomy.mjs";
2
- import { getAnchorId, getArrowId, getCloseTriggerId, getContentId, getDescriptionId, getPositionerId, getTitleId, getTriggerId } from "./popover.dom.mjs";
3
1
  import { ariaAttr, dataAttr, isLeftClick, isSafari } from "@zag-js/dom-query";
4
2
  import { getPlacementSide, getPlacementStyles } from "@zag-js/popper";
5
3
  import { mergeWithDefault } from "@zag-js/utils";
4
+ import { parts } from "./popover.anatomy.mjs";
5
+ import { getAnchorId, getArrowId, getCloseTriggerId, getContentId, getDescriptionId, getPositionerId, getTitleId, getTriggerId } from "./popover.dom.mjs";
6
6
  // src/popover.connect.ts
7
7
  const defaultTranslations = { closeTriggerLabel: "close" };
8
8
  function connect(service, normalize) {
@@ -2,14 +2,14 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_popover_dom = require("./popover.dom.js");
6
- let _zag_js_dom_query = require("@zag-js/dom-query");
7
- let _zag_js_popper = require("@zag-js/popper");
8
5
  let _zag_js_aria_hidden = require("@zag-js/aria-hidden");
9
6
  let _zag_js_core = require("@zag-js/core");
10
7
  let _zag_js_dismissable = require("@zag-js/dismissable");
8
+ let _zag_js_dom_query = require("@zag-js/dom-query");
11
9
  let _zag_js_focus_trap = require("@zag-js/focus-trap");
10
+ let _zag_js_popper = require("@zag-js/popper");
12
11
  let _zag_js_remove_scroll = require("@zag-js/remove-scroll");
12
+ const require_popover_dom = require("./popover.dom.js");
13
13
  // src/popover.machine.ts
14
14
  const machine = (0, _zag_js_core.createMachine)({
15
15
  props({ props }) {
@@ -89,8 +89,8 @@ const machine = (0, _zag_js_core.createMachine)({
89
89
  }]
90
90
  } },
91
91
  open: {
92
- entry: ["checkRenderedElements"],
93
92
  effects: [
93
+ "trackRenderedElements",
94
94
  "trapFocus",
95
95
  "preventScroll",
96
96
  "hideContentBelow",
@@ -124,6 +124,17 @@ const machine = (0, _zag_js_core.createMachine)({
124
124
  implementations: {
125
125
  guards: { isOpenControlled: ({ prop }) => prop("open") != void 0 },
126
126
  effects: {
127
+ trackRenderedElements({ context, scope }) {
128
+ return (0, _zag_js_dom_query.trackRenderedParts)({
129
+ getContainerEl: () => require_popover_dom.getContentEl(scope),
130
+ getRootNode: () => scope.getRootNode(),
131
+ parts: {
132
+ title: () => require_popover_dom.getTitleEl(scope),
133
+ description: () => require_popover_dom.getDescriptionEl(scope)
134
+ },
135
+ onChange: (rendered) => context.set("renderedElements", rendered)
136
+ });
137
+ },
127
138
  trackPositioning({ context, prop, scope }) {
128
139
  context.set("currentPlacement", prop("positioning").placement);
129
140
  const anchorEl = require_popover_dom.getAnchorEl(scope);
@@ -1,11 +1,11 @@
1
- import { getActiveTriggerEl, getAnchorEl, getContentEl, getDescriptionEl, getPositionerEl, getTitleEl, getTriggerEl, getTriggerEls } from "./popover.dom.mjs";
2
- import { getInitialFocus, proxyTabFocus, raf } from "@zag-js/dom-query";
3
- import { getPlacement } from "@zag-js/popper";
4
1
  import { ariaHidden } from "@zag-js/aria-hidden";
5
2
  import { createMachine } from "@zag-js/core";
6
3
  import { trackDismissableElement } from "@zag-js/dismissable";
4
+ import { getInitialFocus, proxyTabFocus, raf, trackRenderedParts } from "@zag-js/dom-query";
7
5
  import { trapFocus } from "@zag-js/focus-trap";
6
+ import { getPlacement } from "@zag-js/popper";
8
7
  import { preventBodyScroll } from "@zag-js/remove-scroll";
8
+ import { getActiveTriggerEl, getAnchorEl, getContentEl, getDescriptionEl, getPositionerEl, getTitleEl, getTriggerEl, getTriggerEls } from "./popover.dom.mjs";
9
9
  // src/popover.machine.ts
10
10
  const machine = createMachine({
11
11
  props({ props }) {
@@ -85,8 +85,8 @@ const machine = createMachine({
85
85
  }]
86
86
  } },
87
87
  open: {
88
- entry: ["checkRenderedElements"],
89
88
  effects: [
89
+ "trackRenderedElements",
90
90
  "trapFocus",
91
91
  "preventScroll",
92
92
  "hideContentBelow",
@@ -120,6 +120,17 @@ const machine = createMachine({
120
120
  implementations: {
121
121
  guards: { isOpenControlled: ({ prop }) => prop("open") != void 0 },
122
122
  effects: {
123
+ trackRenderedElements({ context, scope }) {
124
+ return trackRenderedParts({
125
+ getContainerEl: () => getContentEl(scope),
126
+ getRootNode: () => scope.getRootNode(),
127
+ parts: {
128
+ title: () => getTitleEl(scope),
129
+ description: () => getDescriptionEl(scope)
130
+ },
131
+ onChange: (rendered) => context.set("renderedElements", rendered)
132
+ });
133
+ },
123
134
  trackPositioning({ context, prop, scope }) {
124
135
  context.set("currentPlacement", prop("positioning").placement);
125
136
  const anchorEl = getAnchorEl(scope);
@@ -2,9 +2,10 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
+ let _zag_js_types = require("@zag-js/types");
5
6
  let _zag_js_utils = require("@zag-js/utils");
6
7
  // src/popover.props.ts
7
- const props = (0, require("@zag-js/types").createProps)()([
8
+ const props = (0, _zag_js_types.createProps)()([
8
9
  "autoFocus",
9
10
  "closeOnEscape",
10
11
  "closeOnInteractOutside",
@@ -1,5 +1,5 @@
1
- import { createSplitProps } from "@zag-js/utils";
2
1
  import { createProps } from "@zag-js/types";
2
+ import { createSplitProps } from "@zag-js/utils";
3
3
  // src/popover.props.ts
4
4
  const props = createProps()([
5
5
  "autoFocus",
@@ -1,6 +1,6 @@
1
- import { Placement, PositioningOptions } from "@zag-js/popper";
2
1
  import { EventObject, Machine, Service } from "@zag-js/core";
3
2
  import { DismissableElementHandlers, PersistentElementOptions } from "@zag-js/dismissable";
3
+ import { Placement, PositioningOptions } from "@zag-js/popper";
4
4
  import { CommonProperties, DirectionProperty, MaybeElement, PropTypes, RequiredBy } from "@zag-js/types";
5
5
  export interface OpenChangeDetails {
6
6
  open: boolean;
@@ -1,6 +1,6 @@
1
+ import { EventObject, Machine, Service } from "@zag-js/core";
1
2
  import { DismissableElementHandlers, PersistentElementOptions } from "@zag-js/dismissable";
2
3
  import { CommonProperties, DirectionProperty, MaybeElement, PropTypes, RequiredBy } from "@zag-js/types";
3
- import { EventObject, Machine, Service } from "@zag-js/core";
4
4
  import { Placement, PositioningOptions } from "@zag-js/popper";
5
5
  export interface OpenChangeDetails {
6
6
  open: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popover",
3
- "version": "1.48.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.48.0",
33
- "@zag-js/aria-hidden": "1.48.0",
34
- "@zag-js/core": "1.48.0",
35
- "@zag-js/dom-query": "1.48.0",
36
- "@zag-js/utils": "1.48.0",
37
- "@zag-js/dismissable": "1.48.0",
38
- "@zag-js/popper": "1.48.0",
39
- "@zag-js/remove-scroll": "1.48.0",
40
- "@zag-js/types": "1.48.0",
41
- "@zag-js/focus-trap": "1.48.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"