Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@amsterdam/amsterdam-react-final-form

Package Overview
Dependencies
Maintainers
9
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amsterdam/amsterdam-react-final-form - npm Package Compare versions

Comparing version 0.1.112 to 0.1.113

10

components/final-form/SelectField/ComplexSelectField.js

@@ -65,3 +65,2 @@ "use strict";

}), _c = _b.input, onChange = _c.onChange, value = _c.value, meta = _b.meta;
var _d = react_1.useState({}), mappedOptions = _d[0], setMappedOptions = _d[1];
// We map complex objects in a 'simple' structure `UnboundSelectField` understands.

@@ -76,10 +75,11 @@ //

// Whenever a change happens, we map back to the original object and call onChange with it.
react_1.useEffect(function () { setMappedOptions(options.reduce(function (acc, option, index) {
var mappedOptions = options.reduce(function (acc, option, index) {
var _a;
return (__assign((_a = {}, _a[index] = option[optionLabelField], _a), acc));
}, {})); }, [options, optionLabelField, setMappedOptions]);
}, {});
// On change, map back to original object:
var handleChange = react_1.useCallback(function (e) { onChange(options[e.target.value]); }, [onChange, options]);
return react_1["default"].createElement(UnboundSelectField_1["default"], __assign({ name: name, error: meta.modified && meta.error, options: mappedOptions, onChange: handleChange, value: findIndex_1.findIndex(options, value).toString() }, restProps));
var handleChange = react_1.useCallback(function (e) { return onChange(options[e.target.value]); }, [onChange, options]);
var index = findIndex_1.findIndex(options, value);
return react_1["default"].createElement(UnboundSelectField_1["default"], __assign({ name: name, error: meta.modified && meta.error, options: mappedOptions, onChange: handleChange, value: index > -1 ? index.toString() : undefined }, restProps));
}
exports["default"] = ComplexSelectField;
{
"name": "@amsterdam/amsterdam-react-final-form",
"version": "0.1.112",
"version": "0.1.113",
"private": false,

@@ -5,0 +5,0 @@ "repository": "https://github.com/amsterdam/amsterdam-react-final-form.git",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc