@rpg-engine/long-bow 0.7.91 → 0.7.92

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.
Files changed (35) hide show
  1. package/dist/components/CraftBook/CraftingTooltip.d.ts +13 -0
  2. package/dist/components/CraftBook/components/CraftBookHeader.d.ts +9 -0
  3. package/dist/components/CraftBook/components/CraftBookPagination.d.ts +0 -0
  4. package/dist/components/CraftBook/components/CraftBookSearch.d.ts +0 -0
  5. package/dist/components/CraftBook/hooks/useCraftBookFilters.d.ts +9 -0
  6. package/dist/components/CraftBook/hooks/useFilteredItems.d.ts +9 -0
  7. package/dist/components/CraftBook/hooks/usePagination.d.ts +13 -0
  8. package/dist/components/CraftBook/hooks/useResponsiveSize.d.ts +6 -0
  9. package/dist/components/CraftBook/utils/modifyString.d.ts +1 -0
  10. package/dist/components/shared/Pagination/Pagination.d.ts +9 -0
  11. package/dist/components/shared/SearchBar/SearchBar.d.ts +10 -0
  12. package/dist/hooks/useLocalStorage.d.ts +1 -0
  13. package/dist/long-bow.cjs.development.js +448 -293
  14. package/dist/long-bow.cjs.development.js.map +1 -1
  15. package/dist/long-bow.cjs.production.min.js +1 -1
  16. package/dist/long-bow.cjs.production.min.js.map +1 -1
  17. package/dist/long-bow.esm.js +448 -294
  18. package/dist/long-bow.esm.js.map +1 -1
  19. package/dist/stories/Features/craftbook/CraftBook.stories.d.ts +2 -0
  20. package/package.json +1 -1
  21. package/src/components/CraftBook/CraftBook.tsx +281 -138
  22. package/src/components/CraftBook/CraftingRecipe.tsx +97 -97
  23. package/src/components/CraftBook/CraftingTooltip.tsx +137 -0
  24. package/src/components/CraftBook/components/CraftBookHeader.tsx +81 -0
  25. package/src/components/CraftBook/components/CraftBookPagination.tsx +1 -0
  26. package/src/components/CraftBook/components/CraftBookSearch.tsx +1 -0
  27. package/src/components/CraftBook/hooks/useCraftBookFilters.ts +39 -0
  28. package/src/components/CraftBook/hooks/useFilteredItems.ts +39 -0
  29. package/src/components/CraftBook/hooks/usePagination.ts +39 -0
  30. package/src/components/CraftBook/hooks/useResponsiveSize.ts +50 -0
  31. package/src/components/CraftBook/utils/modifyString.ts +11 -0
  32. package/src/components/shared/Pagination/Pagination.tsx +69 -0
  33. package/src/components/shared/SearchBar/SearchBar.tsx +52 -0
  34. package/src/hooks/useLocalStorage.ts +44 -0
  35. package/src/stories/Features/craftbook/CraftBook.stories.tsx +41 -1
@@ -17,7 +17,8 @@ var fa = require('react-icons/fa');
17
17
  var rx = require('react-icons/rx');
18
18
  var io = require('react-icons/io');
19
19
  var Draggable = _interopDefault(require('react-draggable'));
20
- var ReactDOM = _interopDefault(require('react-dom'));
20
+ var ReactDOM = require('react-dom');
21
+ var ReactDOM__default = _interopDefault(ReactDOM);
21
22
  var lodash = require('lodash');
22
23
  var mobxReactLite = require('mobx-react-lite');
23
24
  var ai = require('react-icons/ai');
@@ -27163,6 +27164,47 @@ var StyledShortcut = /*#__PURE__*/styled__default(SingleShortcut).withConfig({
27163
27164
  componentId: "sc-1fewf3h-4"
27164
27165
  })(["width:2.5rem;height:2.5rem;transition:all 0.1s;.mana,.qty{font-size:0.5rem;}&:hover,&:focus,&:active{background-color:", ";}&.active{background-color:", ";border-color:", ";}"], uiColors.lightGray, uiColors.gray, uiColors.yellow);
27165
27166
 
27167
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
27168
+ function useLocalStorage(key, initialValue) {
27169
+ // State to store our value
27170
+ // Pass initial state function to useState so logic is only executed once
27171
+ var _useState = React.useState(function () {
27172
+ if (typeof window === 'undefined') {
27173
+ return initialValue;
27174
+ }
27175
+ try {
27176
+ // Get from local storage by key
27177
+ var item = window.localStorage.getItem(key);
27178
+ // Parse stored json or if none return initialValue
27179
+ return item ? JSON.parse(item) : initialValue;
27180
+ } catch (error) {
27181
+ // If error also return initialValue
27182
+ console.log(error);
27183
+ return initialValue;
27184
+ }
27185
+ }),
27186
+ storedValue = _useState[0],
27187
+ setStoredValue = _useState[1];
27188
+ // Return a wrapped version of useState's setter function that ...
27189
+ // ... persists the new value to localStorage.
27190
+ var setValue = function setValue(value) {
27191
+ try {
27192
+ // Allow value to be a function so we have same API as useState
27193
+ var valueToStore = value instanceof Function ? value(storedValue) : value;
27194
+ // Save state
27195
+ setStoredValue(valueToStore);
27196
+ // Save to local storage
27197
+ if (typeof window !== 'undefined') {
27198
+ window.localStorage.setItem(key, JSON.stringify(valueToStore));
27199
+ }
27200
+ } catch (error) {
27201
+ // A more advanced implementation would handle the error case
27202
+ console.log(error);
27203
+ }
27204
+ };
27205
+ return [storedValue, setValue];
27206
+ }
27207
+
27166
27208
  function useOutsideClick(ref, id) {
27167
27209
  React.useEffect(function () {
27168
27210
  /**
@@ -27325,54 +27367,99 @@ var Icon = /*#__PURE__*/styled__default.img.withConfig({
27325
27367
  return width;
27326
27368
  });
27327
27369
 
27328
- var InputRadio = function InputRadio(_ref) {
27329
- var label = _ref.label,
27330
- name = _ref.name,
27331
- value = _ref.value,
27332
- isChecked = _ref.isChecked,
27333
- onRadioSelect = _ref.onRadioSelect;
27334
- var onRadioClick = function onRadioClick() {
27335
- onRadioSelect(value);
27336
- };
27337
- return React__default.createElement("div", {
27338
- onPointerUp: onRadioClick
27339
- }, React__default.createElement("input", {
27340
- className: "rpgui-radio",
27341
- name: name,
27342
- value: value,
27343
- type: "radio",
27344
- "data-rpguitype": "radio",
27345
- checked: isChecked,
27346
- // rpgui breaks onChange on this input (doesn't work). That's why I had to wrap it with a div and a onClick listener.
27347
- readOnly: true
27348
- }), React__default.createElement("label", null, label));
27349
- };
27350
-
27351
- var countItemFromInventory = function countItemFromInventory(itemKey, inventory) {
27352
- var itemsFromInventory = [];
27353
- if (inventory) {
27354
- Object.keys(inventory.slots).forEach(function (i) {
27355
- var _inventory$slots$inde;
27356
- var index = parseInt(i);
27357
- if (((_inventory$slots$inde = inventory.slots[index]) == null ? void 0 : _inventory$slots$inde.key) === itemKey) {
27358
- itemsFromInventory.push(inventory.slots[index]);
27370
+ var Dropdown = function Dropdown(_ref) {
27371
+ var options = _ref.options,
27372
+ width = _ref.width,
27373
+ onChange = _ref.onChange,
27374
+ _ref$opensUp = _ref.opensUp,
27375
+ opensUp = _ref$opensUp === void 0 ? false : _ref$opensUp;
27376
+ var dropdownId = uuid.v4();
27377
+ var _useState = React.useState(''),
27378
+ selectedValue = _useState[0],
27379
+ setSelectedValue = _useState[1];
27380
+ var _useState2 = React.useState(''),
27381
+ selectedOption = _useState2[0],
27382
+ setSelectedOption = _useState2[1];
27383
+ var _useState3 = React.useState(false),
27384
+ opened = _useState3[0],
27385
+ setOpened = _useState3[1];
27386
+ React.useEffect(function () {
27387
+ var firstOption = options[0];
27388
+ if (firstOption) {
27389
+ var change = !selectedValue;
27390
+ if (!change) {
27391
+ change = options.filter(function (o) {
27392
+ return o.value === selectedValue;
27393
+ }).length < 1;
27359
27394
  }
27360
- });
27361
- }
27362
- var totalQty = itemsFromInventory.reduce(function (acc, item) {
27363
- return acc + ((item == null ? void 0 : item.stackQty) || 1);
27364
- }, 0);
27365
- return totalQty;
27395
+ if (change) {
27396
+ setSelectedValue(firstOption.value);
27397
+ setSelectedOption(firstOption.option);
27398
+ }
27399
+ }
27400
+ }, [options]);
27401
+ React.useEffect(function () {
27402
+ if (selectedValue) {
27403
+ onChange(selectedValue);
27404
+ }
27405
+ }, [selectedValue]);
27406
+ return React__default.createElement(Container$8, {
27407
+ onMouseLeave: function onMouseLeave() {
27408
+ return setOpened(false);
27409
+ },
27410
+ width: width
27411
+ }, React__default.createElement(DropdownSelect$1, {
27412
+ id: "dropdown-" + dropdownId,
27413
+ className: "rpgui-dropdown-imp rpgui-dropdown-imp-header",
27414
+ onPointerUp: function onPointerUp() {
27415
+ return setOpened(function (prev) {
27416
+ return !prev;
27417
+ });
27418
+ }
27419
+ }, React__default.createElement("label", null, "\u25BC"), " ", selectedOption), React__default.createElement(DropdownOptions$1, {
27420
+ className: "rpgui-dropdown-imp",
27421
+ opened: opened,
27422
+ opensUp: opensUp
27423
+ }, options.map(function (option) {
27424
+ return React__default.createElement("li", {
27425
+ key: option.id,
27426
+ onPointerUp: function onPointerUp() {
27427
+ setSelectedValue(option.value);
27428
+ setSelectedOption(option.option);
27429
+ setOpened(false);
27430
+ }
27431
+ }, option.option);
27432
+ })));
27366
27433
  };
27434
+ var Container$8 = /*#__PURE__*/styled__default.div.withConfig({
27435
+ displayName: "Dropdown__Container",
27436
+ componentId: "sc-8arn65-0"
27437
+ })(["position:relative;width:", ";"], function (props) {
27438
+ return props.width || '100%';
27439
+ });
27440
+ var DropdownSelect$1 = /*#__PURE__*/styled__default.p.withConfig({
27441
+ displayName: "Dropdown__DropdownSelect",
27442
+ componentId: "sc-8arn65-1"
27443
+ })(["width:100%;box-sizing:border-box;label{display:inline-block;transform:translateY(-2px);}"]);
27444
+ var DropdownOptions$1 = /*#__PURE__*/styled__default.ul.withConfig({
27445
+ displayName: "Dropdown__DropdownOptions",
27446
+ componentId: "sc-8arn65-2"
27447
+ })(["position:absolute;width:100%;max-height:300px;overflow-y:auto;display:", ";box-sizing:border-box;bottom:", ";top:", ";margin:0;padding:0;@media (max-width:768px){padding:8px 0;}"], function (props) {
27448
+ return props.opened ? 'block' : 'none';
27449
+ }, function (props) {
27450
+ return props.opensUp ? '100%' : 'auto';
27451
+ }, function (props) {
27452
+ return props.opensUp ? 'auto' : '100%';
27453
+ });
27367
27454
 
27368
27455
  var modalRoot = /*#__PURE__*/document.getElementById('modal-root');
27369
27456
  var ModalPortal = function ModalPortal(_ref) {
27370
27457
  var children = _ref.children;
27371
- return ReactDOM.createPortal(React__default.createElement(Container$8, {
27458
+ return ReactDOM__default.createPortal(React__default.createElement(Container$9, {
27372
27459
  className: "rpgui-content"
27373
27460
  }, children), modalRoot);
27374
27461
  };
27375
- var Container$8 = /*#__PURE__*/styled__default.div.withConfig({
27462
+ var Container$9 = /*#__PURE__*/styled__default.div.withConfig({
27376
27463
  displayName: "ModalPortal__Container",
27377
27464
  componentId: "sc-dgmp04-0"
27378
27465
  })(["position:static !important;"]);
@@ -28048,7 +28135,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28048
28135
  });
28049
28136
  }
28050
28137
  };
28051
- return React__default.createElement(Container$9, {
28138
+ return React__default.createElement(Container$a, {
28052
28139
  isDraggingItem: !!draggingState.item,
28053
28140
  item: item,
28054
28141
  className: "rpgui-icon empty-slot",
@@ -28112,7 +28199,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28112
28199
  containerType: containerType
28113
28200
  }))));
28114
28201
  });
28115
- var Container$9 = /*#__PURE__*/styled__default.div.withConfig({
28202
+ var Container$a = /*#__PURE__*/styled__default.div.withConfig({
28116
28203
  displayName: "ItemSlot__Container",
28117
28204
  componentId: "sc-l2j5ef-0"
28118
28205
  })(["margin:0.1rem;.react-draggable-dragging{opacity:", ";}position:relative;.sprite-from-atlas-img--item{position:relative;top:1.5rem;left:1.5rem;border-color:", ";box-shadow:", " inset,", ";}&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;border-radius:12px;pointer-events:none;animation:", ";@keyframes bg-color-change{0%{background-color:rgba(255 255 255 / 0.5);}50%{background-color:transparent;}100%{background-color:rgba(255 255 255 / 0.5);}}}"], function (_ref2) {
@@ -28228,7 +28315,7 @@ var ItemInfo = function ItemInfo(_ref) {
28228
28315
  });
28229
28316
  };
28230
28317
  var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
28231
- return React__default.createElement(Container$a, {
28318
+ return React__default.createElement(Container$b, {
28232
28319
  item: item
28233
28320
  }, React__default.createElement(Header, null, React__default.createElement("div", null, React__default.createElement(Title$1, null, item.name), item.rarity !== 'Common' && React__default.createElement(Rarity, {
28234
28321
  item: item
@@ -28242,7 +28329,7 @@ var ItemInfo = function ItemInfo(_ref) {
28242
28329
  "$isSpecial": true
28243
28330
  }, "Two handed"), React__default.createElement(Description, null, item.description), item.maxStackSize && item.maxStackSize !== 1 && React__default.createElement(StackInfo, null, "x", Math.round(((_item$stackQty = item.stackQty) != null ? _item$stackQty : 1) * 100) / 100, "(", item.maxStackSize, ")"), renderMissingStatistic().length > 0 && React__default.createElement(MissingStatistics, null, React__default.createElement(Statistic, null, "Equipped Diff"), itemToCompare && renderMissingStatistic()));
28244
28331
  };
28245
- var Container$a = /*#__PURE__*/styled__default.div.withConfig({
28332
+ var Container$b = /*#__PURE__*/styled__default.div.withConfig({
28246
28333
  displayName: "ItemInfo__Container",
28247
28334
  componentId: "sc-1xm4q8k-0"
28248
28335
  })(["color:white;background-color:#222;border-radius:5px;padding:0.5rem;font-size:", ";border:3px solid ", ";height:max-content;width:18rem;@media (max-width:640px){width:80vw;}"], uiFonts.size.small, function (_ref2) {
@@ -28388,7 +28475,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
28388
28475
  }
28389
28476
  return;
28390
28477
  }, []);
28391
- return React__default.createElement(ModalPortal, null, React__default.createElement(Container$b, {
28478
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$c, {
28392
28479
  ref: ref
28393
28480
  }, React__default.createElement(ItemInfoDisplay, {
28394
28481
  item: item,
@@ -28397,7 +28484,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
28397
28484
  equipmentSet: equipmentSet
28398
28485
  })));
28399
28486
  };
28400
- var Container$b = /*#__PURE__*/styled__default.div.withConfig({
28487
+ var Container$c = /*#__PURE__*/styled__default.div.withConfig({
28401
28488
  displayName: "ItemTooltip__Container",
28402
28489
  componentId: "sc-11d9r7x-0"
28403
28490
  })(["position:absolute;z-index:100;pointer-events:none;left:0;top:0;opacity:0;transition:opacity 0.08s;"]);
@@ -28417,7 +28504,7 @@ var MobileItemTooltip = function MobileItemTooltip(_ref) {
28417
28504
  var _ref$current;
28418
28505
  (_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
28419
28506
  };
28420
- return React__default.createElement(ModalPortal, null, React__default.createElement(Container$c, {
28507
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$d, {
28421
28508
  ref: ref,
28422
28509
  onTouchEnd: function onTouchEnd() {
28423
28510
  handleFadeOut();
@@ -28445,7 +28532,7 @@ var MobileItemTooltip = function MobileItemTooltip(_ref) {
28445
28532
  }, option.text);
28446
28533
  }))));
28447
28534
  };
28448
- var Container$c = /*#__PURE__*/styled__default.div.withConfig({
28535
+ var Container$d = /*#__PURE__*/styled__default.div.withConfig({
28449
28536
  displayName: "MobileItemTooltip__Container",
28450
28537
  componentId: "sc-ku4p1j-0"
28451
28538
  })(["position:absolute;z-index:100;left:0;top:0;width:100vw;height:100vh;background-color:rgba(0 0 0 / 0.5);display:flex;justify-content:center;align-items:center;gap:0.5rem;transition:opacity 0.08s;animation:fadeIn 0.1s forwards;@keyframes fadeIn{0%{opacity:0;}100%{opacity:0.92;}}@keyframes fadeOut{0%{opacity:0.92;}100%{opacity:0;}}&.fadeOut{animation:fadeOut 0.1s forwards;}@media (max-width:640px){flex-direction:column;}"]);
@@ -28498,8 +28585,114 @@ var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
28498
28585
  }));
28499
28586
  };
28500
28587
 
28501
- var CraftingRecipe = function CraftingRecipe(_ref) {
28588
+ var countItemFromInventory = function countItemFromInventory(itemKey, inventory) {
28589
+ var itemsFromInventory = [];
28590
+ if (inventory) {
28591
+ Object.keys(inventory.slots).forEach(function (i) {
28592
+ var _inventory$slots$inde;
28593
+ var index = parseInt(i);
28594
+ if (((_inventory$slots$inde = inventory.slots[index]) == null ? void 0 : _inventory$slots$inde.key) === itemKey) {
28595
+ itemsFromInventory.push(inventory.slots[index]);
28596
+ }
28597
+ });
28598
+ }
28599
+ var totalQty = itemsFromInventory.reduce(function (acc, item) {
28600
+ return acc + ((item == null ? void 0 : item.stackQty) || 1);
28601
+ }, 0);
28602
+ return totalQty;
28603
+ };
28604
+
28605
+ var modifyString = function modifyString(str) {
28606
+ var parts = str.split('/');
28607
+ var fileName = parts[parts.length - 1];
28608
+ parts = fileName.split('.');
28609
+ var name = parts[0];
28610
+ name = name.replace(/-/g, ' ');
28611
+ var words = name.split(' ');
28612
+ var firstWord = words[0].slice(0, 1).toUpperCase() + words[0].slice(1);
28613
+ var modifiedWords = [firstWord].concat(words.slice(1));
28614
+ return modifiedWords.join(' ');
28615
+ };
28616
+
28617
+ var TooltipContainer = /*#__PURE__*/styled__default.div.withConfig({
28618
+ displayName: "CraftingTooltip__TooltipContainer",
28619
+ componentId: "sc-iqzgok-0"
28620
+ })(["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) {
28621
+ return props.x;
28622
+ }, function (props) {
28623
+ return props.y;
28624
+ }, uiColors.darkGray);
28625
+ var MinCraftingRequirementsText = /*#__PURE__*/styled__default.div.withConfig({
28626
+ displayName: "CraftingTooltip__MinCraftingRequirementsText",
28627
+ componentId: "sc-iqzgok-1"
28628
+ })(["font-size:0.55rem;margin:0;margin-bottom:12px;color:", " !important;"], function (_ref) {
28629
+ var levelIsOk = _ref.levelIsOk;
28630
+ return levelIsOk ? uiColors.lightGreen : uiColors.lightGray;
28631
+ });
28632
+ var IngredientsTitle = /*#__PURE__*/styled__default.div.withConfig({
28633
+ displayName: "CraftingTooltip__IngredientsTitle",
28634
+ componentId: "sc-iqzgok-2"
28635
+ })(["color:", ";font-size:0.6rem;margin-bottom:12px;text-transform:uppercase;letter-spacing:0.5px;"], uiColors.yellow);
28636
+ var Recipe = /*#__PURE__*/styled__default.div.withConfig({
28637
+ displayName: "CraftingTooltip__Recipe",
28638
+ componentId: "sc-iqzgok-3"
28639
+ })(["display:flex;align-items:center;font-size:0.55rem;margin-bottom:8px;margin-left:4px;&:last-child{margin-bottom:0;}.sprite-from-atlas-img{top:0px;left:0px;}"]);
28640
+ var Ingredient = /*#__PURE__*/styled__default.div.withConfig({
28641
+ displayName: "CraftingTooltip__Ingredient",
28642
+ componentId: "sc-iqzgok-4"
28643
+ })(["margin:0;margin-left:14px;color:", " !important;"], function (_ref2) {
28644
+ var isQuantityOk = _ref2.isQuantityOk;
28645
+ return isQuantityOk ? uiColors.lightGreen : uiColors.lightGray;
28646
+ });
28647
+ var CraftingTooltip = function CraftingTooltip(_ref3) {
28502
28648
  var _skills$level, _skills, _recipe$minCraftingRe, _recipe$minCraftingRe2, _recipe$levelIsOk, _recipe$minCraftingRe3, _recipe$minCraftingRe4, _recipe$minCraftingRe5, _recipe$minCraftingRe6;
28649
+ var x = _ref3.x,
28650
+ y = _ref3.y,
28651
+ recipe = _ref3.recipe,
28652
+ inventory = _ref3.inventory,
28653
+ skills = _ref3.skills,
28654
+ atlasIMG = _ref3.atlasIMG,
28655
+ atlasJSON = _ref3.atlasJSON;
28656
+ 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;
28657
+ var levelIsOk = (_recipe$levelIsOk = recipe == null ? void 0 : recipe.levelIsOk) != null ? _recipe$levelIsOk : false;
28658
+ return React__default.createElement(TooltipContainer, {
28659
+ x: x,
28660
+ y: y
28661
+ }, React__default.createElement(MinCraftingRequirementsText, {
28662
+ levelIsOk: levelIsOk
28663
+ }, 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(IngredientsTitle, null, "Ingredients"), recipe.ingredients.map(function (ingredient, index) {
28664
+ var itemQtyInInventory = !inventory ? 0 : countItemFromInventory(ingredient.key, inventory);
28665
+ var isQuantityOk = ingredient.qty <= itemQtyInInventory;
28666
+ return React__default.createElement(Recipe, {
28667
+ key: index
28668
+ }, React__default.createElement(SpriteFromAtlas, {
28669
+ atlasIMG: atlasIMG,
28670
+ atlasJSON: atlasJSON,
28671
+ spriteKey: ingredient.texturePath,
28672
+ imgScale: 1.2
28673
+ }), React__default.createElement(Ingredient, {
28674
+ isQuantityOk: isQuantityOk
28675
+ }, modifyString(ingredient.key), " x", ingredient.qty, " (", itemQtyInInventory, ")"));
28676
+ }));
28677
+ };
28678
+
28679
+ var RadioOptionsWrapper = /*#__PURE__*/styled__default.div.withConfig({
28680
+ displayName: "CraftingRecipe__RadioOptionsWrapper",
28681
+ componentId: "sc-1fe04wz-0"
28682
+ })(["display:flex;align-items:stretch;margin-bottom:0.5rem;padding:8px;position:relative;cursor:pointer;"]);
28683
+ var SpriteAtlasWrapper = /*#__PURE__*/styled__default.div.withConfig({
28684
+ displayName: "CraftingRecipe__SpriteAtlasWrapper",
28685
+ componentId: "sc-1fe04wz-1"
28686
+ })(["margin-right:40px;flex-shrink:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center;"]);
28687
+ var MainContent = /*#__PURE__*/styled__default.div.withConfig({
28688
+ displayName: "CraftingRecipe__MainContent",
28689
+ componentId: "sc-1fe04wz-2"
28690
+ })(["flex:1;min-width:0;"]);
28691
+ var ItemHeader = /*#__PURE__*/styled__default.div.withConfig({
28692
+ displayName: "CraftingRecipe__ItemHeader",
28693
+ componentId: "sc-1fe04wz-3"
28694
+ })(["display:flex;align-items:center;gap:8px;margin-bottom:4px;label{font-size:0.9rem;font-weight:bold;display:flex;align-items:center;}"]);
28695
+ var CraftingRecipe = function CraftingRecipe(_ref) {
28503
28696
  var atlasIMG = _ref.atlasIMG,
28504
28697
  atlasJSON = _ref.atlasJSON,
28505
28698
  equipmentSet = _ref.equipmentSet,
@@ -28509,23 +28702,42 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
28509
28702
  selectedCraftItemKey = _ref.selectedCraftItemKey,
28510
28703
  inventory = _ref.inventory,
28511
28704
  skills = _ref.skills;
28512
- var modifyString = function modifyString(str) {
28513
- // Split the string by "/" and "."
28514
- var parts = str.split('/');
28515
- var fileName = parts[parts.length - 1];
28516
- parts = fileName.split('.');
28517
- var name = parts[0];
28518
- // Replace all occurrences of "-" with " "
28519
- name = name.replace(/-/g, ' ');
28520
- // Uppercase the first word
28521
- var words = name.split(' ');
28522
- var firstWord = words[0].slice(0, 1).toUpperCase() + words[0].slice(1);
28523
- var modifiedWords = [firstWord].concat(words.slice(1));
28524
- name = modifiedWords.join(' ');
28525
- return name;
28705
+ var _useState = React.useState(false),
28706
+ showTooltip = _useState[0],
28707
+ setShowTooltip = _useState[1];
28708
+ var _useState2 = React.useState({
28709
+ x: 0,
28710
+ y: 0
28711
+ }),
28712
+ tooltipPosition = _useState2[0],
28713
+ setTooltipPosition = _useState2[1];
28714
+ var wrapperRef = React.useRef(null);
28715
+ var isSelected = selectedCraftItemKey === recipe.key;
28716
+ React.useEffect(function () {
28717
+ var handleClickOutside = function handleClickOutside(event) {
28718
+ if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
28719
+ setShowTooltip(false);
28720
+ }
28721
+ };
28722
+ document.addEventListener('mousedown', handleClickOutside);
28723
+ return function () {
28724
+ document.removeEventListener('mousedown', handleClickOutside);
28725
+ };
28726
+ }, []);
28727
+ var handleClick = function handleClick() {
28728
+ if (wrapperRef.current) {
28729
+ var rect = wrapperRef.current.getBoundingClientRect();
28730
+ setTooltipPosition({
28731
+ x: rect.right + 10,
28732
+ y: rect.top
28733
+ });
28734
+ setShowTooltip(true);
28735
+ }
28526
28736
  };
28527
- 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;
28528
- return React__default.createElement(RadioOptionsWrapper, null, React__default.createElement(SpriteAtlasWrapper, null, React__default.createElement(ItemInfoWrapper, {
28737
+ return React__default.createElement(RadioOptionsWrapper, {
28738
+ ref: wrapperRef,
28739
+ onClick: handleClick
28740
+ }, React__default.createElement(SpriteAtlasWrapper, null, React__default.createElement(ItemInfoWrapper, {
28529
28741
  item: recipe,
28530
28742
  atlasIMG: atlasIMG,
28531
28743
  atlasJSON: atlasJSON,
@@ -28537,7 +28749,7 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
28537
28749
  spriteKey: recipe.texturePath,
28538
28750
  imgScale: 3,
28539
28751
  grayScale: !recipe.canCraft
28540
- }))), React__default.createElement("div", null, React__default.createElement("div", {
28752
+ }))), React__default.createElement(MainContent, null, React__default.createElement(ItemHeader, {
28541
28753
  onPointerUp: recipe.canCraft ? handleRecipeSelect : undefined
28542
28754
  }, React__default.createElement("input", {
28543
28755
  className: "rpgui-radio",
@@ -28545,55 +28757,18 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
28545
28757
  value: recipe.name,
28546
28758
  name: "test",
28547
28759
  disabled: !recipe.canCraft,
28548
- checked: selectedCraftItemKey === recipe.key,
28760
+ checked: isSelected,
28549
28761
  onChange: handleRecipeSelect
28550
- }), React__default.createElement("label", {
28551
- style: {
28552
- display: 'flex',
28553
- alignItems: 'center'
28554
- }
28555
- }, modifyString(recipe.name))), React__default.createElement(MinCraftingRequirementsText, {
28556
- levelIsOk: (_recipe$levelIsOk = recipe == null ? void 0 : recipe.levelIsOk) != null ? _recipe$levelIsOk : false
28557
- }, 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, ")"), recipe.ingredients.map(function (ingredient, index) {
28558
- var itemQtyInInventory = !inventory ? 0 : countItemFromInventory(ingredient.key, inventory);
28559
- return React__default.createElement(Recipe, {
28560
- key: index
28561
- }, React__default.createElement(SpriteFromAtlas, {
28562
- atlasIMG: atlasIMG,
28563
- atlasJSON: atlasJSON,
28564
- spriteKey: ingredient.texturePath,
28565
- imgScale: 1.2
28566
- }), React__default.createElement(Ingredient, {
28567
- isQuantityOk: ingredient.qty <= itemQtyInInventory
28568
- }, modifyString(ingredient.key), " x", ingredient.qty, " (", itemQtyInInventory, ")"));
28569
- })));
28762
+ }), React__default.createElement("label", null, modifyString(recipe.name)))), showTooltip && ReactDOM.createPortal(React__default.createElement(CraftingTooltip, {
28763
+ x: tooltipPosition.x,
28764
+ y: tooltipPosition.y,
28765
+ recipe: recipe,
28766
+ inventory: inventory,
28767
+ skills: skills,
28768
+ atlasIMG: atlasIMG,
28769
+ atlasJSON: atlasJSON
28770
+ }), document.body));
28570
28771
  };
28571
- var Ingredient = /*#__PURE__*/styled__default.p.withConfig({
28572
- displayName: "CraftingRecipe__Ingredient",
28573
- componentId: "sc-1fe04wz-0"
28574
- })(["margin:0;margin-left:14px;color:", " !important;"], function (_ref2) {
28575
- var isQuantityOk = _ref2.isQuantityOk;
28576
- return isQuantityOk ? uiColors.lightGreen : uiColors.lightGray;
28577
- });
28578
- var Recipe = /*#__PURE__*/styled__default.div.withConfig({
28579
- displayName: "CraftingRecipe__Recipe",
28580
- componentId: "sc-1fe04wz-1"
28581
- })(["font-size:0.6rem;margin-bottom:3px;display:flex;align-items:center;margin-left:4px;.sprite-from-atlas-img{top:0px;left:0px;}"]);
28582
- var SpriteAtlasWrapper = /*#__PURE__*/styled__default.div.withConfig({
28583
- displayName: "CraftingRecipe__SpriteAtlasWrapper",
28584
- componentId: "sc-1fe04wz-2"
28585
- })(["margin-right:40px;"]);
28586
- var RadioOptionsWrapper = /*#__PURE__*/styled__default.div.withConfig({
28587
- displayName: "CraftingRecipe__RadioOptionsWrapper",
28588
- componentId: "sc-1fe04wz-3"
28589
- })(["display:flex;align-items:stretch;margin-bottom:40px;"]);
28590
- var MinCraftingRequirementsText = /*#__PURE__*/styled__default.p.withConfig({
28591
- displayName: "CraftingRecipe__MinCraftingRequirementsText",
28592
- componentId: "sc-1fe04wz-4"
28593
- })(["font-size:0.6rem !important;margin:0 5px 0 35px;color:", " !important;"], function (_ref3) {
28594
- var levelIsOk = _ref3.levelIsOk;
28595
- return levelIsOk ? uiColors.lightGreen : uiColors.lightGray;
28596
- });
28597
28772
 
28598
28773
  function calculateMaxCraftable(recipe, inventory) {
28599
28774
  if (!inventory || !(recipe != null && recipe.ingredients)) {
@@ -28627,6 +28802,7 @@ var mobilePortrait = {
28627
28802
  width: '500px',
28628
28803
  height: '700px'
28629
28804
  };
28805
+ var ITEMS_PER_PAGE = 8;
28630
28806
  var CraftBook = function CraftBook(_ref) {
28631
28807
  var atlasIMG = _ref.atlasIMG,
28632
28808
  atlasJSON = _ref.atlasJSON,
@@ -28652,8 +28828,17 @@ var CraftBook = function CraftBook(_ref) {
28652
28828
  searchTerm = _useState4[0],
28653
28829
  setSearchTerm = _useState4[1];
28654
28830
  var _useState5 = React.useState(false),
28655
- isCraftingDisabled = _useState5[0],
28656
- setIsCraftingDisabled = _useState5[1];
28831
+ isSearchVisible = _useState5[0],
28832
+ setIsSearchVisible = _useState5[1];
28833
+ var _useState6 = React.useState(false),
28834
+ isCraftingDisabled = _useState6[0],
28835
+ setIsCraftingDisabled = _useState6[1];
28836
+ var _useLocalStorage = useLocalStorage('pinnedCraftItems', []),
28837
+ pinnedItems = _useLocalStorage[0],
28838
+ setPinnedItems = _useLocalStorage[1];
28839
+ var _useState7 = React.useState(1),
28840
+ currentPage = _useState7[0],
28841
+ setCurrentPage = _useState7[1];
28657
28842
  React.useEffect(function () {
28658
28843
  var handleResize = function handleResize() {
28659
28844
  if (window.innerWidth < 500 && (size == null ? void 0 : size.width) !== mobilePortrait.width && (!scale || scale < 1)) {
@@ -28670,93 +28855,90 @@ var CraftBook = function CraftBook(_ref) {
28670
28855
  return window.removeEventListener('resize', handleResize);
28671
28856
  };
28672
28857
  }, [scale]);
28673
- var renderItemTypes = function renderItemTypes() {
28674
- var itemTypes = ['Suggested'].concat(Object.keys(shared.ItemSubType)).filter(function (type) {
28675
- return type !== 'DeadBody';
28676
- }).sort(function (a, b) {
28677
- if (a === 'Suggested') return -1;
28678
- if (b === 'Suggested') return 1;
28679
- return a.localeCompare(b);
28680
- });
28681
- if (window.innerWidth > parseInt(mobilePortrait.width)) {
28682
- return itemTypes.map(function (type) {
28683
- return React__default.createElement(InputRadio, {
28684
- key: type,
28685
- value: type,
28686
- label: type,
28687
- name: type,
28688
- isChecked: selectedType === type,
28689
- onRadioSelect: function onRadioSelect(value) {
28690
- setSelectedType(value);
28691
- onSelect(value);
28692
- }
28693
- });
28694
- });
28695
- }
28696
- var rows = [[], []];
28697
- itemTypes.forEach(function (type, index) {
28698
- var row = 0;
28699
- if (index % 2 === 1) row = 1;
28700
- rows[row].push(React__default.createElement(InputRadio, {
28701
- key: type,
28702
- value: type,
28703
- label: type,
28704
- name: type,
28705
- isChecked: selectedType === type,
28706
- onRadioSelect: function onRadioSelect(value) {
28707
- setSelectedType(value);
28708
- onSelect(value);
28709
- }
28710
- }));
28711
- });
28712
- return rows.map(function (row, index) {
28713
- return React__default.createElement("div", {
28714
- key: index,
28715
- style: {
28716
- display: 'flex',
28717
- gap: '10px'
28718
- }
28719
- }, row);
28858
+ var togglePinItem = function togglePinItem(itemKey) {
28859
+ setPinnedItems(function (current) {
28860
+ return current.includes(itemKey) ? current.filter(function (key) {
28861
+ return key !== itemKey;
28862
+ }) : [].concat(current, [itemKey]);
28720
28863
  });
28721
28864
  };
28865
+ var categoryOptions = ['Suggested'].concat(pinnedItems.length > 0 ? ['Pinned'] : [], Object.keys(shared.ItemSubType)).filter(function (type) {
28866
+ return type !== 'DeadBody';
28867
+ }).sort(function (a, b) {
28868
+ if (a === 'Suggested') return -1;
28869
+ if (b === 'Suggested') return 1;
28870
+ if (a === 'Pinned') return -1;
28871
+ if (b === 'Pinned') return 1;
28872
+ return a.localeCompare(b);
28873
+ }).map(function (type, index) {
28874
+ return {
28875
+ id: index,
28876
+ value: type,
28877
+ option: type
28878
+ };
28879
+ });
28722
28880
  var filteredCraftableItems = craftablesItems == null ? void 0 : craftablesItems.filter(function (item) {
28723
28881
  var matchesSearch = item.name.toLowerCase().includes(searchTerm.toLowerCase());
28724
- var matchesCategory = selectedType === 'Suggested' || item.type === selectedType;
28882
+ var matchesCategory = selectedType === 'Suggested' || selectedType === 'Pinned' && pinnedItems.includes(item.key) || item.type === selectedType;
28725
28883
  return matchesSearch && matchesCategory;
28726
28884
  });
28885
+ var sortedItems = [].concat(filteredCraftableItems || []).sort(function (a, b) {
28886
+ var aIsPinned = pinnedItems.includes(a.key);
28887
+ var bIsPinned = pinnedItems.includes(b.key);
28888
+ if (aIsPinned && !bIsPinned) return -1;
28889
+ if (!aIsPinned && bIsPinned) return 1;
28890
+ return 0;
28891
+ });
28892
+ var totalPages = Math.ceil(sortedItems.length / ITEMS_PER_PAGE);
28893
+ var paginatedItems = sortedItems.slice((currentPage - 1) * ITEMS_PER_PAGE, currentPage * ITEMS_PER_PAGE);
28894
+ React.useEffect(function () {
28895
+ setCurrentPage(1);
28896
+ }, [selectedType, searchTerm]);
28727
28897
  if (!size) return null;
28728
28898
  return React__default.createElement(DraggableContainer, {
28729
28899
  type: exports.RPGUIContainerTypes.Framed,
28730
28900
  width: size.width,
28731
28901
  height: size.height,
28732
28902
  cancelDrag: ".inputRadioCraftBook",
28733
- onCloseButton: function onCloseButton() {
28734
- if (onClose) {
28735
- onClose();
28736
- }
28737
- },
28903
+ onCloseButton: onClose,
28738
28904
  scale: scale
28739
- }, React__default.createElement(Wrapper, null, React__default.createElement("div", {
28740
- style: {
28741
- width: '100%'
28905
+ }, React__default.createElement(Wrapper, null, React__default.createElement(HeaderContainer, null, React__default.createElement(Title$2, null, "Craftbook"), React__default.createElement(HeaderControls, null, React__default.createElement(DropdownWrapper, null, React__default.createElement(Dropdown, {
28906
+ options: categoryOptions,
28907
+ onChange: function onChange(value) {
28908
+ setSelectedType(value);
28909
+ onSelect(value);
28910
+ },
28911
+ width: "200px"
28912
+ })), React__default.createElement(SearchButton$2, {
28913
+ onClick: function onClick() {
28914
+ return setIsSearchVisible(!isSearchVisible);
28742
28915
  }
28743
- }, React__default.createElement(Title$2, null, "Craftbook"), React__default.createElement(Subtitle, null, "Select an item to craft"), React__default.createElement(SearchContainer$1, null, React__default.createElement("input", {
28916
+ }, React__default.createElement(fa.FaSearch, {
28917
+ size: 16
28918
+ })))), isSearchVisible && React__default.createElement(SearchContainer$1, null, React__default.createElement("input", {
28744
28919
  type: "text",
28745
28920
  className: "rpgui-input",
28746
28921
  placeholder: "Search items...",
28747
28922
  value: searchTerm,
28748
28923
  onChange: function onChange(e) {
28749
28924
  return setSearchTerm(e.target.value);
28750
- }
28751
- })), React__default.createElement("hr", {
28752
- className: "golden"
28753
- })), React__default.createElement(ContentContainer, null, React__default.createElement(ItemTypes, {
28754
- className: "inputRadioCraftBook"
28755
- }, renderItemTypes()), React__default.createElement(RadioInputScroller, {
28925
+ },
28926
+ autoFocus: true
28927
+ })), React__default.createElement(ContentContainer, null, React__default.createElement(RadioInputScroller, {
28756
28928
  className: "inputRadioCraftBook"
28757
- }, filteredCraftableItems == null ? void 0 : filteredCraftableItems.map(function (item) {
28758
- return React__default.createElement(CraftingRecipe, {
28929
+ }, paginatedItems == null ? void 0 : paginatedItems.map(function (item) {
28930
+ return React__default.createElement(CraftingRecipeWrapper, {
28759
28931
  key: item.key,
28932
+ isSelected: pinnedItems.includes(item.key)
28933
+ }, React__default.createElement(PinButton, {
28934
+ onClick: function onClick(e) {
28935
+ e.stopPropagation();
28936
+ togglePinItem(item.key);
28937
+ },
28938
+ isPinned: pinnedItems.includes(item.key)
28939
+ }, React__default.createElement(fa.FaThumbtack, {
28940
+ size: 14
28941
+ })), React__default.createElement(CraftingRecipe, {
28760
28942
  atlasIMG: atlasIMG,
28761
28943
  atlasJSON: atlasJSON,
28762
28944
  equipmentSet: equipmentSet,
@@ -28766,8 +28948,26 @@ var CraftBook = function CraftBook(_ref) {
28766
28948
  selectedCraftItemKey: craftItemKey,
28767
28949
  inventory: inventory,
28768
28950
  skills: skills
28769
- });
28770
- }))), React__default.createElement(ButtonWrapper, null, React__default.createElement(Button, {
28951
+ }));
28952
+ }))), React__default.createElement(PaginationContainer, null, React__default.createElement(PaginationButton, {
28953
+ onClick: function onClick() {
28954
+ return setCurrentPage(function (prev) {
28955
+ return Math.max(1, prev - 1);
28956
+ });
28957
+ },
28958
+ disabled: currentPage === 1
28959
+ }, React__default.createElement(fa.FaChevronLeft, {
28960
+ size: 12
28961
+ })), React__default.createElement(PageInfo, null, "Page ", currentPage, " of ", totalPages), React__default.createElement(PaginationButton, {
28962
+ onClick: function onClick() {
28963
+ return setCurrentPage(function (prev) {
28964
+ return Math.min(totalPages, prev + 1);
28965
+ });
28966
+ },
28967
+ disabled: currentPage === totalPages
28968
+ }, React__default.createElement(fa.FaChevronRight, {
28969
+ size: 12
28970
+ }))), React__default.createElement(Footer, null, React__default.createElement(Button, {
28771
28971
  buttonType: exports.ButtonTypes.RPGUIButton,
28772
28972
  onPointerDown: onClose
28773
28973
  }, "Cancel"), React__default.createElement(Button, {
@@ -28790,120 +28990,75 @@ var CraftBook = function CraftBook(_ref) {
28790
28990
  var Wrapper = /*#__PURE__*/styled__default.div.withConfig({
28791
28991
  displayName: "CraftBook__Wrapper",
28792
28992
  componentId: "sc-19q95ue-0"
28793
- })(["display:flex;flex-direction:column;width:100%;height:100%;"]);
28993
+ })(["display:flex;flex-direction:column;width:100%;height:100%;& > *{box-sizing:border-box;}"]);
28994
+ var HeaderContainer = /*#__PURE__*/styled__default.div.withConfig({
28995
+ displayName: "CraftBook__HeaderContainer",
28996
+ componentId: "sc-19q95ue-1"
28997
+ })(["display:flex;justify-content:space-between;align-items:center;width:100%;padding:16px 16px 0;"]);
28794
28998
  var Title$2 = /*#__PURE__*/styled__default.h1.withConfig({
28795
28999
  displayName: "CraftBook__Title",
28796
- componentId: "sc-19q95ue-1"
28797
- })(["font-size:0.6rem;color:", " !important;"], uiColors.yellow);
28798
- var Subtitle = /*#__PURE__*/styled__default.h1.withConfig({
28799
- displayName: "CraftBook__Subtitle",
28800
29000
  componentId: "sc-19q95ue-2"
28801
- })(["font-size:0.4rem;color:", " !important;"], uiColors.yellow);
28802
- var RadioInputScroller = /*#__PURE__*/styled__default.div.withConfig({
28803
- displayName: "CraftBook__RadioInputScroller",
29001
+ })(["font-size:1.2rem;color:", " !important;margin:0;text-shadow:2px 2px 2px rgba(0,0,0,0.5);"], uiColors.yellow);
29002
+ var HeaderControls = /*#__PURE__*/styled__default.div.withConfig({
29003
+ displayName: "CraftBook__HeaderControls",
28804
29004
  componentId: "sc-19q95ue-3"
28805
- })(["padding-left:15px;padding-top:10px;margin-top:1rem;align-items:center;align-items:flex-start;overflow-y:scroll;min-height:0;flex:1;margin-left:10px;-webkit-overflow-scrolling:touch;@media (max-width:", "){margin-left:0;}"], mobilePortrait.width);
28806
- var ButtonWrapper = /*#__PURE__*/styled__default.div.withConfig({
28807
- displayName: "CraftBook__ButtonWrapper",
29005
+ })(["display:flex;align-items:center;gap:16px;position:relative;left:-2rem;"]);
29006
+ var DropdownWrapper = /*#__PURE__*/styled__default.div.withConfig({
29007
+ displayName: "CraftBook__DropdownWrapper",
28808
29008
  componentId: "sc-19q95ue-4"
28809
- })(["display:flex;justify-content:flex-end;margin-top:10px;width:100%;button{padding:0px 50px;margin:5px;}@media (max-width:", "){justify-content:center;}"], mobilePortrait.width);
28810
- var ContentContainer = /*#__PURE__*/styled__default.div.withConfig({
28811
- displayName: "CraftBook__ContentContainer",
29009
+ })(["width:200px;"]);
29010
+ var SearchButton$2 = /*#__PURE__*/styled__default.button.withConfig({
29011
+ displayName: "CraftBook__SearchButton",
28812
29012
  componentId: "sc-19q95ue-5"
28813
- })(["display:flex;width:100%;min-height:0;flex:1;@media (max-width:", "){flex-direction:column;}"], mobilePortrait.width);
28814
- var ItemTypes = /*#__PURE__*/styled__default.div.withConfig({
28815
- displayName: "CraftBook__ItemTypes",
28816
- componentId: "sc-19q95ue-6"
28817
- })(["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);
29013
+ })(["background:none;border:none;cursor:pointer;padding:8px;width:32px;height:32px;color:", ";opacity:0.8;transition:opacity 0.2s;display:flex;align-items:center;justify-content:center;&:hover{opacity:1;}"], uiColors.yellow);
28818
29014
  var SearchContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
28819
29015
  displayName: "CraftBook__SearchContainer",
29016
+ componentId: "sc-19q95ue-6"
29017
+ })(["padding:0 16px;margin-top:16px;input{width:100%;font-size:0.8rem;padding:8px 12px;background-color:rgba(0,0,0,0.3);border:none;color:white;border-radius:4px;&::placeholder{color:rgba(255,255,255,0.5);}&:focus{outline:none;background-color:rgba(0,0,0,0.4);}}"]);
29018
+ var ContentContainer = /*#__PURE__*/styled__default.div.withConfig({
29019
+ displayName: "CraftBook__ContentContainer",
28820
29020
  componentId: "sc-19q95ue-7"
28821
- })(["margin:8px 0;padding:0 16px;input{width:100%;font-size:0.8rem;padding:8px 12px;background-color:rgba(0,0,0,0.3);border:none;color:white;border-radius:4px;&::placeholder{color:rgba(255,255,255,0.5);}&:focus{outline:none;background-color:rgba(0,0,0,0.4);}}"]);
28822
-
28823
- var Dropdown = function Dropdown(_ref) {
28824
- var options = _ref.options,
28825
- width = _ref.width,
28826
- onChange = _ref.onChange,
28827
- _ref$opensUp = _ref.opensUp,
28828
- opensUp = _ref$opensUp === void 0 ? false : _ref$opensUp;
28829
- var dropdownId = uuid.v4();
28830
- var _useState = React.useState(''),
28831
- selectedValue = _useState[0],
28832
- setSelectedValue = _useState[1];
28833
- var _useState2 = React.useState(''),
28834
- selectedOption = _useState2[0],
28835
- setSelectedOption = _useState2[1];
28836
- var _useState3 = React.useState(false),
28837
- opened = _useState3[0],
28838
- setOpened = _useState3[1];
28839
- React.useEffect(function () {
28840
- var firstOption = options[0];
28841
- if (firstOption) {
28842
- var change = !selectedValue;
28843
- if (!change) {
28844
- change = options.filter(function (o) {
28845
- return o.value === selectedValue;
28846
- }).length < 1;
28847
- }
28848
- if (change) {
28849
- setSelectedValue(firstOption.value);
28850
- setSelectedOption(firstOption.option);
28851
- }
28852
- }
28853
- }, [options]);
28854
- React.useEffect(function () {
28855
- if (selectedValue) {
28856
- onChange(selectedValue);
28857
- }
28858
- }, [selectedValue]);
28859
- return React__default.createElement(Container$d, {
28860
- onMouseLeave: function onMouseLeave() {
28861
- return setOpened(false);
28862
- },
28863
- width: width
28864
- }, React__default.createElement(DropdownSelect$1, {
28865
- id: "dropdown-" + dropdownId,
28866
- className: "rpgui-dropdown-imp rpgui-dropdown-imp-header",
28867
- onPointerUp: function onPointerUp() {
28868
- return setOpened(function (prev) {
28869
- return !prev;
28870
- });
28871
- }
28872
- }, React__default.createElement("label", null, "\u25BC"), " ", selectedOption), React__default.createElement(DropdownOptions$1, {
28873
- className: "rpgui-dropdown-imp",
28874
- opened: opened,
28875
- opensUp: opensUp
28876
- }, options.map(function (option) {
28877
- return React__default.createElement("li", {
28878
- key: option.id,
28879
- onPointerUp: function onPointerUp() {
28880
- setSelectedValue(option.value);
28881
- setSelectedOption(option.option);
28882
- setOpened(false);
28883
- }
28884
- }, option.option);
28885
- })));
28886
- };
28887
- var Container$d = /*#__PURE__*/styled__default.div.withConfig({
28888
- displayName: "Dropdown__Container",
28889
- componentId: "sc-8arn65-0"
28890
- })(["position:relative;width:", ";"], function (props) {
28891
- return props.width || '100%';
29021
+ })(["flex:1;min-height:0;padding:16px;padding-right:0;padding-bottom:0;overflow:hidden;width:100%;"]);
29022
+ var RadioInputScroller = /*#__PURE__*/styled__default.div.withConfig({
29023
+ displayName: "CraftBook__RadioInputScroller",
29024
+ componentId: "sc-19q95ue-8"
29025
+ })(["height:100%;overflow-y:scroll;overflow-x:hidden;padding:8px 16px;padding-right:24px;width:100%;box-sizing:border-box;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start;@media (max-width:", "){grid-template-columns:1fr;}"], mobilePortrait.width);
29026
+ var CraftingRecipeWrapper = /*#__PURE__*/styled__default.div.withConfig({
29027
+ displayName: "CraftBook__CraftingRecipeWrapper",
29028
+ componentId: "sc-19q95ue-9"
29029
+ })(["position:relative;width:100%;min-width:0;box-sizing:border-box;transition:background-color 0.2s;&:hover{background:rgba(0,0,0,0.4);}", ""], function (props) {
29030
+ return props.isSelected && "\n background: rgba(255, 215, 0, 0.1);\n ";
28892
29031
  });
28893
- var DropdownSelect$1 = /*#__PURE__*/styled__default.p.withConfig({
28894
- displayName: "Dropdown__DropdownSelect",
28895
- componentId: "sc-8arn65-1"
28896
- })(["width:100%;box-sizing:border-box;label{display:inline-block;transform:translateY(-2px);}"]);
28897
- var DropdownOptions$1 = /*#__PURE__*/styled__default.ul.withConfig({
28898
- displayName: "Dropdown__DropdownOptions",
28899
- componentId: "sc-8arn65-2"
28900
- })(["position:absolute;width:100%;max-height:300px;overflow-y:auto;display:", ";box-sizing:border-box;bottom:", ";top:", ";margin:0;padding:0;@media (max-width:768px){padding:8px 0;}"], function (props) {
28901
- return props.opened ? 'block' : 'none';
29032
+ var PinButton = /*#__PURE__*/styled__default.button.withConfig({
29033
+ displayName: "CraftBook__PinButton",
29034
+ componentId: "sc-19q95ue-10"
29035
+ })(["position:absolute;top:8px;right:8px;background:none;border:none;cursor:pointer;padding:4px;color:", ";opacity:", ";transition:all 0.2s;z-index:2;&:hover{opacity:1;color:", ";}"], function (props) {
29036
+ return props.isPinned ? uiColors.yellow : uiColors.lightGray;
28902
29037
  }, function (props) {
28903
- return props.opensUp ? '100%' : 'auto';
29038
+ return props.isPinned ? 1 : 0.6;
29039
+ }, uiColors.yellow);
29040
+ var Footer = /*#__PURE__*/styled__default.div.withConfig({
29041
+ displayName: "CraftBook__Footer",
29042
+ componentId: "sc-19q95ue-11"
29043
+ })(["display:flex;justify-content:flex-end;gap:16px;padding:8px;button{min-width:100px;}@media (max-width:", "){justify-content:center;}"], mobilePortrait.width);
29044
+ var PaginationContainer = /*#__PURE__*/styled__default.div.withConfig({
29045
+ displayName: "CraftBook__PaginationContainer",
29046
+ componentId: "sc-19q95ue-12"
29047
+ })(["display:flex;align-items:center;justify-content:center;gap:16px;padding:8px;margin-top:8px;border-top:1px solid ", ";"], uiColors.darkGray);
29048
+ var PaginationButton = /*#__PURE__*/styled__default.button.withConfig({
29049
+ displayName: "CraftBook__PaginationButton",
29050
+ componentId: "sc-19q95ue-13"
29051
+ })(["background:none;border:none;color:", ";cursor:", ";opacity:", ";padding:4px;display:flex;align-items:center;justify-content:center;transition:opacity 0.2s;&:hover:not(:disabled){opacity:1;}"], function (props) {
29052
+ return props.disabled ? uiColors.darkGray : uiColors.yellow;
28904
29053
  }, function (props) {
28905
- return props.opensUp ? 'auto' : '100%';
29054
+ return props.disabled ? 'not-allowed' : 'pointer';
29055
+ }, function (props) {
29056
+ return props.disabled ? 0.5 : 0.8;
28906
29057
  });
29058
+ var PageInfo = /*#__PURE__*/styled__default.div.withConfig({
29059
+ displayName: "CraftBook__PageInfo",
29060
+ componentId: "sc-19q95ue-14"
29061
+ })(["color:", ";font-size:0.8rem;font-family:'Press Start 2P',cursive;"], uiColors.lightGray);
28907
29062
 
28908
29063
  var DropdownSelectorContainer = function DropdownSelectorContainer(_ref) {
28909
29064
  var title = _ref.title,
@@ -30912,7 +31067,7 @@ var ItemSelector = function ItemSelector(_ref) {
30912
31067
  style: {
30913
31068
  width: '100%'
30914
31069
  }
30915
- }, React__default.createElement(Title$3, null, 'Harvesting instruments'), React__default.createElement(Subtitle$1, null, 'Use the tool, you need it'), React__default.createElement("hr", {
31070
+ }, React__default.createElement(Title$3, null, 'Harvesting instruments'), React__default.createElement(Subtitle, null, 'Use the tool, you need it'), React__default.createElement("hr", {
30916
31071
  className: "golden"
30917
31072
  })), React__default.createElement(RadioInputScroller$1, null, options == null ? void 0 : options.map(function (option, index) {
30918
31073
  return React__default.createElement(RadioOptionsWrapper$1, {
@@ -30934,7 +31089,7 @@ var ItemSelector = function ItemSelector(_ref) {
30934
31089
  alignItems: 'center'
30935
31090
  }
30936
31091
  }, option.name, " ", React__default.createElement("br", null), option.description)));
30937
- })), React__default.createElement(ButtonWrapper$1, null, React__default.createElement(Button, {
31092
+ })), React__default.createElement(ButtonWrapper, null, React__default.createElement(Button, {
30938
31093
  buttonType: exports.ButtonTypes.RPGUIButton,
30939
31094
  onPointerDown: onClose
30940
31095
  }, "Cancel"), React__default.createElement(Button, {
@@ -30945,7 +31100,7 @@ var Title$3 = /*#__PURE__*/styled__default.h1.withConfig({
30945
31100
  displayName: "ItemSelector__Title",
30946
31101
  componentId: "sc-gptoxp-0"
30947
31102
  })(["font-size:0.6rem;color:yellow !important;"]);
30948
- var Subtitle$1 = /*#__PURE__*/styled__default.h1.withConfig({
31103
+ var Subtitle = /*#__PURE__*/styled__default.h1.withConfig({
30949
31104
  displayName: "ItemSelector__Subtitle",
30950
31105
  componentId: "sc-gptoxp-1"
30951
31106
  })(["font-size:0.4rem;color:yellow !important;"]);
@@ -30961,7 +31116,7 @@ var RadioOptionsWrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
30961
31116
  displayName: "ItemSelector__RadioOptionsWrapper",
30962
31117
  componentId: "sc-gptoxp-4"
30963
31118
  })(["display:flex;align-items:stretch;margin-bottom:40px;"]);
30964
- var ButtonWrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
31119
+ var ButtonWrapper = /*#__PURE__*/styled__default.div.withConfig({
30965
31120
  displayName: "ItemSelector__ButtonWrapper",
30966
31121
  componentId: "sc-gptoxp-5"
30967
31122
  })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
@@ -31856,7 +32011,7 @@ var PartyCreate = function PartyCreate(_ref) {
31856
32011
  }))), React__default.createElement("h1", null, "Type your party name"), React__default.createElement(Input, {
31857
32012
  placeholder: "Type party name",
31858
32013
  type: "text"
31859
- }), React__default.createElement(ButtonWrapper$2, null, React__default.createElement(Button, {
32014
+ }), React__default.createElement(ButtonWrapper$1, null, React__default.createElement(Button, {
31860
32015
  buttonType: exports.ButtonTypes.RPGUIButton,
31861
32016
  onPointerDown: function onPointerDown() {
31862
32017
  onCreate();
@@ -31878,7 +32033,7 @@ var Title$4 = /*#__PURE__*/styled__default.h1.withConfig({
31878
32033
  displayName: "PartyCreate__Title",
31879
32034
  componentId: "sc-13brop0-1"
31880
32035
  })(["font-size:0.6rem;color:", " !important;"], uiColors.yellow);
31881
- var ButtonWrapper$2 = /*#__PURE__*/styled__default.div.withConfig({
32036
+ var ButtonWrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
31882
32037
  displayName: "PartyCreate__ButtonWrapper",
31883
32038
  componentId: "sc-13brop0-2"
31884
32039
  })(["margin-top:10px;width:100%;display:flex;justify-content:space-around;align-items:center;.cancel-button{filter:grayscale(0.7);}"]);
@@ -32595,7 +32750,7 @@ var formatQuestStatus = function formatQuestStatus(status) {
32595
32750
  });
32596
32751
  };
32597
32752
 
32598
- var InputRadio$1 = function InputRadio(_ref) {
32753
+ var InputRadio = function InputRadio(_ref) {
32599
32754
  var name = _ref.name,
32600
32755
  items = _ref.items,
32601
32756
  onChange = _ref.onChange;
@@ -33937,7 +34092,7 @@ var TradingMenu = function TradingMenu(_ref) {
33937
34092
  scale: scale,
33938
34093
  isBuy: isBuy()
33939
34094
  });
33940
- })), React__default.createElement(InfoSection, null, React__default.createElement(GoldInfo, null, React__default.createElement("p", null, "Available Gold:"), React__default.createElement("p", null, "$", characterAvailableGold.toFixed(2))), React__default.createElement(GoldInfo, null, React__default.createElement("p", null, "Total:"), React__default.createElement("p", null, "$", sum)), !hasGoldForSale() ? React__default.createElement(AlertText, null, "Sorry, not enough money.") : React__default.createElement(GoldInfo, null, React__default.createElement("p", null, "Final Gold:"), React__default.createElement("p", null, "$", getFinalGold().toFixed(2)))), React__default.createElement(ButtonWrapper$3, null, React__default.createElement(Button, {
34095
+ })), React__default.createElement(InfoSection, null, React__default.createElement(GoldInfo, null, React__default.createElement("p", null, "Available Gold:"), React__default.createElement("p", null, "$", characterAvailableGold.toFixed(2))), React__default.createElement(GoldInfo, null, React__default.createElement("p", null, "Total:"), React__default.createElement("p", null, "$", sum)), !hasGoldForSale() ? React__default.createElement(AlertText, null, "Sorry, not enough money.") : React__default.createElement(GoldInfo, null, React__default.createElement("p", null, "Final Gold:"), React__default.createElement("p", null, "$", getFinalGold().toFixed(2)))), React__default.createElement(ButtonWrapper$2, null, React__default.createElement(Button, {
33941
34096
  buttonType: exports.ButtonTypes.RPGUIButton,
33942
34097
  disabled: !hasGoldForSale(),
33943
34098
  onPointerDown: function onPointerDown() {
@@ -33972,7 +34127,7 @@ var AlertText = /*#__PURE__*/styled__default.p.withConfig({
33972
34127
  displayName: "TradingMenu__AlertText",
33973
34128
  componentId: "sc-1wjsz1l-5"
33974
34129
  })(["color:red !important;text-align:center;margin:0.3rem 0;font-size:0.5rem;"]);
33975
- var ButtonWrapper$3 = /*#__PURE__*/styled__default.div.withConfig({
34130
+ var ButtonWrapper$2 = /*#__PURE__*/styled__default.div.withConfig({
33976
34131
  displayName: "TradingMenu__ButtonWrapper",
33977
34132
  componentId: "sc-1wjsz1l-6"
33978
34133
  })(["display:flex;justify-content:space-around;width:100%;margin-top:1rem;"]);
@@ -34154,7 +34309,7 @@ exports.FriendList = FriendList;
34154
34309
  exports.HistoryDialog = HistoryDialog;
34155
34310
  exports.ImageCarousel = ImageCarousel;
34156
34311
  exports.Input = Input;
34157
- exports.InputRadio = InputRadio$1;
34312
+ exports.InputRadio = InputRadio;
34158
34313
  exports.InternalTabs = InternalTabs;
34159
34314
  exports.ItemContainer = ItemContainer$1;
34160
34315
  exports.ItemQuantitySelectorModal = ItemQuantitySelectorModal;