aport-tools 4.4.14 → 4.4.15
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/index.esm.js +7 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.15 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
@@ -768,12 +768,14 @@ var InputList = function InputList(_a) {
|
|
768
768
|
return firstValue.includes(opt.value);
|
769
769
|
});
|
770
770
|
var _l = React.useState(multi ? initialSelections : initialSelections[0] || null),
|
771
|
-
selectedOptions = _l[0]
|
772
|
-
_l[1];
|
771
|
+
selectedOptions = _l[0],
|
772
|
+
setSelectedOptions = _l[1];
|
773
773
|
// Update form value on mount if firstValue is provided
|
774
774
|
React.useEffect(function () {
|
775
|
-
|
776
|
-
|
775
|
+
if (Array.isArray(firstValue) && firstValue.length > 0) {
|
776
|
+
setSelectedOptions(firstValue);
|
777
|
+
}
|
778
|
+
}, [firstValue, setSelectedOptions]); // Dependencies are properly set.
|
777
779
|
/**
|
778
780
|
* Handles selection of an option. Adds or removes the option from selectedOptions based on
|
779
781
|
* multi-selection and maxSelection criteria.
|