@rpg-engine/long-bow 0.8.15 → 0.8.17

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.
@@ -1,10 +1,14 @@
1
1
  import React from 'react';
2
- interface Props {
2
+ interface IItemPropertySimpleHandlerProps {
3
3
  isOpen: boolean;
4
4
  selectedColor: string;
5
5
  onClose: () => void;
6
6
  onConfirm: (color: string) => void;
7
7
  onChange: (color: string) => void;
8
+ costWarning?: {
9
+ cost: number;
10
+ currency?: string;
11
+ };
8
12
  }
9
- export declare const ItemPropertySimpleHandler: React.FC<Props>;
13
+ export declare const ItemPropertySimpleHandler: React.FC<IItemPropertySimpleHandlerProps>;
10
14
  export {};
@@ -28677,10 +28677,11 @@ var modifyString = function modifyString(str) {
28677
28677
  return modifiedWords.join(' ');
28678
28678
  };
28679
28679
 
28680
+ var OFFSET = 20;
28680
28681
  var TooltipContainer = /*#__PURE__*/styled__default.div.withConfig({
28681
28682
  displayName: "CraftingTooltip__TooltipContainer",
28682
28683
  componentId: "sc-iqzgok-0"
28683
- })(["position:fixed;left:", "px;top:", "px;background-color:rgba(0,0,0,0.95);color:white;text-align:left;border-radius:4px;padding:10px;z-index:1000;font-family:'Press Start 2P',cursive;font-size:0.6rem;width:max-content;max-width:250px;white-space:normal;border:1px solid ", ";box-shadow:0 2px 4px rgba(0,0,0,0.2);line-height:1.4;&:before{content:'';position:absolute;top:12px;left:-6px;border-width:6px 6px 6px 0;border-style:solid;border-color:transparent rgba(0,0,0,0.95) transparent transparent;}"], function (props) {
28684
+ })(["position:fixed;left:", "px;top:", "px;background-color:rgba(0,0,0,0.95);color:white;text-align:left;border-radius:4px;padding:10px;z-index:1000;font-family:'Press Start 2P',cursive;font-size:0.6rem;width:max-content;max-width:250px;white-space:normal;border:1px solid ", ";box-shadow:0 2px 4px rgba(0,0,0,0.2);line-height:1.4;"], function (props) {
28684
28685
  return props.x;
28685
28686
  }, function (props) {
28686
28687
  return props.y;
@@ -28716,11 +28717,47 @@ var CraftingTooltip = function CraftingTooltip(_ref3) {
28716
28717
  skills = _ref3.skills,
28717
28718
  atlasIMG = _ref3.atlasIMG,
28718
28719
  atlasJSON = _ref3.atlasJSON;
28720
+ var tooltipRef = React.useRef(null);
28721
+ var _React$useState = React__default.useState({
28722
+ x: x,
28723
+ y: y
28724
+ }),
28725
+ adjustedPosition = _React$useState[0],
28726
+ setAdjustedPosition = _React$useState[1];
28727
+ React.useEffect(function () {
28728
+ var tooltipElement = tooltipRef.current;
28729
+ if (tooltipElement) {
28730
+ var rect = tooltipElement.getBoundingClientRect();
28731
+ var tooltipWidth = rect.width;
28732
+ var tooltipHeight = rect.height;
28733
+ var adjustedX = x;
28734
+ var adjustedY = y;
28735
+ // If tooltip would go off the right edge, show it on the left side of the cursor
28736
+ if (x + tooltipWidth + OFFSET > window.innerWidth) {
28737
+ adjustedX = x - tooltipWidth - OFFSET;
28738
+ } else {
28739
+ // Otherwise, show it on the right side of the cursor
28740
+ adjustedX = x + OFFSET;
28741
+ }
28742
+ // Vertical positioning
28743
+ if (y + tooltipHeight > window.innerHeight) {
28744
+ adjustedY = window.innerHeight - tooltipHeight - OFFSET;
28745
+ }
28746
+ if (y < OFFSET) {
28747
+ adjustedY = OFFSET;
28748
+ }
28749
+ setAdjustedPosition({
28750
+ x: adjustedX,
28751
+ y: adjustedY
28752
+ });
28753
+ }
28754
+ }, [x, y]);
28719
28755
  var levelInSkill = (_skills$level = skills == null ? void 0 : (_skills = skills[(_recipe$minCraftingRe = recipe == null ? void 0 : (_recipe$minCraftingRe2 = recipe.minCraftingRequirements) == null ? void 0 : _recipe$minCraftingRe2[0]) != null ? _recipe$minCraftingRe : '']) == null ? void 0 : _skills.level) != null ? _skills$level : 1;
28720
28756
  var levelIsOk = (_recipe$levelIsOk = recipe == null ? void 0 : recipe.levelIsOk) != null ? _recipe$levelIsOk : false;
28721
28757
  return React__default.createElement(TooltipContainer, {
28722
- x: x,
28723
- y: y
28758
+ ref: tooltipRef,
28759
+ x: adjustedPosition.x,
28760
+ y: adjustedPosition.y
28724
28761
  }, React__default.createElement(TooltipTitle, null, "Skill Requirements"), React__default.createElement(MinCraftingRequirementsText, {
28725
28762
  levelIsOk: levelIsOk
28726
28763
  }, modifyString("" + ((_recipe$minCraftingRe3 = recipe == null ? void 0 : (_recipe$minCraftingRe4 = recipe.minCraftingRequirements) == null ? void 0 : _recipe$minCraftingRe4[0]) != null ? _recipe$minCraftingRe3 : '')), " lvl", ' ', (_recipe$minCraftingRe5 = recipe == null ? void 0 : (_recipe$minCraftingRe6 = recipe.minCraftingRequirements) == null ? void 0 : _recipe$minCraftingRe6[1]) != null ? _recipe$minCraftingRe5 : 0, " (", levelInSkill, ")"), React__default.createElement(TooltipTitle, null, "Ingredients"), recipe.ingredients.map(function (ingredient, index) {
@@ -29483,7 +29520,7 @@ var useCursorPosition = function useCursorPosition(_ref) {
29483
29520
  };
29484
29521
 
29485
29522
  var CONTAINER_SIZE = 32;
29486
- var OFFSET = CONTAINER_SIZE / 2;
29523
+ var OFFSET$1 = CONTAINER_SIZE / 2;
29487
29524
  var DraggedItem = function DraggedItem(_ref) {
29488
29525
  var _item$_id, _item$stackQty;
29489
29526
  var atlasJSON = _ref.atlasJSON,
@@ -29503,8 +29540,8 @@ var DraggedItem = function DraggedItem(_ref) {
29503
29540
  if (x === 0 && y === 0) {
29504
29541
  return null;
29505
29542
  }
29506
- var centeredX = x - OFFSET;
29507
- var centeredY = y - OFFSET;
29543
+ var centeredX = x - OFFSET$1;
29544
+ var centeredY = y - OFFSET$1;
29508
29545
  var stackInfo = onRenderStackInfo((_item$_id = item == null ? void 0 : item._id) != null ? _item$_id : '', (_item$stackQty = item == null ? void 0 : item.stackQty) != null ? _item$stackQty : 0);
29509
29546
  return React__default.createElement(Container$e, null, React__default.createElement(SpriteContainer, {
29510
29547
  x: centeredX,
@@ -32908,13 +32945,15 @@ var ItemPropertySimpleHandler = function ItemPropertySimpleHandler(_ref) {
32908
32945
  selectedColor = _ref.selectedColor,
32909
32946
  onClose = _ref.onClose,
32910
32947
  onConfirm = _ref.onConfirm,
32911
- onChange = _ref.onChange;
32948
+ onChange = _ref.onChange,
32949
+ costWarning = _ref.costWarning;
32912
32950
  return React__default.createElement(ColorSelector, {
32913
32951
  selectedColor: selectedColor,
32914
32952
  isOpen: isOpen,
32915
32953
  onClose: onClose,
32916
32954
  onConfirm: onConfirm,
32917
- onChange: onChange
32955
+ onChange: onChange,
32956
+ costWarning: costWarning
32918
32957
  });
32919
32958
  };
32920
32959