@nulogy/components 8.4.0 → 8.4.1

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/main.js CHANGED
@@ -23339,20 +23339,23 @@
23339
23339
  var themeContext = React__default['default'].useContext(styled.ThemeContext);
23340
23340
  var spaceProps = getSubset(props, propTypes.space);
23341
23341
  var reactSelectRef = React__default['default'].useRef(null);
23342
+ var optionsRef = React__default['default'].useRef(options);
23342
23343
  React__default['default'].useEffect(function () {
23343
23344
  checkOptionsAreValid(options);
23345
+ optionsRef.current = options;
23344
23346
  }, [options]);
23345
23347
  var handleChange = React__default['default'].useCallback(function (option) {
23346
23348
  onChange && onChange(extractValue(option, multiselect));
23347
23349
  }, [multiselect, onChange]);
23348
23350
  var handlePaste = React__default['default'].useCallback(function (e) {
23349
23351
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
23350
- var currentRef, currentValue, clipboardData, values, notExistingOptions, pastedOptions, newValue;
23352
+ var options, currentRef, currentValue, clipboardData, values, notExistingOptions, pastedOptions, newValue;
23351
23353
  return regenerator.wrap(function _callee$(_context) {
23352
23354
  while (1) {
23353
23355
  switch (_context.prev = _context.next) {
23354
23356
  case 0:
23355
23357
  e.preventDefault();
23358
+ options = optionsRef.current;
23356
23359
  currentRef = reactSelectRef.current;
23357
23360
  currentValue = currentRef.state.value || [];
23358
23361
  clipboardData = e.clipboardData.getData("text/plain") || "";
@@ -23385,20 +23388,20 @@
23385
23388
  });
23386
23389
  handleChange(newValue);
23387
23390
 
23388
- case 10:
23391
+ case 11:
23389
23392
  case "end":
23390
23393
  return _context.stop();
23391
23394
  }
23392
23395
  }
23393
23396
  }, _callee);
23394
23397
  }));
23395
- }, [options]);
23398
+ }, []);
23396
23399
 
23397
23400
  var _SelectInput = React__default['default'].useCallback(function (inputProps) {
23398
23401
  return /*#__PURE__*/React__default['default'].createElement(SelectInput, Object.assign({}, inputProps, multiselect ? {
23399
23402
  onPaste: handlePaste
23400
23403
  } : {}));
23401
- }, [handlePaste, multiselect]);
23404
+ }, [multiselect]);
23402
23405
 
23403
23406
  React__default['default'].useEffect(function () {
23404
23407
  if (ref) {
@@ -23313,20 +23313,23 @@ var ReactSelect = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
23313
23313
  var themeContext = React__default.useContext(ThemeContext$1);
23314
23314
  var spaceProps = getSubset(props, propTypes.space);
23315
23315
  var reactSelectRef = React__default.useRef(null);
23316
+ var optionsRef = React__default.useRef(options);
23316
23317
  React__default.useEffect(function () {
23317
23318
  checkOptionsAreValid(options);
23319
+ optionsRef.current = options;
23318
23320
  }, [options]);
23319
23321
  var handleChange = React__default.useCallback(function (option) {
23320
23322
  onChange && onChange(extractValue(option, multiselect));
23321
23323
  }, [multiselect, onChange]);
23322
23324
  var handlePaste = React__default.useCallback(function (e) {
23323
23325
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
23324
- var currentRef, currentValue, clipboardData, values, notExistingOptions, pastedOptions, newValue;
23326
+ var options, currentRef, currentValue, clipboardData, values, notExistingOptions, pastedOptions, newValue;
23325
23327
  return regenerator.wrap(function _callee$(_context) {
23326
23328
  while (1) {
23327
23329
  switch (_context.prev = _context.next) {
23328
23330
  case 0:
23329
23331
  e.preventDefault();
23332
+ options = optionsRef.current;
23330
23333
  currentRef = reactSelectRef.current;
23331
23334
  currentValue = currentRef.state.value || [];
23332
23335
  clipboardData = e.clipboardData.getData("text/plain") || "";
@@ -23359,20 +23362,20 @@ var ReactSelect = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
23359
23362
  });
23360
23363
  handleChange(newValue);
23361
23364
 
23362
- case 10:
23365
+ case 11:
23363
23366
  case "end":
23364
23367
  return _context.stop();
23365
23368
  }
23366
23369
  }
23367
23370
  }, _callee);
23368
23371
  }));
23369
- }, [options]);
23372
+ }, []);
23370
23373
 
23371
23374
  var _SelectInput = React__default.useCallback(function (inputProps) {
23372
23375
  return /*#__PURE__*/React__default.createElement(SelectInput, Object.assign({}, inputProps, multiselect ? {
23373
23376
  onPaste: handlePaste
23374
23377
  } : {}));
23375
- }, [handlePaste, multiselect]);
23378
+ }, [multiselect]);
23376
23379
 
23377
23380
  React__default.useEffect(function () {
23378
23381
  if (ref) {
@@ -109,3 +109,4 @@ export declare const UsingRefToControlFocus: {
109
109
  };
110
110
  export declare const WithCustomProps: () => JSX.Element;
111
111
  export declare const PasteCsvValueInSelect: (props: any) => JSX.Element;
112
+ export declare const AddNewOptionOnInputChange: (props: any) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ declare const simulatedAPIRequest: (inputValue: string, data: {
2
+ value: string;
3
+ label: string;
4
+ }[], milliseconds?: number) => Promise<Response>;
5
+ export default simulatedAPIRequest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "8.4.0",
3
+ "version": "8.4.1",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {