@diceui/tags-input 0.7.0 → 0.7.2

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.cjs CHANGED
@@ -277,22 +277,23 @@ var TagsInputRoot = React__namespace.forwardRef((props, ref) => {
277
277
  break;
278
278
  }
279
279
  case "Escape": {
280
- setHighlightedIndex(null);
281
- setEditingIndex(null);
280
+ if (highlightedIndex !== null) setHighlightedIndex(null);
281
+ if (editingIndex !== null) setEditingIndex(null);
282
282
  requestAnimationFrame(() => target.setSelectionRange(0, 0));
283
283
  break;
284
284
  }
285
285
  }
286
286
  },
287
287
  [
288
+ dir,
289
+ editingIndex,
288
290
  highlightedIndex,
289
291
  value,
290
292
  onItemRemove,
291
- dir,
293
+ getEnabledItems,
292
294
  editable,
293
295
  disabled,
294
- loop,
295
- getEnabledItems
296
+ loop
296
297
  ]
297
298
  );
298
299
  const getIsClickedInEmptyRoot = React__namespace.useCallback((target) => {
@@ -655,6 +656,7 @@ function TagsInputEditableItemText() {
655
656
  } else if (event.key === "Escape") {
656
657
  setEditValue(itemContext.displayValue);
657
658
  context.setEditingIndex(null);
659
+ context.setHighlightedIndex(itemContext.index);
658
660
  context.inputRef.current?.focus();
659
661
  }
660
662
  event.stopPropagation();
@@ -666,7 +668,9 @@ function TagsInputEditableItemText() {
666
668
  itemContext.displayValue,
667
669
  context.inputRef.current?.focus,
668
670
  editValue,
669
- itemContext.value
671
+ itemContext.value,
672
+ context.setHighlightedIndex,
673
+ itemContext.index
670
674
  ]
671
675
  );
672
676
  return /* @__PURE__ */ React__namespace.createElement(
package/dist/index.js CHANGED
@@ -255,22 +255,23 @@ var TagsInputRoot = React.forwardRef((props, ref) => {
255
255
  break;
256
256
  }
257
257
  case "Escape": {
258
- setHighlightedIndex(null);
259
- setEditingIndex(null);
258
+ if (highlightedIndex !== null) setHighlightedIndex(null);
259
+ if (editingIndex !== null) setEditingIndex(null);
260
260
  requestAnimationFrame(() => target.setSelectionRange(0, 0));
261
261
  break;
262
262
  }
263
263
  }
264
264
  },
265
265
  [
266
+ dir,
267
+ editingIndex,
266
268
  highlightedIndex,
267
269
  value,
268
270
  onItemRemove,
269
- dir,
271
+ getEnabledItems,
270
272
  editable,
271
273
  disabled,
272
- loop,
273
- getEnabledItems
274
+ loop
274
275
  ]
275
276
  );
276
277
  const getIsClickedInEmptyRoot = React.useCallback((target) => {
@@ -633,6 +634,7 @@ function TagsInputEditableItemText() {
633
634
  } else if (event.key === "Escape") {
634
635
  setEditValue(itemContext.displayValue);
635
636
  context.setEditingIndex(null);
637
+ context.setHighlightedIndex(itemContext.index);
636
638
  context.inputRef.current?.focus();
637
639
  }
638
640
  event.stopPropagation();
@@ -644,7 +646,9 @@ function TagsInputEditableItemText() {
644
646
  itemContext.displayValue,
645
647
  context.inputRef.current?.focus,
646
648
  editValue,
647
- itemContext.value
649
+ itemContext.value,
650
+ context.setHighlightedIndex,
651
+ itemContext.index
648
652
  ]
649
653
  );
650
654
  return /* @__PURE__ */ React.createElement(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diceui/tags-input",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -52,7 +52,7 @@
52
52
  "typescript": "^5.7.3"
53
53
  },
54
54
  "dependencies": {
55
- "@diceui/shared": "0.10.0"
55
+ "@diceui/shared": "0.12.0"
56
56
  },
57
57
  "scripts": {
58
58
  "dev": "tsup --watch",