@rpg-engine/long-bow 0.7.91 → 0.7.93

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 +455 -294
  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 +455 -295
  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 +287 -139
  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
@@ -5,11 +5,11 @@ import { v4 } from 'uuid';
5
5
  import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarities, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSubType, isMobile, ItemSlotType, isMobileOrTablet, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, PeriodOfDay, UserAccountTypes } from '@rpg-engine/shared';
6
6
  import dayjs from 'dayjs';
7
7
  import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
8
- import { FaTimes } from 'react-icons/fa';
8
+ import { FaTimes, FaSearch, FaThumbtack, FaChevronLeft, FaChevronRight } from 'react-icons/fa';
9
9
  import { RxMagnifyingGlass, RxCross2 } from 'react-icons/rx';
10
10
  import { IoMdContract, IoMdExpand } from 'react-icons/io';
11
11
  import Draggable from 'react-draggable';
12
- import ReactDOM from 'react-dom';
12
+ import ReactDOM, { createPortal } from 'react-dom';
13
13
  import { camelCase, debounce } from 'lodash-es';
14
14
  import { observer } from 'mobx-react-lite';
15
15
  import { AiFillCaretRight } from 'react-icons/ai';
@@ -27157,6 +27157,47 @@ var StyledShortcut = /*#__PURE__*/styled(SingleShortcut).withConfig({
27157
27157
  componentId: "sc-1fewf3h-4"
27158
27158
  })(["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);
27159
27159
 
27160
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
27161
+ function useLocalStorage(key, initialValue) {
27162
+ // State to store our value
27163
+ // Pass initial state function to useState so logic is only executed once
27164
+ var _useState = useState(function () {
27165
+ if (typeof window === 'undefined') {
27166
+ return initialValue;
27167
+ }
27168
+ try {
27169
+ // Get from local storage by key
27170
+ var item = window.localStorage.getItem(key);
27171
+ // Parse stored json or if none return initialValue
27172
+ return item ? JSON.parse(item) : initialValue;
27173
+ } catch (error) {
27174
+ // If error also return initialValue
27175
+ console.log(error);
27176
+ return initialValue;
27177
+ }
27178
+ }),
27179
+ storedValue = _useState[0],
27180
+ setStoredValue = _useState[1];
27181
+ // Return a wrapped version of useState's setter function that ...
27182
+ // ... persists the new value to localStorage.
27183
+ var setValue = function setValue(value) {
27184
+ try {
27185
+ // Allow value to be a function so we have same API as useState
27186
+ var valueToStore = value instanceof Function ? value(storedValue) : value;
27187
+ // Save state
27188
+ setStoredValue(valueToStore);
27189
+ // Save to local storage
27190
+ if (typeof window !== 'undefined') {
27191
+ window.localStorage.setItem(key, JSON.stringify(valueToStore));
27192
+ }
27193
+ } catch (error) {
27194
+ // A more advanced implementation would handle the error case
27195
+ console.log(error);
27196
+ }
27197
+ };
27198
+ return [storedValue, setValue];
27199
+ }
27200
+
27160
27201
  function useOutsideClick(ref, id) {
27161
27202
  useEffect(function () {
27162
27203
  /**
@@ -27319,54 +27360,99 @@ var Icon = /*#__PURE__*/styled.img.withConfig({
27319
27360
  return width;
27320
27361
  });
27321
27362
 
27322
- var InputRadio = function InputRadio(_ref) {
27323
- var label = _ref.label,
27324
- name = _ref.name,
27325
- value = _ref.value,
27326
- isChecked = _ref.isChecked,
27327
- onRadioSelect = _ref.onRadioSelect;
27328
- var onRadioClick = function onRadioClick() {
27329
- onRadioSelect(value);
27330
- };
27331
- return React.createElement("div", {
27332
- onPointerUp: onRadioClick
27333
- }, React.createElement("input", {
27334
- className: "rpgui-radio",
27335
- name: name,
27336
- value: value,
27337
- type: "radio",
27338
- "data-rpguitype": "radio",
27339
- checked: isChecked,
27340
- // rpgui breaks onChange on this input (doesn't work). That's why I had to wrap it with a div and a onClick listener.
27341
- readOnly: true
27342
- }), React.createElement("label", null, label));
27343
- };
27344
-
27345
- var countItemFromInventory = function countItemFromInventory(itemKey, inventory) {
27346
- var itemsFromInventory = [];
27347
- if (inventory) {
27348
- Object.keys(inventory.slots).forEach(function (i) {
27349
- var _inventory$slots$inde;
27350
- var index = parseInt(i);
27351
- if (((_inventory$slots$inde = inventory.slots[index]) == null ? void 0 : _inventory$slots$inde.key) === itemKey) {
27352
- itemsFromInventory.push(inventory.slots[index]);
27363
+ var Dropdown = function Dropdown(_ref) {
27364
+ var options = _ref.options,
27365
+ width = _ref.width,
27366
+ onChange = _ref.onChange,
27367
+ _ref$opensUp = _ref.opensUp,
27368
+ opensUp = _ref$opensUp === void 0 ? false : _ref$opensUp;
27369
+ var dropdownId = v4();
27370
+ var _useState = useState(''),
27371
+ selectedValue = _useState[0],
27372
+ setSelectedValue = _useState[1];
27373
+ var _useState2 = useState(''),
27374
+ selectedOption = _useState2[0],
27375
+ setSelectedOption = _useState2[1];
27376
+ var _useState3 = useState(false),
27377
+ opened = _useState3[0],
27378
+ setOpened = _useState3[1];
27379
+ useEffect(function () {
27380
+ var firstOption = options[0];
27381
+ if (firstOption) {
27382
+ var change = !selectedValue;
27383
+ if (!change) {
27384
+ change = options.filter(function (o) {
27385
+ return o.value === selectedValue;
27386
+ }).length < 1;
27353
27387
  }
27354
- });
27355
- }
27356
- var totalQty = itemsFromInventory.reduce(function (acc, item) {
27357
- return acc + ((item == null ? void 0 : item.stackQty) || 1);
27358
- }, 0);
27359
- return totalQty;
27388
+ if (change) {
27389
+ setSelectedValue(firstOption.value);
27390
+ setSelectedOption(firstOption.option);
27391
+ }
27392
+ }
27393
+ }, [options]);
27394
+ useEffect(function () {
27395
+ if (selectedValue) {
27396
+ onChange(selectedValue);
27397
+ }
27398
+ }, [selectedValue]);
27399
+ return React.createElement(Container$8, {
27400
+ onMouseLeave: function onMouseLeave() {
27401
+ return setOpened(false);
27402
+ },
27403
+ width: width
27404
+ }, React.createElement(DropdownSelect$1, {
27405
+ id: "dropdown-" + dropdownId,
27406
+ className: "rpgui-dropdown-imp rpgui-dropdown-imp-header",
27407
+ onPointerUp: function onPointerUp() {
27408
+ return setOpened(function (prev) {
27409
+ return !prev;
27410
+ });
27411
+ }
27412
+ }, React.createElement("label", null, "\u25BC"), " ", selectedOption), React.createElement(DropdownOptions$1, {
27413
+ className: "rpgui-dropdown-imp",
27414
+ opened: opened,
27415
+ opensUp: opensUp
27416
+ }, options.map(function (option) {
27417
+ return React.createElement("li", {
27418
+ key: option.id,
27419
+ onPointerUp: function onPointerUp() {
27420
+ setSelectedValue(option.value);
27421
+ setSelectedOption(option.option);
27422
+ setOpened(false);
27423
+ }
27424
+ }, option.option);
27425
+ })));
27360
27426
  };
27427
+ var Container$8 = /*#__PURE__*/styled.div.withConfig({
27428
+ displayName: "Dropdown__Container",
27429
+ componentId: "sc-8arn65-0"
27430
+ })(["position:relative;width:", ";"], function (props) {
27431
+ return props.width || '100%';
27432
+ });
27433
+ var DropdownSelect$1 = /*#__PURE__*/styled.p.withConfig({
27434
+ displayName: "Dropdown__DropdownSelect",
27435
+ componentId: "sc-8arn65-1"
27436
+ })(["width:100%;box-sizing:border-box;label{display:inline-block;transform:translateY(-2px);}"]);
27437
+ var DropdownOptions$1 = /*#__PURE__*/styled.ul.withConfig({
27438
+ displayName: "Dropdown__DropdownOptions",
27439
+ componentId: "sc-8arn65-2"
27440
+ })(["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) {
27441
+ return props.opened ? 'block' : 'none';
27442
+ }, function (props) {
27443
+ return props.opensUp ? '100%' : 'auto';
27444
+ }, function (props) {
27445
+ return props.opensUp ? 'auto' : '100%';
27446
+ });
27361
27447
 
27362
27448
  var modalRoot = /*#__PURE__*/document.getElementById('modal-root');
27363
27449
  var ModalPortal = function ModalPortal(_ref) {
27364
27450
  var children = _ref.children;
27365
- return ReactDOM.createPortal(React.createElement(Container$8, {
27451
+ return ReactDOM.createPortal(React.createElement(Container$9, {
27366
27452
  className: "rpgui-content"
27367
27453
  }, children), modalRoot);
27368
27454
  };
27369
- var Container$8 = /*#__PURE__*/styled.div.withConfig({
27455
+ var Container$9 = /*#__PURE__*/styled.div.withConfig({
27370
27456
  displayName: "ModalPortal__Container",
27371
27457
  componentId: "sc-dgmp04-0"
27372
27458
  })(["position:static !important;"]);
@@ -28042,7 +28128,7 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28042
28128
  });
28043
28129
  }
28044
28130
  };
28045
- return React.createElement(Container$9, {
28131
+ return React.createElement(Container$a, {
28046
28132
  isDraggingItem: !!draggingState.item,
28047
28133
  item: item,
28048
28134
  className: "rpgui-icon empty-slot",
@@ -28106,7 +28192,7 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28106
28192
  containerType: containerType
28107
28193
  }))));
28108
28194
  });
28109
- var Container$9 = /*#__PURE__*/styled.div.withConfig({
28195
+ var Container$a = /*#__PURE__*/styled.div.withConfig({
28110
28196
  displayName: "ItemSlot__Container",
28111
28197
  componentId: "sc-l2j5ef-0"
28112
28198
  })(["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) {
@@ -28222,7 +28308,7 @@ var ItemInfo = function ItemInfo(_ref) {
28222
28308
  });
28223
28309
  };
28224
28310
  var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
28225
- return React.createElement(Container$a, {
28311
+ return React.createElement(Container$b, {
28226
28312
  item: item
28227
28313
  }, React.createElement(Header, null, React.createElement("div", null, React.createElement(Title$1, null, item.name), item.rarity !== 'Common' && React.createElement(Rarity, {
28228
28314
  item: item
@@ -28236,7 +28322,7 @@ var ItemInfo = function ItemInfo(_ref) {
28236
28322
  "$isSpecial": true
28237
28323
  }, "Two handed"), React.createElement(Description, null, item.description), item.maxStackSize && item.maxStackSize !== 1 && React.createElement(StackInfo, null, "x", Math.round(((_item$stackQty = item.stackQty) != null ? _item$stackQty : 1) * 100) / 100, "(", item.maxStackSize, ")"), renderMissingStatistic().length > 0 && React.createElement(MissingStatistics, null, React.createElement(Statistic, null, "Equipped Diff"), itemToCompare && renderMissingStatistic()));
28238
28324
  };
28239
- var Container$a = /*#__PURE__*/styled.div.withConfig({
28325
+ var Container$b = /*#__PURE__*/styled.div.withConfig({
28240
28326
  displayName: "ItemInfo__Container",
28241
28327
  componentId: "sc-1xm4q8k-0"
28242
28328
  })(["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) {
@@ -28382,7 +28468,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
28382
28468
  }
28383
28469
  return;
28384
28470
  }, []);
28385
- return React.createElement(ModalPortal, null, React.createElement(Container$b, {
28471
+ return React.createElement(ModalPortal, null, React.createElement(Container$c, {
28386
28472
  ref: ref
28387
28473
  }, React.createElement(ItemInfoDisplay, {
28388
28474
  item: item,
@@ -28391,7 +28477,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
28391
28477
  equipmentSet: equipmentSet
28392
28478
  })));
28393
28479
  };
28394
- var Container$b = /*#__PURE__*/styled.div.withConfig({
28480
+ var Container$c = /*#__PURE__*/styled.div.withConfig({
28395
28481
  displayName: "ItemTooltip__Container",
28396
28482
  componentId: "sc-11d9r7x-0"
28397
28483
  })(["position:absolute;z-index:100;pointer-events:none;left:0;top:0;opacity:0;transition:opacity 0.08s;"]);
@@ -28411,7 +28497,7 @@ var MobileItemTooltip = function MobileItemTooltip(_ref) {
28411
28497
  var _ref$current;
28412
28498
  (_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
28413
28499
  };
28414
- return React.createElement(ModalPortal, null, React.createElement(Container$c, {
28500
+ return React.createElement(ModalPortal, null, React.createElement(Container$d, {
28415
28501
  ref: ref,
28416
28502
  onTouchEnd: function onTouchEnd() {
28417
28503
  handleFadeOut();
@@ -28439,7 +28525,7 @@ var MobileItemTooltip = function MobileItemTooltip(_ref) {
28439
28525
  }, option.text);
28440
28526
  }))));
28441
28527
  };
28442
- var Container$c = /*#__PURE__*/styled.div.withConfig({
28528
+ var Container$d = /*#__PURE__*/styled.div.withConfig({
28443
28529
  displayName: "MobileItemTooltip__Container",
28444
28530
  componentId: "sc-ku4p1j-0"
28445
28531
  })(["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;}"]);
@@ -28492,8 +28578,114 @@ var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
28492
28578
  }));
28493
28579
  };
28494
28580
 
28495
- var CraftingRecipe = function CraftingRecipe(_ref) {
28581
+ var countItemFromInventory = function countItemFromInventory(itemKey, inventory) {
28582
+ var itemsFromInventory = [];
28583
+ if (inventory) {
28584
+ Object.keys(inventory.slots).forEach(function (i) {
28585
+ var _inventory$slots$inde;
28586
+ var index = parseInt(i);
28587
+ if (((_inventory$slots$inde = inventory.slots[index]) == null ? void 0 : _inventory$slots$inde.key) === itemKey) {
28588
+ itemsFromInventory.push(inventory.slots[index]);
28589
+ }
28590
+ });
28591
+ }
28592
+ var totalQty = itemsFromInventory.reduce(function (acc, item) {
28593
+ return acc + ((item == null ? void 0 : item.stackQty) || 1);
28594
+ }, 0);
28595
+ return totalQty;
28596
+ };
28597
+
28598
+ var modifyString = function modifyString(str) {
28599
+ var parts = str.split('/');
28600
+ var fileName = parts[parts.length - 1];
28601
+ parts = fileName.split('.');
28602
+ var name = parts[0];
28603
+ name = name.replace(/-/g, ' ');
28604
+ var words = name.split(' ');
28605
+ var firstWord = words[0].slice(0, 1).toUpperCase() + words[0].slice(1);
28606
+ var modifiedWords = [firstWord].concat(words.slice(1));
28607
+ return modifiedWords.join(' ');
28608
+ };
28609
+
28610
+ var TooltipContainer = /*#__PURE__*/styled.div.withConfig({
28611
+ displayName: "CraftingTooltip__TooltipContainer",
28612
+ componentId: "sc-iqzgok-0"
28613
+ })(["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) {
28614
+ return props.x;
28615
+ }, function (props) {
28616
+ return props.y;
28617
+ }, uiColors.darkGray);
28618
+ var MinCraftingRequirementsText = /*#__PURE__*/styled.div.withConfig({
28619
+ displayName: "CraftingTooltip__MinCraftingRequirementsText",
28620
+ componentId: "sc-iqzgok-1"
28621
+ })(["font-size:0.55rem;margin:0;margin-bottom:12px;color:", " !important;"], function (_ref) {
28622
+ var levelIsOk = _ref.levelIsOk;
28623
+ return levelIsOk ? uiColors.lightGreen : uiColors.lightGray;
28624
+ });
28625
+ var IngredientsTitle = /*#__PURE__*/styled.div.withConfig({
28626
+ displayName: "CraftingTooltip__IngredientsTitle",
28627
+ componentId: "sc-iqzgok-2"
28628
+ })(["color:", ";font-size:0.6rem;margin-bottom:12px;text-transform:uppercase;letter-spacing:0.5px;"], uiColors.yellow);
28629
+ var Recipe = /*#__PURE__*/styled.div.withConfig({
28630
+ displayName: "CraftingTooltip__Recipe",
28631
+ componentId: "sc-iqzgok-3"
28632
+ })(["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;}"]);
28633
+ var Ingredient = /*#__PURE__*/styled.div.withConfig({
28634
+ displayName: "CraftingTooltip__Ingredient",
28635
+ componentId: "sc-iqzgok-4"
28636
+ })(["margin:0;margin-left:14px;color:", " !important;"], function (_ref2) {
28637
+ var isQuantityOk = _ref2.isQuantityOk;
28638
+ return isQuantityOk ? uiColors.lightGreen : uiColors.lightGray;
28639
+ });
28640
+ var CraftingTooltip = function CraftingTooltip(_ref3) {
28496
28641
  var _skills$level, _skills, _recipe$minCraftingRe, _recipe$minCraftingRe2, _recipe$levelIsOk, _recipe$minCraftingRe3, _recipe$minCraftingRe4, _recipe$minCraftingRe5, _recipe$minCraftingRe6;
28642
+ var x = _ref3.x,
28643
+ y = _ref3.y,
28644
+ recipe = _ref3.recipe,
28645
+ inventory = _ref3.inventory,
28646
+ skills = _ref3.skills,
28647
+ atlasIMG = _ref3.atlasIMG,
28648
+ atlasJSON = _ref3.atlasJSON;
28649
+ 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;
28650
+ var levelIsOk = (_recipe$levelIsOk = recipe == null ? void 0 : recipe.levelIsOk) != null ? _recipe$levelIsOk : false;
28651
+ return React.createElement(TooltipContainer, {
28652
+ x: x,
28653
+ y: y
28654
+ }, React.createElement(MinCraftingRequirementsText, {
28655
+ levelIsOk: levelIsOk
28656
+ }, 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.createElement(IngredientsTitle, null, "Ingredients"), recipe.ingredients.map(function (ingredient, index) {
28657
+ var itemQtyInInventory = !inventory ? 0 : countItemFromInventory(ingredient.key, inventory);
28658
+ var isQuantityOk = ingredient.qty <= itemQtyInInventory;
28659
+ return React.createElement(Recipe, {
28660
+ key: index
28661
+ }, React.createElement(SpriteFromAtlas, {
28662
+ atlasIMG: atlasIMG,
28663
+ atlasJSON: atlasJSON,
28664
+ spriteKey: ingredient.texturePath,
28665
+ imgScale: 1.2
28666
+ }), React.createElement(Ingredient, {
28667
+ isQuantityOk: isQuantityOk
28668
+ }, modifyString(ingredient.key), " x", ingredient.qty, " (", itemQtyInInventory, ")"));
28669
+ }));
28670
+ };
28671
+
28672
+ var RadioOptionsWrapper = /*#__PURE__*/styled.div.withConfig({
28673
+ displayName: "CraftingRecipe__RadioOptionsWrapper",
28674
+ componentId: "sc-1fe04wz-0"
28675
+ })(["display:flex;align-items:stretch;margin-bottom:0.5rem;padding:8px;position:relative;cursor:pointer;"]);
28676
+ var SpriteAtlasWrapper = /*#__PURE__*/styled.div.withConfig({
28677
+ displayName: "CraftingRecipe__SpriteAtlasWrapper",
28678
+ componentId: "sc-1fe04wz-1"
28679
+ })(["margin-right:40px;flex-shrink:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center;"]);
28680
+ var MainContent = /*#__PURE__*/styled.div.withConfig({
28681
+ displayName: "CraftingRecipe__MainContent",
28682
+ componentId: "sc-1fe04wz-2"
28683
+ })(["flex:1;min-width:0;"]);
28684
+ var ItemHeader = /*#__PURE__*/styled.div.withConfig({
28685
+ displayName: "CraftingRecipe__ItemHeader",
28686
+ componentId: "sc-1fe04wz-3"
28687
+ })(["display:flex;align-items:center;gap:8px;margin-bottom:4px;label{font-size:0.9rem;font-weight:bold;display:flex;align-items:center;}"]);
28688
+ var CraftingRecipe = function CraftingRecipe(_ref) {
28497
28689
  var atlasIMG = _ref.atlasIMG,
28498
28690
  atlasJSON = _ref.atlasJSON,
28499
28691
  equipmentSet = _ref.equipmentSet,
@@ -28503,23 +28695,42 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
28503
28695
  selectedCraftItemKey = _ref.selectedCraftItemKey,
28504
28696
  inventory = _ref.inventory,
28505
28697
  skills = _ref.skills;
28506
- var modifyString = function modifyString(str) {
28507
- // Split the string by "/" and "."
28508
- var parts = str.split('/');
28509
- var fileName = parts[parts.length - 1];
28510
- parts = fileName.split('.');
28511
- var name = parts[0];
28512
- // Replace all occurrences of "-" with " "
28513
- name = name.replace(/-/g, ' ');
28514
- // Uppercase the first word
28515
- var words = name.split(' ');
28516
- var firstWord = words[0].slice(0, 1).toUpperCase() + words[0].slice(1);
28517
- var modifiedWords = [firstWord].concat(words.slice(1));
28518
- name = modifiedWords.join(' ');
28519
- return name;
28698
+ var _useState = useState(false),
28699
+ showTooltip = _useState[0],
28700
+ setShowTooltip = _useState[1];
28701
+ var _useState2 = useState({
28702
+ x: 0,
28703
+ y: 0
28704
+ }),
28705
+ tooltipPosition = _useState2[0],
28706
+ setTooltipPosition = _useState2[1];
28707
+ var wrapperRef = useRef(null);
28708
+ var isSelected = selectedCraftItemKey === recipe.key;
28709
+ useEffect(function () {
28710
+ var handleClickOutside = function handleClickOutside(event) {
28711
+ if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
28712
+ setShowTooltip(false);
28713
+ }
28714
+ };
28715
+ document.addEventListener('mousedown', handleClickOutside);
28716
+ return function () {
28717
+ document.removeEventListener('mousedown', handleClickOutside);
28718
+ };
28719
+ }, []);
28720
+ var handleClick = function handleClick() {
28721
+ if (wrapperRef.current) {
28722
+ var rect = wrapperRef.current.getBoundingClientRect();
28723
+ setTooltipPosition({
28724
+ x: rect.right + 10,
28725
+ y: rect.top
28726
+ });
28727
+ setShowTooltip(true);
28728
+ }
28520
28729
  };
28521
- 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;
28522
- return React.createElement(RadioOptionsWrapper, null, React.createElement(SpriteAtlasWrapper, null, React.createElement(ItemInfoWrapper, {
28730
+ return React.createElement(RadioOptionsWrapper, {
28731
+ ref: wrapperRef,
28732
+ onClick: handleClick
28733
+ }, React.createElement(SpriteAtlasWrapper, null, React.createElement(ItemInfoWrapper, {
28523
28734
  item: recipe,
28524
28735
  atlasIMG: atlasIMG,
28525
28736
  atlasJSON: atlasJSON,
@@ -28531,7 +28742,7 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
28531
28742
  spriteKey: recipe.texturePath,
28532
28743
  imgScale: 3,
28533
28744
  grayScale: !recipe.canCraft
28534
- }))), React.createElement("div", null, React.createElement("div", {
28745
+ }))), React.createElement(MainContent, null, React.createElement(ItemHeader, {
28535
28746
  onPointerUp: recipe.canCraft ? handleRecipeSelect : undefined
28536
28747
  }, React.createElement("input", {
28537
28748
  className: "rpgui-radio",
@@ -28539,55 +28750,18 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
28539
28750
  value: recipe.name,
28540
28751
  name: "test",
28541
28752
  disabled: !recipe.canCraft,
28542
- checked: selectedCraftItemKey === recipe.key,
28753
+ checked: isSelected,
28543
28754
  onChange: handleRecipeSelect
28544
- }), React.createElement("label", {
28545
- style: {
28546
- display: 'flex',
28547
- alignItems: 'center'
28548
- }
28549
- }, modifyString(recipe.name))), React.createElement(MinCraftingRequirementsText, {
28550
- levelIsOk: (_recipe$levelIsOk = recipe == null ? void 0 : recipe.levelIsOk) != null ? _recipe$levelIsOk : false
28551
- }, 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) {
28552
- var itemQtyInInventory = !inventory ? 0 : countItemFromInventory(ingredient.key, inventory);
28553
- return React.createElement(Recipe, {
28554
- key: index
28555
- }, React.createElement(SpriteFromAtlas, {
28556
- atlasIMG: atlasIMG,
28557
- atlasJSON: atlasJSON,
28558
- spriteKey: ingredient.texturePath,
28559
- imgScale: 1.2
28560
- }), React.createElement(Ingredient, {
28561
- isQuantityOk: ingredient.qty <= itemQtyInInventory
28562
- }, modifyString(ingredient.key), " x", ingredient.qty, " (", itemQtyInInventory, ")"));
28563
- })));
28755
+ }), React.createElement("label", null, modifyString(recipe.name)))), showTooltip && createPortal(React.createElement(CraftingTooltip, {
28756
+ x: tooltipPosition.x,
28757
+ y: tooltipPosition.y,
28758
+ recipe: recipe,
28759
+ inventory: inventory,
28760
+ skills: skills,
28761
+ atlasIMG: atlasIMG,
28762
+ atlasJSON: atlasJSON
28763
+ }), document.body));
28564
28764
  };
28565
- var Ingredient = /*#__PURE__*/styled.p.withConfig({
28566
- displayName: "CraftingRecipe__Ingredient",
28567
- componentId: "sc-1fe04wz-0"
28568
- })(["margin:0;margin-left:14px;color:", " !important;"], function (_ref2) {
28569
- var isQuantityOk = _ref2.isQuantityOk;
28570
- return isQuantityOk ? uiColors.lightGreen : uiColors.lightGray;
28571
- });
28572
- var Recipe = /*#__PURE__*/styled.div.withConfig({
28573
- displayName: "CraftingRecipe__Recipe",
28574
- componentId: "sc-1fe04wz-1"
28575
- })(["font-size:0.6rem;margin-bottom:3px;display:flex;align-items:center;margin-left:4px;.sprite-from-atlas-img{top:0px;left:0px;}"]);
28576
- var SpriteAtlasWrapper = /*#__PURE__*/styled.div.withConfig({
28577
- displayName: "CraftingRecipe__SpriteAtlasWrapper",
28578
- componentId: "sc-1fe04wz-2"
28579
- })(["margin-right:40px;"]);
28580
- var RadioOptionsWrapper = /*#__PURE__*/styled.div.withConfig({
28581
- displayName: "CraftingRecipe__RadioOptionsWrapper",
28582
- componentId: "sc-1fe04wz-3"
28583
- })(["display:flex;align-items:stretch;margin-bottom:40px;"]);
28584
- var MinCraftingRequirementsText = /*#__PURE__*/styled.p.withConfig({
28585
- displayName: "CraftingRecipe__MinCraftingRequirementsText",
28586
- componentId: "sc-1fe04wz-4"
28587
- })(["font-size:0.6rem !important;margin:0 5px 0 35px;color:", " !important;"], function (_ref3) {
28588
- var levelIsOk = _ref3.levelIsOk;
28589
- return levelIsOk ? uiColors.lightGreen : uiColors.lightGray;
28590
- });
28591
28765
 
28592
28766
  function calculateMaxCraftable(recipe, inventory) {
28593
28767
  if (!inventory || !(recipe != null && recipe.ingredients)) {
@@ -28621,6 +28795,7 @@ var mobilePortrait = {
28621
28795
  width: '500px',
28622
28796
  height: '700px'
28623
28797
  };
28798
+ var ITEMS_PER_PAGE = 8;
28624
28799
  var CraftBook = function CraftBook(_ref) {
28625
28800
  var atlasIMG = _ref.atlasIMG,
28626
28801
  atlasJSON = _ref.atlasJSON,
@@ -28646,8 +28821,23 @@ var CraftBook = function CraftBook(_ref) {
28646
28821
  searchTerm = _useState4[0],
28647
28822
  setSearchTerm = _useState4[1];
28648
28823
  var _useState5 = useState(false),
28649
- isCraftingDisabled = _useState5[0],
28650
- setIsCraftingDisabled = _useState5[1];
28824
+ isSearchVisible = _useState5[0],
28825
+ setIsSearchVisible = _useState5[1];
28826
+ var _useState6 = useState(false),
28827
+ isCraftingDisabled = _useState6[0],
28828
+ setIsCraftingDisabled = _useState6[1];
28829
+ var _useLocalStorage = useLocalStorage('pinnedCraftItems', []),
28830
+ pinnedItems = _useLocalStorage[0],
28831
+ setPinnedItems = _useLocalStorage[1];
28832
+ var _useState7 = useState(1),
28833
+ currentPage = _useState7[0],
28834
+ setCurrentPage = _useState7[1];
28835
+ var _useState8 = useState(craftablesItems),
28836
+ items = _useState8[0],
28837
+ setItems = _useState8[1];
28838
+ useEffect(function () {
28839
+ setItems(craftablesItems);
28840
+ }, [craftablesItems]);
28651
28841
  useEffect(function () {
28652
28842
  var handleResize = function handleResize() {
28653
28843
  if (window.innerWidth < 500 && (size == null ? void 0 : size.width) !== mobilePortrait.width && (!scale || scale < 1)) {
@@ -28664,93 +28854,90 @@ var CraftBook = function CraftBook(_ref) {
28664
28854
  return window.removeEventListener('resize', handleResize);
28665
28855
  };
28666
28856
  }, [scale]);
28667
- var renderItemTypes = function renderItemTypes() {
28668
- var itemTypes = ['Suggested'].concat(Object.keys(ItemSubType)).filter(function (type) {
28669
- return type !== 'DeadBody';
28670
- }).sort(function (a, b) {
28671
- if (a === 'Suggested') return -1;
28672
- if (b === 'Suggested') return 1;
28673
- return a.localeCompare(b);
28674
- });
28675
- if (window.innerWidth > parseInt(mobilePortrait.width)) {
28676
- return itemTypes.map(function (type) {
28677
- return React.createElement(InputRadio, {
28678
- key: type,
28679
- value: type,
28680
- label: type,
28681
- name: type,
28682
- isChecked: selectedType === type,
28683
- onRadioSelect: function onRadioSelect(value) {
28684
- setSelectedType(value);
28685
- onSelect(value);
28686
- }
28687
- });
28688
- });
28689
- }
28690
- var rows = [[], []];
28691
- itemTypes.forEach(function (type, index) {
28692
- var row = 0;
28693
- if (index % 2 === 1) row = 1;
28694
- rows[row].push(React.createElement(InputRadio, {
28695
- key: type,
28696
- value: type,
28697
- label: type,
28698
- name: type,
28699
- isChecked: selectedType === type,
28700
- onRadioSelect: function onRadioSelect(value) {
28701
- setSelectedType(value);
28702
- onSelect(value);
28703
- }
28704
- }));
28705
- });
28706
- return rows.map(function (row, index) {
28707
- return React.createElement("div", {
28708
- key: index,
28709
- style: {
28710
- display: 'flex',
28711
- gap: '10px'
28712
- }
28713
- }, row);
28857
+ var togglePinItem = function togglePinItem(itemKey) {
28858
+ setPinnedItems(function (current) {
28859
+ return current.includes(itemKey) ? current.filter(function (key) {
28860
+ return key !== itemKey;
28861
+ }) : [].concat(current, [itemKey]);
28714
28862
  });
28715
28863
  };
28716
- var filteredCraftableItems = craftablesItems == null ? void 0 : craftablesItems.filter(function (item) {
28864
+ var categoryOptions = ['Suggested'].concat(pinnedItems.length > 0 ? ['Pinned'] : [], Object.keys(ItemSubType)).filter(function (type) {
28865
+ return type !== 'DeadBody';
28866
+ }).sort(function (a, b) {
28867
+ if (a === 'Suggested') return -1;
28868
+ if (b === 'Suggested') return 1;
28869
+ if (a === 'Pinned') return -1;
28870
+ if (b === 'Pinned') return 1;
28871
+ return a.localeCompare(b);
28872
+ }).map(function (type, index) {
28873
+ return {
28874
+ id: index,
28875
+ value: type,
28876
+ option: type
28877
+ };
28878
+ });
28879
+ var filteredCraftableItems = items == null ? void 0 : items.filter(function (item) {
28717
28880
  var matchesSearch = item.name.toLowerCase().includes(searchTerm.toLowerCase());
28718
- var matchesCategory = selectedType === 'Suggested' || item.type === selectedType;
28881
+ var matchesCategory = selectedType === 'Suggested' || selectedType === 'Pinned' && pinnedItems.includes(item.key) || item.subType === selectedType;
28719
28882
  return matchesSearch && matchesCategory;
28720
28883
  });
28884
+ var sortedItems = [].concat(filteredCraftableItems || []).sort(function (a, b) {
28885
+ var aIsPinned = pinnedItems.includes(a.key);
28886
+ var bIsPinned = pinnedItems.includes(b.key);
28887
+ if (aIsPinned && !bIsPinned) return -1;
28888
+ if (!aIsPinned && bIsPinned) return 1;
28889
+ return 0;
28890
+ });
28891
+ var totalPages = Math.ceil(sortedItems.length / ITEMS_PER_PAGE);
28892
+ var paginatedItems = sortedItems.slice((currentPage - 1) * ITEMS_PER_PAGE, currentPage * ITEMS_PER_PAGE);
28893
+ useEffect(function () {
28894
+ setCurrentPage(1);
28895
+ }, [selectedType, searchTerm]);
28721
28896
  if (!size) return null;
28722
28897
  return React.createElement(DraggableContainer, {
28723
28898
  type: RPGUIContainerTypes.Framed,
28724
28899
  width: size.width,
28725
28900
  height: size.height,
28726
28901
  cancelDrag: ".inputRadioCraftBook",
28727
- onCloseButton: function onCloseButton() {
28728
- if (onClose) {
28729
- onClose();
28730
- }
28731
- },
28902
+ onCloseButton: onClose,
28732
28903
  scale: scale
28733
- }, React.createElement(Wrapper, null, React.createElement("div", {
28734
- style: {
28735
- width: '100%'
28904
+ }, React.createElement(Wrapper, null, React.createElement(HeaderContainer, null, React.createElement(Title$2, null, "Craftbook"), React.createElement(HeaderControls, null, React.createElement(DropdownWrapper, null, React.createElement(Dropdown, {
28905
+ options: categoryOptions,
28906
+ onChange: function onChange(value) {
28907
+ setSelectedType(value);
28908
+ onSelect(value);
28909
+ },
28910
+ width: "200px"
28911
+ })), React.createElement(SearchButton$2, {
28912
+ onClick: function onClick() {
28913
+ return setIsSearchVisible(!isSearchVisible);
28736
28914
  }
28737
- }, React.createElement(Title$2, null, "Craftbook"), React.createElement(Subtitle, null, "Select an item to craft"), React.createElement(SearchContainer$1, null, React.createElement("input", {
28915
+ }, React.createElement(FaSearch, {
28916
+ size: 16
28917
+ })))), isSearchVisible && React.createElement(SearchContainer$1, null, React.createElement("input", {
28738
28918
  type: "text",
28739
28919
  className: "rpgui-input",
28740
28920
  placeholder: "Search items...",
28741
28921
  value: searchTerm,
28742
28922
  onChange: function onChange(e) {
28743
28923
  return setSearchTerm(e.target.value);
28744
- }
28745
- })), React.createElement("hr", {
28746
- className: "golden"
28747
- })), React.createElement(ContentContainer, null, React.createElement(ItemTypes, {
28748
- className: "inputRadioCraftBook"
28749
- }, renderItemTypes()), React.createElement(RadioInputScroller, {
28924
+ },
28925
+ autoFocus: true
28926
+ })), React.createElement(ContentContainer, null, React.createElement(RadioInputScroller, {
28750
28927
  className: "inputRadioCraftBook"
28751
- }, filteredCraftableItems == null ? void 0 : filteredCraftableItems.map(function (item) {
28752
- return React.createElement(CraftingRecipe, {
28928
+ }, paginatedItems == null ? void 0 : paginatedItems.map(function (item) {
28929
+ return React.createElement(CraftingRecipeWrapper, {
28753
28930
  key: item.key,
28931
+ isSelected: pinnedItems.includes(item.key)
28932
+ }, React.createElement(PinButton, {
28933
+ onClick: function onClick(e) {
28934
+ e.stopPropagation();
28935
+ togglePinItem(item.key);
28936
+ },
28937
+ isPinned: pinnedItems.includes(item.key)
28938
+ }, React.createElement(FaThumbtack, {
28939
+ size: 14
28940
+ })), React.createElement(CraftingRecipe, {
28754
28941
  atlasIMG: atlasIMG,
28755
28942
  atlasJSON: atlasJSON,
28756
28943
  equipmentSet: equipmentSet,
@@ -28760,8 +28947,26 @@ var CraftBook = function CraftBook(_ref) {
28760
28947
  selectedCraftItemKey: craftItemKey,
28761
28948
  inventory: inventory,
28762
28949
  skills: skills
28763
- });
28764
- }))), React.createElement(ButtonWrapper, null, React.createElement(Button, {
28950
+ }));
28951
+ }))), React.createElement(PaginationContainer, null, React.createElement(PaginationButton, {
28952
+ onClick: function onClick() {
28953
+ return setCurrentPage(function (prev) {
28954
+ return Math.max(1, prev - 1);
28955
+ });
28956
+ },
28957
+ disabled: currentPage === 1
28958
+ }, React.createElement(FaChevronLeft, {
28959
+ size: 12
28960
+ })), React.createElement(PageInfo, null, "Page ", currentPage, " of ", totalPages), React.createElement(PaginationButton, {
28961
+ onClick: function onClick() {
28962
+ return setCurrentPage(function (prev) {
28963
+ return Math.min(totalPages, prev + 1);
28964
+ });
28965
+ },
28966
+ disabled: currentPage === totalPages
28967
+ }, React.createElement(FaChevronRight, {
28968
+ size: 12
28969
+ }))), React.createElement(Footer, null, React.createElement(Button, {
28765
28970
  buttonType: ButtonTypes.RPGUIButton,
28766
28971
  onPointerDown: onClose
28767
28972
  }, "Cancel"), React.createElement(Button, {
@@ -28784,120 +28989,75 @@ var CraftBook = function CraftBook(_ref) {
28784
28989
  var Wrapper = /*#__PURE__*/styled.div.withConfig({
28785
28990
  displayName: "CraftBook__Wrapper",
28786
28991
  componentId: "sc-19q95ue-0"
28787
- })(["display:flex;flex-direction:column;width:100%;height:100%;"]);
28992
+ })(["display:flex;flex-direction:column;width:100%;height:100%;& > *{box-sizing:border-box;}"]);
28993
+ var HeaderContainer = /*#__PURE__*/styled.div.withConfig({
28994
+ displayName: "CraftBook__HeaderContainer",
28995
+ componentId: "sc-19q95ue-1"
28996
+ })(["display:flex;justify-content:space-between;align-items:center;width:100%;padding:16px 16px 0;"]);
28788
28997
  var Title$2 = /*#__PURE__*/styled.h1.withConfig({
28789
28998
  displayName: "CraftBook__Title",
28790
- componentId: "sc-19q95ue-1"
28791
- })(["font-size:0.6rem;color:", " !important;"], uiColors.yellow);
28792
- var Subtitle = /*#__PURE__*/styled.h1.withConfig({
28793
- displayName: "CraftBook__Subtitle",
28794
28999
  componentId: "sc-19q95ue-2"
28795
- })(["font-size:0.4rem;color:", " !important;"], uiColors.yellow);
28796
- var RadioInputScroller = /*#__PURE__*/styled.div.withConfig({
28797
- displayName: "CraftBook__RadioInputScroller",
29000
+ })(["font-size:1.2rem;color:", " !important;margin:0;text-shadow:2px 2px 2px rgba(0,0,0,0.5);"], uiColors.yellow);
29001
+ var HeaderControls = /*#__PURE__*/styled.div.withConfig({
29002
+ displayName: "CraftBook__HeaderControls",
28798
29003
  componentId: "sc-19q95ue-3"
28799
- })(["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);
28800
- var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
28801
- displayName: "CraftBook__ButtonWrapper",
29004
+ })(["display:flex;align-items:center;gap:16px;position:relative;left:-2rem;"]);
29005
+ var DropdownWrapper = /*#__PURE__*/styled.div.withConfig({
29006
+ displayName: "CraftBook__DropdownWrapper",
28802
29007
  componentId: "sc-19q95ue-4"
28803
- })(["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);
28804
- var ContentContainer = /*#__PURE__*/styled.div.withConfig({
28805
- displayName: "CraftBook__ContentContainer",
29008
+ })(["width:200px;"]);
29009
+ var SearchButton$2 = /*#__PURE__*/styled.button.withConfig({
29010
+ displayName: "CraftBook__SearchButton",
28806
29011
  componentId: "sc-19q95ue-5"
28807
- })(["display:flex;width:100%;min-height:0;flex:1;@media (max-width:", "){flex-direction:column;}"], mobilePortrait.width);
28808
- var ItemTypes = /*#__PURE__*/styled.div.withConfig({
28809
- displayName: "CraftBook__ItemTypes",
28810
- componentId: "sc-19q95ue-6"
28811
- })(["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);
29012
+ })(["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);
28812
29013
  var SearchContainer$1 = /*#__PURE__*/styled.div.withConfig({
28813
29014
  displayName: "CraftBook__SearchContainer",
29015
+ componentId: "sc-19q95ue-6"
29016
+ })(["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);}}"]);
29017
+ var ContentContainer = /*#__PURE__*/styled.div.withConfig({
29018
+ displayName: "CraftBook__ContentContainer",
28814
29019
  componentId: "sc-19q95ue-7"
28815
- })(["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);}}"]);
28816
-
28817
- var Dropdown = function Dropdown(_ref) {
28818
- var options = _ref.options,
28819
- width = _ref.width,
28820
- onChange = _ref.onChange,
28821
- _ref$opensUp = _ref.opensUp,
28822
- opensUp = _ref$opensUp === void 0 ? false : _ref$opensUp;
28823
- var dropdownId = v4();
28824
- var _useState = useState(''),
28825
- selectedValue = _useState[0],
28826
- setSelectedValue = _useState[1];
28827
- var _useState2 = useState(''),
28828
- selectedOption = _useState2[0],
28829
- setSelectedOption = _useState2[1];
28830
- var _useState3 = useState(false),
28831
- opened = _useState3[0],
28832
- setOpened = _useState3[1];
28833
- useEffect(function () {
28834
- var firstOption = options[0];
28835
- if (firstOption) {
28836
- var change = !selectedValue;
28837
- if (!change) {
28838
- change = options.filter(function (o) {
28839
- return o.value === selectedValue;
28840
- }).length < 1;
28841
- }
28842
- if (change) {
28843
- setSelectedValue(firstOption.value);
28844
- setSelectedOption(firstOption.option);
28845
- }
28846
- }
28847
- }, [options]);
28848
- useEffect(function () {
28849
- if (selectedValue) {
28850
- onChange(selectedValue);
28851
- }
28852
- }, [selectedValue]);
28853
- return React.createElement(Container$d, {
28854
- onMouseLeave: function onMouseLeave() {
28855
- return setOpened(false);
28856
- },
28857
- width: width
28858
- }, React.createElement(DropdownSelect$1, {
28859
- id: "dropdown-" + dropdownId,
28860
- className: "rpgui-dropdown-imp rpgui-dropdown-imp-header",
28861
- onPointerUp: function onPointerUp() {
28862
- return setOpened(function (prev) {
28863
- return !prev;
28864
- });
28865
- }
28866
- }, React.createElement("label", null, "\u25BC"), " ", selectedOption), React.createElement(DropdownOptions$1, {
28867
- className: "rpgui-dropdown-imp",
28868
- opened: opened,
28869
- opensUp: opensUp
28870
- }, options.map(function (option) {
28871
- return React.createElement("li", {
28872
- key: option.id,
28873
- onPointerUp: function onPointerUp() {
28874
- setSelectedValue(option.value);
28875
- setSelectedOption(option.option);
28876
- setOpened(false);
28877
- }
28878
- }, option.option);
28879
- })));
28880
- };
28881
- var Container$d = /*#__PURE__*/styled.div.withConfig({
28882
- displayName: "Dropdown__Container",
28883
- componentId: "sc-8arn65-0"
28884
- })(["position:relative;width:", ";"], function (props) {
28885
- return props.width || '100%';
29020
+ })(["flex:1;min-height:0;padding:16px;padding-right:0;padding-bottom:0;overflow:hidden;width:100%;"]);
29021
+ var RadioInputScroller = /*#__PURE__*/styled.div.withConfig({
29022
+ displayName: "CraftBook__RadioInputScroller",
29023
+ componentId: "sc-19q95ue-8"
29024
+ })(["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);
29025
+ var CraftingRecipeWrapper = /*#__PURE__*/styled.div.withConfig({
29026
+ displayName: "CraftBook__CraftingRecipeWrapper",
29027
+ componentId: "sc-19q95ue-9"
29028
+ })(["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) {
29029
+ return props.isSelected && "\n background: rgba(255, 215, 0, 0.1);\n ";
28886
29030
  });
28887
- var DropdownSelect$1 = /*#__PURE__*/styled.p.withConfig({
28888
- displayName: "Dropdown__DropdownSelect",
28889
- componentId: "sc-8arn65-1"
28890
- })(["width:100%;box-sizing:border-box;label{display:inline-block;transform:translateY(-2px);}"]);
28891
- var DropdownOptions$1 = /*#__PURE__*/styled.ul.withConfig({
28892
- displayName: "Dropdown__DropdownOptions",
28893
- componentId: "sc-8arn65-2"
28894
- })(["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) {
28895
- return props.opened ? 'block' : 'none';
29031
+ var PinButton = /*#__PURE__*/styled.button.withConfig({
29032
+ displayName: "CraftBook__PinButton",
29033
+ componentId: "sc-19q95ue-10"
29034
+ })(["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) {
29035
+ return props.isPinned ? uiColors.yellow : uiColors.lightGray;
28896
29036
  }, function (props) {
28897
- return props.opensUp ? '100%' : 'auto';
29037
+ return props.isPinned ? 1 : 0.6;
29038
+ }, uiColors.yellow);
29039
+ var Footer = /*#__PURE__*/styled.div.withConfig({
29040
+ displayName: "CraftBook__Footer",
29041
+ componentId: "sc-19q95ue-11"
29042
+ })(["display:flex;justify-content:flex-end;gap:16px;padding:8px;button{min-width:100px;}@media (max-width:", "){justify-content:center;}"], mobilePortrait.width);
29043
+ var PaginationContainer = /*#__PURE__*/styled.div.withConfig({
29044
+ displayName: "CraftBook__PaginationContainer",
29045
+ componentId: "sc-19q95ue-12"
29046
+ })(["display:flex;align-items:center;justify-content:center;gap:16px;padding:8px;margin-top:8px;border-top:1px solid ", ";"], uiColors.darkGray);
29047
+ var PaginationButton = /*#__PURE__*/styled.button.withConfig({
29048
+ displayName: "CraftBook__PaginationButton",
29049
+ componentId: "sc-19q95ue-13"
29050
+ })(["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) {
29051
+ return props.disabled ? uiColors.darkGray : uiColors.yellow;
28898
29052
  }, function (props) {
28899
- return props.opensUp ? 'auto' : '100%';
29053
+ return props.disabled ? 'not-allowed' : 'pointer';
29054
+ }, function (props) {
29055
+ return props.disabled ? 0.5 : 0.8;
28900
29056
  });
29057
+ var PageInfo = /*#__PURE__*/styled.div.withConfig({
29058
+ displayName: "CraftBook__PageInfo",
29059
+ componentId: "sc-19q95ue-14"
29060
+ })(["color:", ";font-size:0.8rem;font-family:'Press Start 2P',cursive;"], uiColors.lightGray);
28901
29061
 
28902
29062
  var DropdownSelectorContainer = function DropdownSelectorContainer(_ref) {
28903
29063
  var title = _ref.title,
@@ -30909,7 +31069,7 @@ var ItemSelector = function ItemSelector(_ref) {
30909
31069
  style: {
30910
31070
  width: '100%'
30911
31071
  }
30912
- }, React.createElement(Title$3, null, 'Harvesting instruments'), React.createElement(Subtitle$1, null, 'Use the tool, you need it'), React.createElement("hr", {
31072
+ }, React.createElement(Title$3, null, 'Harvesting instruments'), React.createElement(Subtitle, null, 'Use the tool, you need it'), React.createElement("hr", {
30913
31073
  className: "golden"
30914
31074
  })), React.createElement(RadioInputScroller$1, null, options == null ? void 0 : options.map(function (option, index) {
30915
31075
  return React.createElement(RadioOptionsWrapper$1, {
@@ -30931,7 +31091,7 @@ var ItemSelector = function ItemSelector(_ref) {
30931
31091
  alignItems: 'center'
30932
31092
  }
30933
31093
  }, option.name, " ", React.createElement("br", null), option.description)));
30934
- })), React.createElement(ButtonWrapper$1, null, React.createElement(Button, {
31094
+ })), React.createElement(ButtonWrapper, null, React.createElement(Button, {
30935
31095
  buttonType: ButtonTypes.RPGUIButton,
30936
31096
  onPointerDown: onClose
30937
31097
  }, "Cancel"), React.createElement(Button, {
@@ -30942,7 +31102,7 @@ var Title$3 = /*#__PURE__*/styled.h1.withConfig({
30942
31102
  displayName: "ItemSelector__Title",
30943
31103
  componentId: "sc-gptoxp-0"
30944
31104
  })(["font-size:0.6rem;color:yellow !important;"]);
30945
- var Subtitle$1 = /*#__PURE__*/styled.h1.withConfig({
31105
+ var Subtitle = /*#__PURE__*/styled.h1.withConfig({
30946
31106
  displayName: "ItemSelector__Subtitle",
30947
31107
  componentId: "sc-gptoxp-1"
30948
31108
  })(["font-size:0.4rem;color:yellow !important;"]);
@@ -30958,7 +31118,7 @@ var RadioOptionsWrapper$1 = /*#__PURE__*/styled.div.withConfig({
30958
31118
  displayName: "ItemSelector__RadioOptionsWrapper",
30959
31119
  componentId: "sc-gptoxp-4"
30960
31120
  })(["display:flex;align-items:stretch;margin-bottom:40px;"]);
30961
- var ButtonWrapper$1 = /*#__PURE__*/styled.div.withConfig({
31121
+ var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
30962
31122
  displayName: "ItemSelector__ButtonWrapper",
30963
31123
  componentId: "sc-gptoxp-5"
30964
31124
  })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
@@ -31854,7 +32014,7 @@ var PartyCreate = function PartyCreate(_ref) {
31854
32014
  }))), React.createElement("h1", null, "Type your party name"), React.createElement(Input, {
31855
32015
  placeholder: "Type party name",
31856
32016
  type: "text"
31857
- }), React.createElement(ButtonWrapper$2, null, React.createElement(Button, {
32017
+ }), React.createElement(ButtonWrapper$1, null, React.createElement(Button, {
31858
32018
  buttonType: ButtonTypes.RPGUIButton,
31859
32019
  onPointerDown: function onPointerDown() {
31860
32020
  onCreate();
@@ -31876,7 +32036,7 @@ var Title$4 = /*#__PURE__*/styled.h1.withConfig({
31876
32036
  displayName: "PartyCreate__Title",
31877
32037
  componentId: "sc-13brop0-1"
31878
32038
  })(["font-size:0.6rem;color:", " !important;"], uiColors.yellow);
31879
- var ButtonWrapper$2 = /*#__PURE__*/styled.div.withConfig({
32039
+ var ButtonWrapper$1 = /*#__PURE__*/styled.div.withConfig({
31880
32040
  displayName: "PartyCreate__ButtonWrapper",
31881
32041
  componentId: "sc-13brop0-2"
31882
32042
  })(["margin-top:10px;width:100%;display:flex;justify-content:space-around;align-items:center;.cancel-button{filter:grayscale(0.7);}"]);
@@ -32593,7 +32753,7 @@ var formatQuestStatus = function formatQuestStatus(status) {
32593
32753
  });
32594
32754
  };
32595
32755
 
32596
- var InputRadio$1 = function InputRadio(_ref) {
32756
+ var InputRadio = function InputRadio(_ref) {
32597
32757
  var name = _ref.name,
32598
32758
  items = _ref.items,
32599
32759
  onChange = _ref.onChange;
@@ -33935,7 +34095,7 @@ var TradingMenu = function TradingMenu(_ref) {
33935
34095
  scale: scale,
33936
34096
  isBuy: isBuy()
33937
34097
  });
33938
- })), React.createElement(InfoSection, null, React.createElement(GoldInfo, null, React.createElement("p", null, "Available Gold:"), React.createElement("p", null, "$", characterAvailableGold.toFixed(2))), React.createElement(GoldInfo, null, React.createElement("p", null, "Total:"), React.createElement("p", null, "$", sum)), !hasGoldForSale() ? React.createElement(AlertText, null, "Sorry, not enough money.") : React.createElement(GoldInfo, null, React.createElement("p", null, "Final Gold:"), React.createElement("p", null, "$", getFinalGold().toFixed(2)))), React.createElement(ButtonWrapper$3, null, React.createElement(Button, {
34098
+ })), React.createElement(InfoSection, null, React.createElement(GoldInfo, null, React.createElement("p", null, "Available Gold:"), React.createElement("p", null, "$", characterAvailableGold.toFixed(2))), React.createElement(GoldInfo, null, React.createElement("p", null, "Total:"), React.createElement("p", null, "$", sum)), !hasGoldForSale() ? React.createElement(AlertText, null, "Sorry, not enough money.") : React.createElement(GoldInfo, null, React.createElement("p", null, "Final Gold:"), React.createElement("p", null, "$", getFinalGold().toFixed(2)))), React.createElement(ButtonWrapper$2, null, React.createElement(Button, {
33939
34099
  buttonType: ButtonTypes.RPGUIButton,
33940
34100
  disabled: !hasGoldForSale(),
33941
34101
  onPointerDown: function onPointerDown() {
@@ -33970,7 +34130,7 @@ var AlertText = /*#__PURE__*/styled.p.withConfig({
33970
34130
  displayName: "TradingMenu__AlertText",
33971
34131
  componentId: "sc-1wjsz1l-5"
33972
34132
  })(["color:red !important;text-align:center;margin:0.3rem 0;font-size:0.5rem;"]);
33973
- var ButtonWrapper$3 = /*#__PURE__*/styled.div.withConfig({
34133
+ var ButtonWrapper$2 = /*#__PURE__*/styled.div.withConfig({
33974
34134
  displayName: "TradingMenu__ButtonWrapper",
33975
34135
  componentId: "sc-1wjsz1l-6"
33976
34136
  })(["display:flex;justify-content:space-around;width:100%;margin-top:1rem;"]);
@@ -34130,5 +34290,5 @@ var LessonContainer = /*#__PURE__*/styled.div.withConfig({
34130
34290
  componentId: "sc-7tgzv2-6"
34131
34291
  })(["display:flex;flex-direction:column;justify-content:space-between;min-height:200px;p{font-size:0.7rem !important;}"]);
34132
34292
 
34133
- export { ActionButtons, AsyncDropdown, Button, ButtonTypes, CharacterSelection, Chat, ChatDeprecated, ChatRevamp, CheckButton, CheckItem, CircularController, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, EquipmentSlotSpriteByType, ErrorBoundary, FriendList, HistoryDialog, ImageCarousel, ImgSide, Input, InputRadio$1 as InputRadio, InternalTabs, ItemContainer$1 as ItemContainer, ItemQuantitySelectorModal, ItemSelector, ItemSlot, Leaderboard, ListMenu, Marketplace, MarketplaceRows, MultitabType, NPCDialog, NPCDialogType, NPCMultiDialog, PartyCreate, PartyDashboard, PartyInvite, PartyManager, PartyManagerRow, PartyRow, PlayersRow, ProgressBar, PropertySelect, QuantitySelectorModal, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, SelectArrow, Shortcuts, SimpleImageCarousel, SkillProgressBar, SkillsContainer, Spellbook, SpriteFromAtlas, Stepper, TabBody, Table, TableCell, TableHeader, TableRow, TabsContainer, TextArea, TimeWidget, Tooltip, TradingMenu, Truncate, TutorialStepper, UserActionLink, _RPGUI, formatQuestStatus, formatQuestText, getMockedPlayersRowsLeader, getMockedPlayersRowsNotLeader, getQuestStatusColor, mockedPartyManager, mockedPartyRows, mockedPlayersRows, mockedPlayersRows2, useEventListener };
34293
+ export { ActionButtons, AsyncDropdown, Button, ButtonTypes, CharacterSelection, Chat, ChatDeprecated, ChatRevamp, CheckButton, CheckItem, CircularController, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, EquipmentSlotSpriteByType, ErrorBoundary, FriendList, HistoryDialog, ImageCarousel, ImgSide, Input, InputRadio, InternalTabs, ItemContainer$1 as ItemContainer, ItemQuantitySelectorModal, ItemSelector, ItemSlot, Leaderboard, ListMenu, Marketplace, MarketplaceRows, MultitabType, NPCDialog, NPCDialogType, NPCMultiDialog, PartyCreate, PartyDashboard, PartyInvite, PartyManager, PartyManagerRow, PartyRow, PlayersRow, ProgressBar, PropertySelect, QuantitySelectorModal, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, SelectArrow, Shortcuts, SimpleImageCarousel, SkillProgressBar, SkillsContainer, Spellbook, SpriteFromAtlas, Stepper, TabBody, Table, TableCell, TableHeader, TableRow, TabsContainer, TextArea, TimeWidget, Tooltip, TradingMenu, Truncate, TutorialStepper, UserActionLink, _RPGUI, formatQuestStatus, formatQuestText, getMockedPlayersRowsLeader, getMockedPlayersRowsNotLeader, getQuestStatusColor, mockedPartyManager, mockedPartyRows, mockedPlayersRows, mockedPlayersRows2, useEventListener };
34134
34294
  //# sourceMappingURL=long-bow.esm.js.map