@zag-js/tabs 1.7.0 → 1.8.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
@@ -463,7 +463,11 @@ var machine = core.createMachine({
463
463
  setIndicatorRect({ context, event, scope }) {
464
464
  const value = event.id ?? context.get("value");
465
465
  const indicatorEl = getIndicatorEl(scope);
466
- if (!indicatorEl || !value) return;
466
+ if (!indicatorEl) return;
467
+ if (!value) {
468
+ context.set("indicatorTransition", false);
469
+ return;
470
+ }
467
471
  const triggerEl = getTriggerEl(scope, value);
468
472
  if (!triggerEl) return;
469
473
  context.set("indicatorRect", getRectById(scope, value));
@@ -478,16 +482,16 @@ var machine = core.createMachine({
478
482
  const cleanup = refs.get("indicatorCleanup");
479
483
  if (cleanup) cleanup();
480
484
  const value = context.get("value");
481
- if (!value) return;
485
+ if (!value) {
486
+ context.set("indicatorTransition", false);
487
+ return;
488
+ }
482
489
  const triggerEl = getTriggerEl(scope, value);
483
490
  const indicatorEl = getIndicatorEl(scope);
484
491
  if (!triggerEl || !indicatorEl) return;
485
492
  const exec = () => {
486
493
  const rect = getOffsetRect(triggerEl);
487
494
  context.set("indicatorRect", resolveRect(rect));
488
- domQuery.nextTick(() => {
489
- context.set("indicatorTransition", false);
490
- });
491
495
  };
492
496
  exec();
493
497
  const win = scope.getWin();
package/dist/index.mjs CHANGED
@@ -461,7 +461,11 @@ var machine = createMachine({
461
461
  setIndicatorRect({ context, event, scope }) {
462
462
  const value = event.id ?? context.get("value");
463
463
  const indicatorEl = getIndicatorEl(scope);
464
- if (!indicatorEl || !value) return;
464
+ if (!indicatorEl) return;
465
+ if (!value) {
466
+ context.set("indicatorTransition", false);
467
+ return;
468
+ }
465
469
  const triggerEl = getTriggerEl(scope, value);
466
470
  if (!triggerEl) return;
467
471
  context.set("indicatorRect", getRectById(scope, value));
@@ -476,16 +480,16 @@ var machine = createMachine({
476
480
  const cleanup = refs.get("indicatorCleanup");
477
481
  if (cleanup) cleanup();
478
482
  const value = context.get("value");
479
- if (!value) return;
483
+ if (!value) {
484
+ context.set("indicatorTransition", false);
485
+ return;
486
+ }
480
487
  const triggerEl = getTriggerEl(scope, value);
481
488
  const indicatorEl = getIndicatorEl(scope);
482
489
  if (!triggerEl || !indicatorEl) return;
483
490
  const exec = () => {
484
491
  const rect = getOffsetRect(triggerEl);
485
492
  context.set("indicatorRect", resolveRect(rect));
486
- nextTick(() => {
487
- context.set("indicatorTransition", false);
488
- });
489
493
  };
490
494
  exec();
491
495
  const win = scope.getWin();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/tabs",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Core logic for the tabs widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,12 +26,12 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/anatomy": "1.7.0",
30
- "@zag-js/dom-query": "1.7.0",
31
- "@zag-js/element-rect": "1.7.0",
32
- "@zag-js/utils": "1.7.0",
33
- "@zag-js/core": "1.7.0",
34
- "@zag-js/types": "1.7.0"
29
+ "@zag-js/anatomy": "1.8.0",
30
+ "@zag-js/dom-query": "1.8.0",
31
+ "@zag-js/element-rect": "1.8.0",
32
+ "@zag-js/utils": "1.8.0",
33
+ "@zag-js/core": "1.8.0",
34
+ "@zag-js/types": "1.8.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "clean-package": "2.2.0"