Socket
Socket
Sign inDemoInstall

react-select-async-paginate

Package Overview
Dependencies
80
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 0.6.1

22

es/useAsyncPaginateBase.js

@@ -55,3 +55,3 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";

export var requestOptions = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(paramsRef, optionsCacheRef, debounceTimeout, sleepParam, setOptionsCache, validateResponseParam, reduceOptions) {
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(caller, paramsRef, optionsCacheRef, debounceTimeout, sleepParam, setOptionsCache, validateResponseParam, reduceOptions) {
var currentInputValue, isCacheEmpty, currentOptions, newInputValue, response, hasError, loadOptions, _response, options, hasMore, newAdditional;

@@ -81,3 +81,3 @@

if (!(debounceTimeout > 0)) {
if (!(debounceTimeout > 0 && caller === 'input-change')) {
_context.next = 13;

@@ -165,3 +165,3 @@ break;

return function requestOptions(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
return function requestOptions(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
return _ref2.apply(this, arguments);

@@ -199,4 +199,4 @@ };

var callRequestOptions = useCallbackParam(function () {
requestOptionsParam(paramsRef, optionsCacheRef, debounceTimeout, sleep, function (reduceState) {
var callRequestOptions = useCallbackParam(function (caller) {
requestOptionsParam(caller, paramsRef, optionsCacheRef, debounceTimeout, sleep, function (reduceState) {
optionsCacheRef.current = reduceState(optionsCacheRef.current);

@@ -208,3 +208,3 @@

}, validateResponseParam, reduceOptions);
}, []);
}, [debounceTimeout]);
var handleScrolledToBottom = useCallbackParam(function () {

@@ -215,5 +215,5 @@ var currentInputValue = paramsRef.current.inputValue;

if (currentOptions) {
callRequestOptions();
callRequestOptions('menu-scroll');
}
}, []);
}, [callRequestOptions]);
useEffectParam(function () {

@@ -228,3 +228,3 @@ if (isInitRef.current) {

if (defaultOptions === true) {
callRequestOptions();
callRequestOptions('autoload');
}

@@ -234,3 +234,3 @@ }, deps);

if (menuIsOpen && !optionsCacheRef.current[inputValue]) {
callRequestOptions();
callRequestOptions('input-change');
}

@@ -240,3 +240,3 @@ }, [inputValue]);

if (menuIsOpen && !optionsCacheRef.current[''] && loadOptionsOnMenuOpen) {
callRequestOptions();
callRequestOptions('menu-toggle');
}

@@ -243,0 +243,0 @@ }, [menuIsOpen]);

import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["components", "selectRef", "useComponents", "useAsyncPaginate", "cacheUniqs"];
var _excluded = ["components", "selectRef", "isLoading", "useComponents", "useAsyncPaginate", "cacheUniqs"];
import { useAsyncPaginate } from './useAsyncPaginate';

@@ -12,2 +12,3 @@ import { useComponents } from './useComponents';

selectRef = props.selectRef,
isLoadingProp = props.isLoading,
useComponentsProp = props.useComponents,

@@ -20,3 +21,5 @@ useAsyncPaginateProp = props.useAsyncPaginate,

var processedComponents = useComponentsProp(components);
var isLoading = typeof isLoadingProp === 'boolean' ? isLoadingProp : asyncPaginateProps.isLoading;
return /*#__PURE__*/_jsx(SelectComponent, _objectSpread(_objectSpread(_objectSpread({}, props), asyncPaginateProps), {}, {
isLoading: isLoading,
components: processedComponents,

@@ -23,0 +26,0 @@ ref: selectRef

@@ -8,3 +8,3 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";

export var wrapMenuList = function wrapMenuList(MenuList) {
var WrappedMenuList = function WrappedMenuList(props) {
function WrappedMenuList(props) {
var _props$selectProps = props.selectProps,

@@ -55,3 +55,3 @@ handleScrolledToBottom = _props$selectProps.handleScrolledToBottom,

}));
};
}

@@ -58,0 +58,0 @@ WrappedMenuList.defaultProps = {

@@ -17,39 +17,39 @@ "use strict";

};
Object.defineProperty(exports, "withAsyncPaginate", {
exports.AsyncPaginate = void 0;
Object.defineProperty(exports, "reduceGroupedOptions", {
enumerable: true,
get: function get() {
return _withAsyncPaginate.withAsyncPaginate;
return _reduceGroupedOptions.reduceGroupedOptions;
}
});
Object.defineProperty(exports, "wrapMenuList", {
Object.defineProperty(exports, "useAsyncPaginate", {
enumerable: true,
get: function get() {
return _wrapMenuList.wrapMenuList;
return _useAsyncPaginate.useAsyncPaginate;
}
});
Object.defineProperty(exports, "reduceGroupedOptions", {
Object.defineProperty(exports, "useAsyncPaginateBase", {
enumerable: true,
get: function get() {
return _reduceGroupedOptions.reduceGroupedOptions;
return _useAsyncPaginateBase.useAsyncPaginateBase;
}
});
Object.defineProperty(exports, "useAsyncPaginateBase", {
Object.defineProperty(exports, "useComponents", {
enumerable: true,
get: function get() {
return _useAsyncPaginateBase.useAsyncPaginateBase;
return _useComponents.useComponents;
}
});
Object.defineProperty(exports, "useAsyncPaginate", {
Object.defineProperty(exports, "withAsyncPaginate", {
enumerable: true,
get: function get() {
return _useAsyncPaginate.useAsyncPaginate;
return _withAsyncPaginate.withAsyncPaginate;
}
});
Object.defineProperty(exports, "useComponents", {
Object.defineProperty(exports, "wrapMenuList", {
enumerable: true,
get: function get() {
return _useComponents.useComponents;
return _wrapMenuList.wrapMenuList;
}
});
exports.AsyncPaginate = void 0;

@@ -56,0 +56,0 @@ var _reactSelect = _interopRequireDefault(require("react-select"));

@@ -8,3 +8,3 @@ "use strict";

});
exports.useAsyncPaginate = exports.useAsyncPaginatePure = void 0;
exports.useAsyncPaginatePure = exports.useAsyncPaginate = void 0;

@@ -11,0 +11,0 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));

@@ -8,3 +8,3 @@ "use strict";

});
exports.useAsyncPaginateBase = exports.useAsyncPaginateBasePure = exports.increaseStateId = exports.requestOptions = exports.getInitialCache = exports.getInitialOptionsCache = exports.validateResponse = void 0;
exports.validateResponse = exports.useAsyncPaginateBasePure = exports.useAsyncPaginateBase = exports.requestOptions = exports.increaseStateId = exports.getInitialOptionsCache = exports.getInitialCache = void 0;

@@ -86,3 +86,3 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));

var requestOptions = /*#__PURE__*/function () {
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(paramsRef, optionsCacheRef, debounceTimeout, sleepParam, setOptionsCache, validateResponseParam, reduceOptions) {
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(caller, paramsRef, optionsCacheRef, debounceTimeout, sleepParam, setOptionsCache, validateResponseParam, reduceOptions) {
var currentInputValue, isCacheEmpty, currentOptions, newInputValue, response, hasError, loadOptions, _response, options, hasMore, newAdditional;

@@ -112,3 +112,3 @@

if (!(debounceTimeout > 0)) {
if (!(debounceTimeout > 0 && caller === 'input-change')) {
_context.next = 13;

@@ -195,3 +195,3 @@ break;

return function requestOptions(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
return function requestOptions(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
return _ref2.apply(this, arguments);

@@ -235,4 +235,4 @@ };

var callRequestOptions = useCallbackParam(function () {
requestOptionsParam(paramsRef, optionsCacheRef, debounceTimeout, _sleepPromise["default"], function (reduceState) {
var callRequestOptions = useCallbackParam(function (caller) {
requestOptionsParam(caller, paramsRef, optionsCacheRef, debounceTimeout, _sleepPromise["default"], function (reduceState) {
optionsCacheRef.current = reduceState(optionsCacheRef.current);

@@ -244,3 +244,3 @@

}, validateResponseParam, reduceOptions);
}, []);
}, [debounceTimeout]);
var handleScrolledToBottom = useCallbackParam(function () {

@@ -251,5 +251,5 @@ var currentInputValue = paramsRef.current.inputValue;

if (currentOptions) {
callRequestOptions();
callRequestOptions('menu-scroll');
}
}, []);
}, [callRequestOptions]);
useEffectParam(function () {

@@ -264,3 +264,3 @@ if (isInitRef.current) {

if (defaultOptions === true) {
callRequestOptions();
callRequestOptions('autoload');
}

@@ -270,3 +270,3 @@ }, deps);

if (menuIsOpen && !optionsCacheRef.current[inputValue]) {
callRequestOptions();
callRequestOptions('input-change');
}

@@ -276,3 +276,3 @@ }, [inputValue]);

if (menuIsOpen && !optionsCacheRef.current[''] && loadOptionsOnMenuOpen) {
callRequestOptions();
callRequestOptions('menu-toggle');
}

@@ -279,0 +279,0 @@ }, [menuIsOpen]);

@@ -8,3 +8,3 @@ "use strict";

});
exports.useComponents = exports.useComponentsPure = exports.MenuList = void 0;
exports.useComponentsPure = exports.useComponents = exports.MenuList = void 0;

@@ -11,0 +11,0 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));

@@ -20,3 +20,3 @@ "use strict";

var _excluded = ["components", "selectRef", "useComponents", "useAsyncPaginate", "cacheUniqs"];
var _excluded = ["components", "selectRef", "isLoading", "useComponents", "useAsyncPaginate", "cacheUniqs"];

@@ -28,2 +28,3 @@ function withAsyncPaginate( // eslint-disable-next-line @typescript-eslint/naming-convention

selectRef = props.selectRef,
isLoadingProp = props.isLoading,
useComponentsProp = props.useComponents,

@@ -35,3 +36,5 @@ useAsyncPaginateProp = props.useAsyncPaginate,

var processedComponents = useComponentsProp(components);
var isLoading = typeof isLoadingProp === 'boolean' ? isLoadingProp : asyncPaginateProps.isLoading;
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SelectComponent, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), asyncPaginateProps), {}, {
isLoading: isLoading,
components: processedComponents,

@@ -38,0 +41,0 @@ ref: selectRef

@@ -23,3 +23,3 @@ "use strict";

var wrapMenuList = function wrapMenuList(MenuList) {
var WrappedMenuList = function WrappedMenuList(props) {
function WrappedMenuList(props) {
var _props$selectProps = props.selectProps,

@@ -70,3 +70,3 @@ handleScrolledToBottom = _props$selectProps.handleScrolledToBottom,

}));
};
}

@@ -73,0 +73,0 @@ WrappedMenuList.defaultProps = {

{
"name": "react-select-async-paginate",
"version": "0.6.0",
"version": "0.6.1",
"description": "Wrapper above react-select that supports pagination on menu scroll",

@@ -24,3 +24,3 @@ "main": "lib/index.js",

"scripts": {
"clean": "rimraf es lib ts",
"clean": "rm -rf es lib ts",
"build": "yarn build:cjs && yarn build:es && yarn build:ts",

@@ -42,3 +42,3 @@ "build:cjs": "cross-env BABEL_ENV=cjs babel --root-mode upward --extensions '.ts,.tsx' src --out-dir lib --ignore \"src/**/__tests__\"",

"dependencies": {
"@babel/runtime": "^7.15.4",
"@babel/runtime": "^7.16.5",
"@seznam/compose-react-refs": "^1.0.6",

@@ -49,26 +49,29 @@ "react-is-mounted-hook": "^1.1.2",

"devDependencies": {
"@babel/cli": "^7.15.7",
"@storybook/react": "^6.3.8",
"@types/enzyme": "^3.10.9",
"@types/jest": "^27.0.2",
"@types/react": "^17.0.24",
"@typescript-eslint/eslint-plugin": "^4.32.0",
"@typescript-eslint/parser": "^4.32.0",
"@babel/cli": "^7.16.0",
"@mdx-js/react": "^1.6.22",
"@storybook/addon-controls": "^6.4.9",
"@storybook/addon-docs": "^6.4.9",
"@storybook/react": "^6.4.9",
"@types/enzyme": "^3.10.10",
"@types/jest": "^27.0.3",
"@types/react": "^17.0.38",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0",
"cross-env": "^7.0.3",
"enzyme": "^3.11.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-typescript": "^14.0.0",
"eslint": "^8.5.0",
"eslint-config-airbnb-typescript": "^16.1.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^24.4.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.26.0",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^27.2.3",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"jest": "^27.4.5",
"react": "^17.0.2",
"react-select": "^5.0.0",
"ts-jest": "^27.0.5",
"typescript": "4.3.5"
"react-select": "^5.2.1",
"ts-jest": "^27.1.2",
"typescript": "^4.5.4"
}
}

@@ -11,3 +11,4 @@ import { useState, useEffect, useRef, useCallback } from 'react';

declare type SetOptionsCache<OptionType, Group extends GroupBase<OptionType>, Additional> = (stateMapper: MapOptionsCache<OptionType, Group, Additional>) => void;
export declare const requestOptions: <OptionType, Group extends GroupBase<OptionType>, Additional>(paramsRef: {
declare type RequestOptionsCallerType = 'autoload' | 'menu-toggle' | 'input-change' | 'menu-scroll';
export declare const requestOptions: <OptionType, Group extends GroupBase<OptionType>, Additional>(caller: RequestOptionsCallerType, paramsRef: {
current: UseAsyncPaginateBaseParams<OptionType, Group, Additional>;

@@ -14,0 +15,0 @@ }, optionsCacheRef: {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc