@rpg-engine/long-bow 0.5.59 → 0.5.61

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.
@@ -14792,27 +14792,36 @@ var ItemTypes = /*#__PURE__*/styled.div.withConfig({
14792
14792
  })(["display:flex;overflow-y:scroll;overflow-x:hidden;width:max-content;flex-direction:column;padding-right:5px;@media (max-width:", "){overflow-x:scroll;overflow-y:hidden;padding-right:0;width:100%;}"], mobilePortrait.width);
14793
14793
 
14794
14794
  var Dropdown = function Dropdown(_ref) {
14795
- var _options$, _options$2;
14795
+ var _options$, _options$find, _options$2;
14796
14796
  var options = _ref.options,
14797
14797
  width = _ref.width,
14798
- onChange = _ref.onChange;
14798
+ onChange = _ref.onChange,
14799
+ defaultValue = _ref.defaultValue;
14799
14800
  var dropdownId = v4();
14800
- var _useState = useState(options == null ? void 0 : (_options$ = options[0]) == null ? void 0 : _options$.value),
14801
+ var _useState = useState(defaultValue || (options == null ? void 0 : (_options$ = options[0]) == null ? void 0 : _options$.value)),
14801
14802
  selectedValue = _useState[0],
14802
14803
  setSelectedValue = _useState[1];
14803
- var _useState2 = useState(options == null ? void 0 : (_options$2 = options[0]) == null ? void 0 : _options$2.option),
14804
+ var _useState2 = useState((options == null ? void 0 : (_options$find = options.find(function (option) {
14805
+ return option.value === defaultValue;
14806
+ })) == null ? void 0 : _options$find.option) || (options == null ? void 0 : (_options$2 = options[0]) == null ? void 0 : _options$2.option)),
14804
14807
  selectedOption = _useState2[0],
14805
14808
  setSelectedOption = _useState2[1];
14806
14809
  var _useState3 = useState(false),
14807
14810
  opened = _useState3[0],
14808
14811
  setOpened = _useState3[1];
14809
14812
  useEffect(function () {
14810
- if ((options == null ? void 0 : options.length) > 0) {
14813
+ if (defaultValue) {
14814
+ var _options$find2;
14815
+ setSelectedValue(defaultValue);
14816
+ setSelectedOption( //@ts-ignore
14817
+ options == null ? void 0 : (_options$find2 = options.find(function (option) {
14818
+ return option.value === defaultValue;
14819
+ })) == null ? void 0 : _options$find2.option);
14820
+ } else if ((options == null ? void 0 : options.length) > 0) {
14811
14821
  setSelectedValue(options[0].value);
14812
14822
  setSelectedOption(options[0].option);
14813
- onChange(options[0].value);
14814
14823
  }
14815
- }, [options]);
14824
+ }, [options, defaultValue]);
14816
14825
  var handleSelection = function handleSelection(value, option) {
14817
14826
  if (value !== selectedValue) {
14818
14827
  setSelectedValue(value);