@zag-js/combobox 1.27.0 → 1.28.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.js CHANGED
@@ -5,7 +5,6 @@ var collection$1 = require('@zag-js/collection');
5
5
  var domQuery = require('@zag-js/dom-query');
6
6
  var popper = require('@zag-js/popper');
7
7
  var utils = require('@zag-js/utils');
8
- var ariaHidden = require('@zag-js/aria-hidden');
9
8
  var core = require('@zag-js/core');
10
9
  var dismissable = require('@zag-js/dismissable');
11
10
  var types = require('@zag-js/types');
@@ -804,7 +803,7 @@ var machine = createMachine({
804
803
  interacting: {
805
804
  tags: ["open", "focused"],
806
805
  entry: ["setInitialFocus"],
807
- effects: ["scrollToHighlightedItem", "trackDismissableLayer", "trackPlacement", "hideOtherElements"],
806
+ effects: ["scrollToHighlightedItem", "trackDismissableLayer", "trackPlacement"],
808
807
  on: {
809
808
  "CONTROLLED.CLOSE": [
810
809
  {
@@ -979,7 +978,7 @@ var machine = createMachine({
979
978
  },
980
979
  suggesting: {
981
980
  tags: ["open", "focused"],
982
- effects: ["trackDismissableLayer", "scrollToHighlightedItem", "trackPlacement", "hideOtherElements"],
981
+ effects: ["trackDismissableLayer", "scrollToHighlightedItem", "trackPlacement"],
983
982
  entry: ["setInitialFocus"],
984
983
  on: {
985
984
  "CONTROLLED.CLOSE": [
@@ -1148,7 +1147,10 @@ var machine = createMachine({
1148
1147
  if (utils.isBoolean(openOnChange)) return openOnChange;
1149
1148
  return !!openOnChange?.({ inputValue: context.get("inputValue") });
1150
1149
  },
1151
- restoreFocus: ({ event }) => event.restoreFocus == null ? true : !!event.restoreFocus,
1150
+ restoreFocus: ({ event }) => {
1151
+ const restoreFocus = event.restoreFocus ?? event.previousEvent?.restoreFocus;
1152
+ return restoreFocus == null ? true : !!restoreFocus;
1153
+ },
1152
1154
  isChangeEvent: ({ event }) => event.previousEvent?.type === "INPUT.CHANGE",
1153
1155
  autoFocus: ({ prop }) => !!prop("autoFocus"),
1154
1156
  isHighlightedItemRemoved: ({ prop, context }) => !prop("collection").has(context.get("highlightedValue"))
@@ -1174,14 +1176,6 @@ var machine = createMachine({
1174
1176
  }
1175
1177
  });
1176
1178
  },
1177
- hideOtherElements({ scope }) {
1178
- return ariaHidden.ariaHidden([
1179
- getInputEl(scope),
1180
- getContentEl(scope),
1181
- getTriggerEl(scope),
1182
- getClearTriggerEl(scope)
1183
- ]);
1184
- },
1185
1179
  trackPlacement({ context, prop, scope }) {
1186
1180
  const anchorEl = () => getControlEl(scope) || getTriggerEl(scope);
1187
1181
  const positionerEl = () => getPositionerEl(scope);
package/dist/index.mjs CHANGED
@@ -3,7 +3,6 @@ import { ListCollection } from '@zag-js/collection';
3
3
  import { raf, setCaretToEnd, nextTick, scrollIntoView, observeAttributes, clickIfLink, query, dataAttr, ariaAttr, isDownloadingEvent, isOpeningInNewTab, isContextMenuEvent, isLeftClick, getEventKey, isComposingEvent, isAnchorElement } from '@zag-js/dom-query';
4
4
  import { getPlacement, getPlacementStyles } from '@zag-js/popper';
5
5
  import { match, remove, addOrRemove, isBoolean, isEqual, createSplitProps, ensure } from '@zag-js/utils';
6
- import { ariaHidden } from '@zag-js/aria-hidden';
7
6
  import { setup } from '@zag-js/core';
8
7
  import { trackDismissableElement } from '@zag-js/dismissable';
9
8
  import { createProps } from '@zag-js/types';
@@ -802,7 +801,7 @@ var machine = createMachine({
802
801
  interacting: {
803
802
  tags: ["open", "focused"],
804
803
  entry: ["setInitialFocus"],
805
- effects: ["scrollToHighlightedItem", "trackDismissableLayer", "trackPlacement", "hideOtherElements"],
804
+ effects: ["scrollToHighlightedItem", "trackDismissableLayer", "trackPlacement"],
806
805
  on: {
807
806
  "CONTROLLED.CLOSE": [
808
807
  {
@@ -977,7 +976,7 @@ var machine = createMachine({
977
976
  },
978
977
  suggesting: {
979
978
  tags: ["open", "focused"],
980
- effects: ["trackDismissableLayer", "scrollToHighlightedItem", "trackPlacement", "hideOtherElements"],
979
+ effects: ["trackDismissableLayer", "scrollToHighlightedItem", "trackPlacement"],
981
980
  entry: ["setInitialFocus"],
982
981
  on: {
983
982
  "CONTROLLED.CLOSE": [
@@ -1146,7 +1145,10 @@ var machine = createMachine({
1146
1145
  if (isBoolean(openOnChange)) return openOnChange;
1147
1146
  return !!openOnChange?.({ inputValue: context.get("inputValue") });
1148
1147
  },
1149
- restoreFocus: ({ event }) => event.restoreFocus == null ? true : !!event.restoreFocus,
1148
+ restoreFocus: ({ event }) => {
1149
+ const restoreFocus = event.restoreFocus ?? event.previousEvent?.restoreFocus;
1150
+ return restoreFocus == null ? true : !!restoreFocus;
1151
+ },
1150
1152
  isChangeEvent: ({ event }) => event.previousEvent?.type === "INPUT.CHANGE",
1151
1153
  autoFocus: ({ prop }) => !!prop("autoFocus"),
1152
1154
  isHighlightedItemRemoved: ({ prop, context }) => !prop("collection").has(context.get("highlightedValue"))
@@ -1172,14 +1174,6 @@ var machine = createMachine({
1172
1174
  }
1173
1175
  });
1174
1176
  },
1175
- hideOtherElements({ scope }) {
1176
- return ariaHidden([
1177
- getInputEl(scope),
1178
- getContentEl(scope),
1179
- getTriggerEl(scope),
1180
- getClearTriggerEl(scope)
1181
- ]);
1182
- },
1183
1177
  trackPlacement({ context, prop, scope }) {
1184
1178
  const anchorEl = () => getControlEl(scope) || getTriggerEl(scope);
1185
1179
  const positionerEl = () => getPositionerEl(scope);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/combobox",
3
- "version": "1.27.0",
3
+ "version": "1.28.0",
4
4
  "description": "Core logic for the combobox widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,15 +26,15 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/anatomy": "1.27.0",
30
- "@zag-js/aria-hidden": "1.27.0",
31
- "@zag-js/collection": "1.27.0",
32
- "@zag-js/core": "1.27.0",
33
- "@zag-js/dismissable": "1.27.0",
34
- "@zag-js/dom-query": "1.27.0",
35
- "@zag-js/utils": "1.27.0",
36
- "@zag-js/popper": "1.27.0",
37
- "@zag-js/types": "1.27.0"
29
+ "@zag-js/anatomy": "1.28.0",
30
+ "@zag-js/aria-hidden": "1.28.0",
31
+ "@zag-js/collection": "1.28.0",
32
+ "@zag-js/core": "1.28.0",
33
+ "@zag-js/dismissable": "1.28.0",
34
+ "@zag-js/dom-query": "1.28.0",
35
+ "@zag-js/utils": "1.28.0",
36
+ "@zag-js/popper": "1.28.0",
37
+ "@zag-js/types": "1.28.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "clean-package": "2.2.0"