react-tag-autocomplete
Advanced tools
Comparing version 7.0.0 to 7.0.1
# Changelog | ||
## v7.0.1 | ||
- Fixed an issue where the `onShouldExpand` and `onShouldCollapse` callbacks would receive the previous value on input. | ||
## v7.0.0 | ||
@@ -4,0 +8,0 @@ |
@@ -138,3 +138,3 @@ "use strict"; | ||
if (document.activeElement === inputRef.current) { | ||
managerRef.current.listBoxExpand(); | ||
managerRef.current.listBoxExpand(value2); | ||
} | ||
@@ -350,3 +350,3 @@ }; | ||
opts.push({ | ||
disabled: typeof onValidate === "function" ? !onValidate(value) : false, | ||
disabled: onValidate ? !onValidate(value) : false, | ||
label: newOptionText, | ||
@@ -382,5 +382,6 @@ value: NewOptionValue | ||
const api = { | ||
listBoxCollapse() { | ||
const shouldCollapse = isExpanded && ((onShouldCollapse == null ? void 0 : onShouldCollapse(state.value)) ?? true); | ||
if (shouldCollapse) { | ||
listBoxCollapse(value2) { | ||
if (!isExpanded) | ||
return; | ||
if (onShouldCollapse ? onShouldCollapse(value2 ?? state.value) : true) { | ||
setIsExpanded(false); | ||
@@ -391,5 +392,6 @@ setLastActiveOption(null); | ||
}, | ||
listBoxExpand() { | ||
const shouldExpand = !isExpanded && ((onShouldExpand == null ? void 0 : onShouldExpand(state.value)) ?? true); | ||
if (shouldExpand) { | ||
listBoxExpand(value2) { | ||
if (isExpanded) | ||
return; | ||
if (onShouldExpand ? onShouldExpand(value2 ?? state.value) : true) { | ||
setIsExpanded(true); | ||
@@ -396,0 +398,0 @@ setLastActiveOption(options[activeIndex]); |
@@ -136,3 +136,3 @@ import React, { useContext, useMemo, useRef, useState, useLayoutEffect, useCallback, useEffect } from "react"; | ||
if (document.activeElement === inputRef.current) { | ||
managerRef.current.listBoxExpand(); | ||
managerRef.current.listBoxExpand(value2); | ||
} | ||
@@ -348,3 +348,3 @@ }; | ||
opts.push({ | ||
disabled: typeof onValidate === "function" ? !onValidate(value) : false, | ||
disabled: onValidate ? !onValidate(value) : false, | ||
label: newOptionText, | ||
@@ -380,5 +380,6 @@ value: NewOptionValue | ||
const api = { | ||
listBoxCollapse() { | ||
const shouldCollapse = isExpanded && ((onShouldCollapse == null ? void 0 : onShouldCollapse(state.value)) ?? true); | ||
if (shouldCollapse) { | ||
listBoxCollapse(value2) { | ||
if (!isExpanded) | ||
return; | ||
if (onShouldCollapse ? onShouldCollapse(value2 ?? state.value) : true) { | ||
setIsExpanded(false); | ||
@@ -389,5 +390,6 @@ setLastActiveOption(null); | ||
}, | ||
listBoxExpand() { | ||
const shouldExpand = !isExpanded && ((onShouldExpand == null ? void 0 : onShouldExpand(state.value)) ?? true); | ||
if (shouldExpand) { | ||
listBoxExpand(value2) { | ||
if (isExpanded) | ||
return; | ||
if (onShouldExpand ? onShouldExpand(value2 ?? state.value) : true) { | ||
setIsExpanded(true); | ||
@@ -394,0 +396,0 @@ setLastActiveOption(options[activeIndex]); |
@@ -139,3 +139,3 @@ (function(global, factory) { | ||
if (document.activeElement === inputRef.current) { | ||
managerRef.current.listBoxExpand(); | ||
managerRef.current.listBoxExpand(value2); | ||
} | ||
@@ -351,3 +351,3 @@ }; | ||
opts.push({ | ||
disabled: typeof onValidate === "function" ? !onValidate(value) : false, | ||
disabled: onValidate ? !onValidate(value) : false, | ||
label: newOptionText, | ||
@@ -383,5 +383,6 @@ value: NewOptionValue | ||
const api = { | ||
listBoxCollapse() { | ||
const shouldCollapse = isExpanded && ((onShouldCollapse == null ? void 0 : onShouldCollapse(state.value)) ?? true); | ||
if (shouldCollapse) { | ||
listBoxCollapse(value2) { | ||
if (!isExpanded) | ||
return; | ||
if (onShouldCollapse ? onShouldCollapse(value2 ?? state.value) : true) { | ||
setIsExpanded(false); | ||
@@ -392,5 +393,6 @@ setLastActiveOption(null); | ||
}, | ||
listBoxExpand() { | ||
const shouldExpand = !isExpanded && ((onShouldExpand == null ? void 0 : onShouldExpand(state.value)) ?? true); | ||
if (shouldExpand) { | ||
listBoxExpand(value2) { | ||
if (isExpanded) | ||
return; | ||
if (onShouldExpand ? onShouldExpand(value2 ?? state.value) : true) { | ||
setIsExpanded(true); | ||
@@ -397,0 +399,0 @@ setLastActiveOption(options[activeIndex]); |
{ | ||
"name": "react-tag-autocomplete", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"description": "A simple, accessible, tagging component ready to drop into your React projects.", | ||
@@ -5,0 +5,0 @@ "main": "dist/ReactTags.cjs.js", |
# React Tag Autocomplete | ||
[![GitHub license](https://img.shields.io/badge/license-ISC-blue.svg)](https://github.com/i-like-robots/react-tag-autocomplete/blob/master/LICENSE) ![build status](https://github.com/i-like-robots/react-tag-autocomplete/actions/workflows/test.yml/badge.svg?branch=main) [![Coverage Status](https://coveralls.io/repos/github/i-like-robots/react-tag-autocomplete/badge.svg?branch=main)](https://coveralls.io/github/i-like-robots/react-tag-autocomplete) [![npm version](https://img.shields.io/npm/v/react-tag-autocomplete/beta.svg?style=flat)](https://www.npmjs.com/package/react-tag-autocomplete) | ||
[![GitHub license](https://img.shields.io/badge/license-ISC-blue.svg)](https://github.com/i-like-robots/react-tag-autocomplete/blob/master/LICENSE) ![build status](https://github.com/i-like-robots/react-tag-autocomplete/actions/workflows/test.yml/badge.svg?branch=main) [![Coverage Status](https://coveralls.io/repos/github/i-like-robots/react-tag-autocomplete/badge.svg?branch=main)](https://coveralls.io/github/i-like-robots/react-tag-autocomplete) [![npm version](https://img.shields.io/npm/v/react-tag-autocomplete/latest.svg?style=flat)](https://www.npmjs.com/package/react-tag-autocomplete) | ||
@@ -18,3 +18,3 @@ React Tag Autocomplete is a simple, accessible, tagging component ready to drop into your React projects. [Try the examples here](http://i-like-robots.github.io/react-tag-autocomplete/). | ||
_Please note:_ This repository is for version 7 of the component which is under development. To view the current stable version of React Tag Autocomplete see the [old repository](https://github.com/i-like-robots/react-tags). If you're upgrading from v6 please refer to [the migration guide](migration-guide.md) | ||
_Please note:_ This repository is for v7 and above. To view the previous versions of the `react-tag-autocomplete` package see the [old repository](https://github.com/i-like-robots/react-tags). If you're upgrading to v7 from v6 please refer to [the migration guide](migration-guide.md) | ||
@@ -28,3 +28,3 @@ ## Installation | ||
```sh | ||
$ npm install -S react-tag-autocomplete@beta | ||
$ npm install -S react-tag-autocomplete | ||
``` | ||
@@ -31,0 +31,0 @@ |
12977
394716