react-select-search
Advanced tools
Comparing version 2.0.6 to 2.0.7
@@ -50,3 +50,3 @@ "use strict"; | ||
fuse = _ref.fuse; | ||
var selectRef = (0, _react.createRef)(); | ||
var selectRef = (0, _react.useRef)(null); | ||
@@ -99,14 +99,7 @@ var _useSelect = (0, _useSelect2["default"])({ | ||
if (!current) { | ||
if (!current || multiple || highlighted < 0 && !value) { | ||
return; | ||
} | ||
var query = null; | ||
if (highlighted > -1) { | ||
query = "[data-index=\"" + highlighted + "\"]"; | ||
} else if (value && !multiple) { | ||
query = "[data-value=\"" + escape(value.value) + "\"]"; | ||
} | ||
var query = highlighted > -1 ? "[data-index=\"" + highlighted + "\"]" : "[data-value=\"" + escape(value.value) + "\"]"; | ||
var selected = current.querySelector(query); | ||
@@ -113,0 +106,0 @@ |
"use strict"; | ||
exports.__esModule = true; | ||
exports["default"] = useSelectSearch; | ||
exports["default"] = useSelect; | ||
@@ -30,3 +30,3 @@ var _react = require("react"); | ||
function useSelectSearch(_ref) { | ||
function useSelect(_ref) { | ||
var _ref$value = _ref.value, | ||
@@ -33,0 +33,0 @@ defaultValue = _ref$value === void 0 ? null : _ref$value, |
@@ -9,3 +9,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
import React, { forwardRef, memo, createRef, useEffect, useCallback } from 'react'; | ||
import React, { forwardRef, memo, useRef, useEffect, useCallback } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
@@ -35,3 +35,3 @@ import useSelect from './useSelect'; | ||
}, ref) => { | ||
const selectRef = createRef(); | ||
const selectRef = useRef(null); | ||
const [snapshot, valueProps, optionProps] = useSelect({ | ||
@@ -81,14 +81,7 @@ options: defaultOptions, | ||
if (!current) { | ||
if (!current || multiple || highlighted < 0 && !value) { | ||
return; | ||
} | ||
let query = null; | ||
if (highlighted > -1) { | ||
query = "[data-index=\"" + highlighted + "\"]"; | ||
} else if (value && !multiple) { | ||
query = "[data-value=\"" + escape(value.value) + "\"]"; | ||
} | ||
const query = highlighted > -1 ? "[data-index=\"" + highlighted + "\"]" : "[data-value=\"" + escape(value.value) + "\"]"; | ||
const selected = current.querySelector(query); | ||
@@ -95,0 +88,0 @@ |
@@ -15,3 +15,3 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
import doSearch from './search'; | ||
export default function useSelectSearch({ | ||
export default function useSelect({ | ||
value: defaultValue = null, | ||
@@ -18,0 +18,0 @@ disabled = false, |
{ | ||
"name": "react-select-search", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "Lightweight select component for React", | ||
@@ -48,7 +48,7 @@ "main": "dist/esm/index.js", | ||
"@babel/register": "^7.9.0", | ||
"@storybook/addon-actions": "^5.3.19", | ||
"@storybook/addon-links": "^5.3.19", | ||
"@storybook/addon-storysource": "^5.3.19", | ||
"@storybook/addons": "^5.3.19", | ||
"@storybook/react": "^5.3.19", | ||
"@storybook/addon-actions": "^6.0.4", | ||
"@storybook/addon-links": "^6.0.4", | ||
"@storybook/addon-storysource": "^6.0.4", | ||
"@storybook/addons": "^6.0.4", | ||
"@storybook/react": "^6.0.4", | ||
"babel-eslint": "^10.1.0", | ||
@@ -55,0 +55,0 @@ "babel-loader": "^8.1.0", |
@@ -209,1 +209,9 @@ <p align="center"> | ||
to change the appearance, like adding a spinner. The property `searching` is also available in the snapshot that is sent to your render callbacks. | ||
## IE11 support | ||
The main build is an ES module and targets modern browsers. In particular, it specifically excludes IE11 in the build process. If you need to support IE11, you should require the CommonJS build instead like so | ||
```js | ||
import SelectSearch from 'react-select-search/dist/cjs/index.js'; | ||
``` |
@@ -92,3 +92,3 @@ import React from 'react' | ||
renderGroupHeader?:(name:string) => string | ||
getOptions?:(query:string) => Promise<SelectedOption> | ||
getOptions?: (query:string) => Promise<SelectSearchOption[]> | ||
ref?:React.Ref<React.Component> | ||
@@ -95,0 +95,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85794
217
1645