@zag-js/tabs 1.14.0 → 1.15.1

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
@@ -135,9 +135,6 @@ function connect(service, normalize) {
135
135
  },
136
136
  End() {
137
137
  send({ type: "END" });
138
- },
139
- Enter() {
140
- send({ type: "ENTER" });
141
138
  }
142
139
  };
143
140
  let key = domQuery.getEventKey(event, {
@@ -148,6 +145,7 @@ function connect(service, normalize) {
148
145
  if (exec) {
149
146
  event.preventDefault();
150
147
  exec(event);
148
+ return;
151
149
  }
152
150
  }
153
151
  });
@@ -185,6 +183,7 @@ function connect(service, normalize) {
185
183
  },
186
184
  onClick(event) {
187
185
  if (event.defaultPrevented) return;
186
+ if (domQuery.isOpeningInNewTab(event)) return;
188
187
  if (disabled) return;
189
188
  if (domQuery.isSafari()) {
190
189
  event.currentTarget.focus();
@@ -234,8 +233,8 @@ function connect(service, normalize) {
234
233
  }
235
234
  };
236
235
  }
237
- var { not } = core.createGuards();
238
- var machine = core.createMachine({
236
+ var { createMachine } = core.setup();
237
+ var machine = createMachine({
239
238
  props({ props: props2 }) {
240
239
  return {
241
240
  dir: "ltr",
@@ -316,7 +315,6 @@ var machine = core.createMachine({
316
315
  focused: {
317
316
  on: {
318
317
  TAB_CLICK: {
319
- target: "focused",
320
318
  actions: ["setFocusedValue", "setValue"]
321
319
  },
322
320
  ARROW_PREV: [
@@ -355,10 +353,6 @@ var machine = core.createMachine({
355
353
  actions: ["focusLastTab"]
356
354
  }
357
355
  ],
358
- ENTER: {
359
- guard: not("selectOnFocus"),
360
- actions: ["selectFocusedTab"]
361
- },
362
356
  TAB_FOCUS: {
363
357
  actions: ["setFocusedValue"]
364
358
  },
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createAnatomy } from '@zag-js/anatomy';
2
- import { isAnchorElement, trackElementRect, nextTick, raf, getFocusables, prevById, nextById, clickIfLink, itemById, queryAll, dataAttr, isSafari, isSelfTarget, isComposingEvent, getEventKey } from '@zag-js/dom-query';
2
+ import { isAnchorElement, trackElementRect, nextTick, raf, getFocusables, prevById, nextById, clickIfLink, itemById, queryAll, dataAttr, isOpeningInNewTab, isSafari, isSelfTarget, isComposingEvent, getEventKey } from '@zag-js/dom-query';
3
3
  import { last, first, createSplitProps } from '@zag-js/utils';
4
- import { createGuards, createMachine } from '@zag-js/core';
4
+ import { setup } from '@zag-js/core';
5
5
  import { createProps } from '@zag-js/types';
6
6
 
7
7
  // src/tabs.anatomy.ts
@@ -133,9 +133,6 @@ function connect(service, normalize) {
133
133
  },
134
134
  End() {
135
135
  send({ type: "END" });
136
- },
137
- Enter() {
138
- send({ type: "ENTER" });
139
136
  }
140
137
  };
141
138
  let key = getEventKey(event, {
@@ -146,6 +143,7 @@ function connect(service, normalize) {
146
143
  if (exec) {
147
144
  event.preventDefault();
148
145
  exec(event);
146
+ return;
149
147
  }
150
148
  }
151
149
  });
@@ -183,6 +181,7 @@ function connect(service, normalize) {
183
181
  },
184
182
  onClick(event) {
185
183
  if (event.defaultPrevented) return;
184
+ if (isOpeningInNewTab(event)) return;
186
185
  if (disabled) return;
187
186
  if (isSafari()) {
188
187
  event.currentTarget.focus();
@@ -232,7 +231,7 @@ function connect(service, normalize) {
232
231
  }
233
232
  };
234
233
  }
235
- var { not } = createGuards();
234
+ var { createMachine } = setup();
236
235
  var machine = createMachine({
237
236
  props({ props: props2 }) {
238
237
  return {
@@ -314,7 +313,6 @@ var machine = createMachine({
314
313
  focused: {
315
314
  on: {
316
315
  TAB_CLICK: {
317
- target: "focused",
318
316
  actions: ["setFocusedValue", "setValue"]
319
317
  },
320
318
  ARROW_PREV: [
@@ -353,10 +351,6 @@ var machine = createMachine({
353
351
  actions: ["focusLastTab"]
354
352
  }
355
353
  ],
356
- ENTER: {
357
- guard: not("selectOnFocus"),
358
- actions: ["selectFocusedTab"]
359
- },
360
354
  TAB_FOCUS: {
361
355
  actions: ["setFocusedValue"]
362
356
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/tabs",
3
- "version": "1.14.0",
3
+ "version": "1.15.1",
4
4
  "description": "Core logic for the tabs widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,11 +26,11 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/anatomy": "1.14.0",
30
- "@zag-js/dom-query": "1.14.0",
31
- "@zag-js/utils": "1.14.0",
32
- "@zag-js/core": "1.14.0",
33
- "@zag-js/types": "1.14.0"
29
+ "@zag-js/dom-query": "1.15.1",
30
+ "@zag-js/anatomy": "1.15.1",
31
+ "@zag-js/types": "1.15.1",
32
+ "@zag-js/core": "1.15.1",
33
+ "@zag-js/utils": "1.15.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "clean-package": "2.2.0"