@rpg-engine/long-bow 0.3.88 → 0.3.90

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.
@@ -25,6 +25,7 @@ interface IProps {
25
25
  isContextMenuDisabled?: boolean;
26
26
  isSelectingShortcut?: boolean;
27
27
  equipmentSet?: IEquipmentSet | null;
28
+ setItemShortcut?: (item: IItem, shortcutIndex: number) => void;
28
29
  isDepotSystem?: boolean;
29
30
  }
30
31
  export declare const ItemSlot: React.FC<IProps>;
@@ -33300,7 +33300,7 @@ var Container$6 = /*#__PURE__*/styled.div.withConfig({
33300
33300
  var CloseButton$1 = /*#__PURE__*/styled.div.withConfig({
33301
33301
  displayName: "DraggableContainer__CloseButton",
33302
33302
  componentId: "sc-184mpyl-1"
33303
- })(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:1.1rem;"]);
33303
+ })(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:1.1rem;@media (max-width:768px){font-size:1.3rem;padding:3px;}"]);
33304
33304
  var TitleContainer = /*#__PURE__*/styled.div.withConfig({
33305
33305
  displayName: "DraggableContainer__TitleContainer",
33306
33306
  componentId: "sc-184mpyl-2"
@@ -33332,9 +33332,21 @@ var Dropdown = function Dropdown(_ref) {
33332
33332
  setOpened = _useState3[1];
33333
33333
  React.useEffect(function () {
33334
33334
  var firstOption = options[0];
33335
- if (firstOption && !selectedValue) {
33336
- setSelectedValue(firstOption.value);
33337
- setSelectedOption(firstOption.option);
33335
+ if (firstOption) {
33336
+ var change = !selectedValue;
33337
+ if (!change) {
33338
+ change = options.filter(function (o) {
33339
+ return o.value === selectedValue;
33340
+ }).length < 1;
33341
+ }
33342
+ /**
33343
+ * make a selection if there is no selected value already present
33344
+ * or if there is a selected value but its not in new options
33345
+ */
33346
+ if (change) {
33347
+ setSelectedValue(firstOption.value);
33348
+ setSelectedOption(firstOption.option);
33349
+ }
33338
33350
  }
33339
33351
  }, [options]);
33340
33352
  React.useEffect(function () {
@@ -33382,7 +33394,7 @@ var DropdownSelect = /*#__PURE__*/styled.p.withConfig({
33382
33394
  var DropdownOptions = /*#__PURE__*/styled.ul.withConfig({
33383
33395
  displayName: "Dropdown__DropdownOptions",
33384
33396
  componentId: "sc-8arn65-2"
33385
- })(["position:absolute;width:100%;display:", ";box-sizing:border-box;"], function (props) {
33397
+ })(["position:absolute;width:100%;display:", ";box-sizing:border-box;@media (max-width:768px){padding:8px 0;}"], function (props) {
33386
33398
  return props.opened ? 'block' : 'none';
33387
33399
  });
33388
33400
 
@@ -33659,6 +33671,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33659
33671
  dragScale = _ref.dragScale,
33660
33672
  isSelectingShortcut = _ref.isSelectingShortcut,
33661
33673
  equipmentSet = _ref.equipmentSet,
33674
+ setItemShortcut = _ref.setItemShortcut,
33662
33675
  isDepotSystem = _ref.isDepotSystem;
33663
33676
  var _useState = React.useState(false),
33664
33677
  isTooltipVisible = _useState[0],
@@ -33844,6 +33857,13 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33844
33857
  defaultClassName: item ? 'draggable' : 'empty-slot',
33845
33858
  scale: dragScale,
33846
33859
  onStop: function onStop(e, data) {
33860
+ var target = e.target;
33861
+ if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
33862
+ var index = parseInt(target.id.split('_')[1]);
33863
+ if (!isNaN(index)) {
33864
+ setItemShortcut(item, index);
33865
+ }
33866
+ }
33847
33867
  if (wasDragged && item && !isSelectingShortcut) {
33848
33868
  var _e$target;
33849
33869
  //@ts-ignore
@@ -33858,9 +33878,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33858
33878
  });
33859
33879
  }
33860
33880
  setWasDragged(false);
33861
- var target = dragContainer.current;
33862
- if (!target || !wasDragged) return;
33863
- var style = window.getComputedStyle(target);
33881
+ var _target = dragContainer.current;
33882
+ if (!_target || !wasDragged) return;
33883
+ var style = window.getComputedStyle(_target);
33864
33884
  var matrix = new DOMMatrixReadOnly(style.transform);
33865
33885
  var x = matrix.m41;
33866
33886
  var y = matrix.m42;
@@ -34468,7 +34488,7 @@ var RadioOptionsWrapper = /*#__PURE__*/styled.div.withConfig({
34468
34488
  var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
34469
34489
  displayName: "CraftBook__ButtonWrapper",
34470
34490
  componentId: "sc-19q95ue-7"
34471
- })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
34491
+ })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;button{padding:0px 50px;}"]);
34472
34492
 
34473
34493
  var DropdownSelectorContainer = function DropdownSelectorContainer(_ref) {
34474
34494
  var title = _ref.title,
@@ -35383,11 +35403,13 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
35383
35403
  return React__default.createElement(Shortcut, {
35384
35404
  key: i,
35385
35405
  onPointerDown: function onPointerDown() {
35406
+ if (settingShortcutIndex !== -1) setSettingShortcutIndex(-1);
35386
35407
  removeShortcut(i);
35387
- if (!shortcuts[i] || shortcuts[i].type === shared.ShortcutType.None) setSettingShortcutIndex(i);
35408
+ if (settingShortcutIndex === -1 && (!shortcuts[i] || shortcuts[i].type === shared.ShortcutType.None)) setSettingShortcutIndex(i);
35388
35409
  },
35389
35410
  disabled: settingShortcutIndex !== -1 && settingShortcutIndex !== i,
35390
- isBeingSet: settingShortcutIndex === i
35411
+ isBeingSet: settingShortcutIndex === i,
35412
+ id: "shortcutSetter_" + i
35391
35413
  }, getContent(i));
35392
35414
  })));
35393
35415
  };
@@ -35443,6 +35465,11 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35443
35465
  var _useState2 = React.useState(-1),
35444
35466
  settingShortcutIndex = _useState2[0],
35445
35467
  setSettingShortcutIndex = _useState2[1];
35468
+ var handleSetShortcut = function handleSetShortcut(item, index) {
35469
+ if (item.type === shared.ItemType.Consumable || item.type === shared.ItemType.Tool) {
35470
+ setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
35471
+ }
35472
+ };
35446
35473
  var onRenderSlots = function onRenderSlots() {
35447
35474
  var slots = [];
35448
35475
  for (var i = 0; i < itemContainer.slotQty; i++) {
@@ -35459,9 +35486,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35459
35486
  onPointerDown: function onPointerDown(itemType, containerType, item) {
35460
35487
  if (settingShortcutIndex !== -1) {
35461
35488
  setSettingShortcutIndex(-1);
35462
- if (itemType === shared.ItemType.Consumable || itemType === shared.ItemType.Tool) {
35463
- setItemShortcut == null ? void 0 : setItemShortcut(item.key, settingShortcutIndex);
35464
- }
35489
+ handleSetShortcut(item, settingShortcutIndex);
35465
35490
  } else if (onItemClick) onItemClick(item, itemType, containerType);
35466
35491
  },
35467
35492
  onSelected: function onSelected(optionId, item) {
@@ -35493,6 +35518,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35493
35518
  atlasJSON: atlasJSON,
35494
35519
  isSelectingShortcut: settingShortcutIndex !== -1,
35495
35520
  equipmentSet: equipmentSet,
35521
+ setItemShortcut: type === shared.ItemContainerType.Inventory ? handleSetShortcut : undefined,
35496
35522
  isDepotSystem: isDepotSystem
35497
35523
  }));
35498
35524
  }
@@ -36702,7 +36728,7 @@ var AlertWrapper = /*#__PURE__*/styled.div.withConfig({
36702
36728
  var ButtonWrapper$2 = /*#__PURE__*/styled.div.withConfig({
36703
36729
  displayName: "TradingMenu__ButtonWrapper",
36704
36730
  componentId: "sc-1wjsz1l-6"
36705
- })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;margin-top:1rem;"]);
36731
+ })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;margin-top:1rem;button{padding:0px 50px;}"]);
36706
36732
 
36707
36733
  /* eslint-disable react/require-default-props */
36708
36734
  var Truncate = function Truncate(_ref) {