@rpg-engine/long-bow 0.7.90 → 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 +464 -289
  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 +464 -290
  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 +306 -121
  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,
@@ -28642,9 +28817,21 @@ var CraftBook = function CraftBook(_ref) {
28642
28817
  var _useState3 = useState(),
28643
28818
  size = _useState3[0],
28644
28819
  setSize = _useState3[1];
28645
- var _useState4 = useState(false),
28646
- isCraftingDisabled = _useState4[0],
28647
- setIsCraftingDisabled = _useState4[1];
28820
+ var _useState4 = useState(''),
28821
+ searchTerm = _useState4[0],
28822
+ setSearchTerm = _useState4[1];
28823
+ var _useState5 = useState(false),
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];
28648
28835
  useEffect(function () {
28649
28836
  var handleResize = function handleResize() {
28650
28837
  if (window.innerWidth < 500 && (size == null ? void 0 : size.width) !== mobilePortrait.width && (!scale || scale < 1)) {
@@ -28661,80 +28848,90 @@ var CraftBook = function CraftBook(_ref) {
28661
28848
  return window.removeEventListener('resize', handleResize);
28662
28849
  };
28663
28850
  }, [scale]);
28664
- var renderItemTypes = function renderItemTypes() {
28665
- var itemTypes = ['Suggested'].concat(Object.keys(ItemSubType)).filter(function (type) {
28666
- return type !== 'DeadBody';
28667
- }).sort(function (a, b) {
28668
- if (a === 'Suggested') return -1;
28669
- if (b === 'Suggested') return 1;
28670
- return a.localeCompare(b);
28671
- });
28672
- if (window.innerWidth > parseInt(mobilePortrait.width)) {
28673
- return itemTypes.map(function (type) {
28674
- return React.createElement(InputRadio, {
28675
- key: type,
28676
- value: type,
28677
- label: type,
28678
- name: type,
28679
- isChecked: selectedType === type,
28680
- onRadioSelect: function onRadioSelect(value) {
28681
- setSelectedType(value);
28682
- onSelect(value);
28683
- }
28684
- });
28685
- });
28686
- }
28687
- var rows = [[], []];
28688
- itemTypes.forEach(function (type, index) {
28689
- var row = 0;
28690
- if (index % 2 === 1) row = 1;
28691
- rows[row].push(React.createElement(InputRadio, {
28692
- key: type,
28693
- value: type,
28694
- label: type,
28695
- name: type,
28696
- isChecked: selectedType === type,
28697
- onRadioSelect: function onRadioSelect(value) {
28698
- setSelectedType(value);
28699
- onSelect(value);
28700
- }
28701
- }));
28702
- });
28703
- return rows.map(function (row, index) {
28704
- return React.createElement("div", {
28705
- key: index,
28706
- style: {
28707
- display: 'flex',
28708
- gap: '10px'
28709
- }
28710
- }, row);
28851
+ var togglePinItem = function togglePinItem(itemKey) {
28852
+ setPinnedItems(function (current) {
28853
+ return current.includes(itemKey) ? current.filter(function (key) {
28854
+ return key !== itemKey;
28855
+ }) : [].concat(current, [itemKey]);
28711
28856
  });
28712
28857
  };
28858
+ var categoryOptions = ['Suggested'].concat(pinnedItems.length > 0 ? ['Pinned'] : [], Object.keys(ItemSubType)).filter(function (type) {
28859
+ return type !== 'DeadBody';
28860
+ }).sort(function (a, b) {
28861
+ if (a === 'Suggested') return -1;
28862
+ if (b === 'Suggested') return 1;
28863
+ if (a === 'Pinned') return -1;
28864
+ if (b === 'Pinned') return 1;
28865
+ return a.localeCompare(b);
28866
+ }).map(function (type, index) {
28867
+ return {
28868
+ id: index,
28869
+ value: type,
28870
+ option: type
28871
+ };
28872
+ });
28873
+ var filteredCraftableItems = craftablesItems == null ? void 0 : craftablesItems.filter(function (item) {
28874
+ var matchesSearch = item.name.toLowerCase().includes(searchTerm.toLowerCase());
28875
+ var matchesCategory = selectedType === 'Suggested' || selectedType === 'Pinned' && pinnedItems.includes(item.key) || item.type === selectedType;
28876
+ return matchesSearch && matchesCategory;
28877
+ });
28878
+ var sortedItems = [].concat(filteredCraftableItems || []).sort(function (a, b) {
28879
+ var aIsPinned = pinnedItems.includes(a.key);
28880
+ var bIsPinned = pinnedItems.includes(b.key);
28881
+ if (aIsPinned && !bIsPinned) return -1;
28882
+ if (!aIsPinned && bIsPinned) return 1;
28883
+ return 0;
28884
+ });
28885
+ var totalPages = Math.ceil(sortedItems.length / ITEMS_PER_PAGE);
28886
+ var paginatedItems = sortedItems.slice((currentPage - 1) * ITEMS_PER_PAGE, currentPage * ITEMS_PER_PAGE);
28887
+ useEffect(function () {
28888
+ setCurrentPage(1);
28889
+ }, [selectedType, searchTerm]);
28713
28890
  if (!size) return null;
28714
28891
  return React.createElement(DraggableContainer, {
28715
28892
  type: RPGUIContainerTypes.Framed,
28716
28893
  width: size.width,
28717
28894
  height: size.height,
28718
28895
  cancelDrag: ".inputRadioCraftBook",
28719
- onCloseButton: function onCloseButton() {
28720
- if (onClose) {
28721
- onClose();
28722
- }
28723
- },
28896
+ onCloseButton: onClose,
28724
28897
  scale: scale
28725
- }, React.createElement(Wrapper, null, React.createElement("div", {
28726
- style: {
28727
- width: '100%'
28898
+ }, 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, {
28899
+ options: categoryOptions,
28900
+ onChange: function onChange(value) {
28901
+ setSelectedType(value);
28902
+ onSelect(value);
28903
+ },
28904
+ width: "200px"
28905
+ })), React.createElement(SearchButton$2, {
28906
+ onClick: function onClick() {
28907
+ return setIsSearchVisible(!isSearchVisible);
28728
28908
  }
28729
- }, React.createElement(Title$2, null, "Craftbook"), React.createElement(Subtitle, null, "Select an item to craft"), React.createElement("hr", {
28730
- className: "golden"
28731
- })), React.createElement(ContentContainer, null, React.createElement(ItemTypes, {
28732
- className: "inputRadioCraftBook"
28733
- }, renderItemTypes()), React.createElement(RadioInputScroller, {
28909
+ }, React.createElement(FaSearch, {
28910
+ size: 16
28911
+ })))), isSearchVisible && React.createElement(SearchContainer$1, null, React.createElement("input", {
28912
+ type: "text",
28913
+ className: "rpgui-input",
28914
+ placeholder: "Search items...",
28915
+ value: searchTerm,
28916
+ onChange: function onChange(e) {
28917
+ return setSearchTerm(e.target.value);
28918
+ },
28919
+ autoFocus: true
28920
+ })), React.createElement(ContentContainer, null, React.createElement(RadioInputScroller, {
28734
28921
  className: "inputRadioCraftBook"
28735
- }, craftablesItems == null ? void 0 : craftablesItems.map(function (item) {
28736
- return React.createElement(CraftingRecipe, {
28922
+ }, paginatedItems == null ? void 0 : paginatedItems.map(function (item) {
28923
+ return React.createElement(CraftingRecipeWrapper, {
28737
28924
  key: item.key,
28925
+ isSelected: pinnedItems.includes(item.key)
28926
+ }, React.createElement(PinButton, {
28927
+ onClick: function onClick(e) {
28928
+ e.stopPropagation();
28929
+ togglePinItem(item.key);
28930
+ },
28931
+ isPinned: pinnedItems.includes(item.key)
28932
+ }, React.createElement(FaThumbtack, {
28933
+ size: 14
28934
+ })), React.createElement(CraftingRecipe, {
28738
28935
  atlasIMG: atlasIMG,
28739
28936
  atlasJSON: atlasJSON,
28740
28937
  equipmentSet: equipmentSet,
@@ -28744,8 +28941,26 @@ var CraftBook = function CraftBook(_ref) {
28744
28941
  selectedCraftItemKey: craftItemKey,
28745
28942
  inventory: inventory,
28746
28943
  skills: skills
28747
- });
28748
- }))), React.createElement(ButtonWrapper, null, React.createElement(Button, {
28944
+ }));
28945
+ }))), React.createElement(PaginationContainer, null, React.createElement(PaginationButton, {
28946
+ onClick: function onClick() {
28947
+ return setCurrentPage(function (prev) {
28948
+ return Math.max(1, prev - 1);
28949
+ });
28950
+ },
28951
+ disabled: currentPage === 1
28952
+ }, React.createElement(FaChevronLeft, {
28953
+ size: 12
28954
+ })), React.createElement(PageInfo, null, "Page ", currentPage, " of ", totalPages), React.createElement(PaginationButton, {
28955
+ onClick: function onClick() {
28956
+ return setCurrentPage(function (prev) {
28957
+ return Math.min(totalPages, prev + 1);
28958
+ });
28959
+ },
28960
+ disabled: currentPage === totalPages
28961
+ }, React.createElement(FaChevronRight, {
28962
+ size: 12
28963
+ }))), React.createElement(Footer, null, React.createElement(Button, {
28749
28964
  buttonType: ButtonTypes.RPGUIButton,
28750
28965
  onPointerDown: onClose
28751
28966
  }, "Cancel"), React.createElement(Button, {
@@ -28768,116 +28983,75 @@ var CraftBook = function CraftBook(_ref) {
28768
28983
  var Wrapper = /*#__PURE__*/styled.div.withConfig({
28769
28984
  displayName: "CraftBook__Wrapper",
28770
28985
  componentId: "sc-19q95ue-0"
28771
- })(["display:flex;flex-direction:column;width:100%;height:100%;"]);
28986
+ })(["display:flex;flex-direction:column;width:100%;height:100%;& > *{box-sizing:border-box;}"]);
28987
+ var HeaderContainer = /*#__PURE__*/styled.div.withConfig({
28988
+ displayName: "CraftBook__HeaderContainer",
28989
+ componentId: "sc-19q95ue-1"
28990
+ })(["display:flex;justify-content:space-between;align-items:center;width:100%;padding:16px 16px 0;"]);
28772
28991
  var Title$2 = /*#__PURE__*/styled.h1.withConfig({
28773
28992
  displayName: "CraftBook__Title",
28774
- componentId: "sc-19q95ue-1"
28775
- })(["font-size:0.6rem;color:", " !important;"], uiColors.yellow);
28776
- var Subtitle = /*#__PURE__*/styled.h1.withConfig({
28777
- displayName: "CraftBook__Subtitle",
28778
28993
  componentId: "sc-19q95ue-2"
28779
- })(["font-size:0.4rem;color:", " !important;"], uiColors.yellow);
28780
- var RadioInputScroller = /*#__PURE__*/styled.div.withConfig({
28781
- displayName: "CraftBook__RadioInputScroller",
28994
+ })(["font-size:1.2rem;color:", " !important;margin:0;text-shadow:2px 2px 2px rgba(0,0,0,0.5);"], uiColors.yellow);
28995
+ var HeaderControls = /*#__PURE__*/styled.div.withConfig({
28996
+ displayName: "CraftBook__HeaderControls",
28782
28997
  componentId: "sc-19q95ue-3"
28783
- })(["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);
28784
- var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
28785
- displayName: "CraftBook__ButtonWrapper",
28998
+ })(["display:flex;align-items:center;gap:16px;position:relative;left:-2rem;"]);
28999
+ var DropdownWrapper = /*#__PURE__*/styled.div.withConfig({
29000
+ displayName: "CraftBook__DropdownWrapper",
28786
29001
  componentId: "sc-19q95ue-4"
28787
- })(["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);
28788
- var ContentContainer = /*#__PURE__*/styled.div.withConfig({
28789
- displayName: "CraftBook__ContentContainer",
29002
+ })(["width:200px;"]);
29003
+ var SearchButton$2 = /*#__PURE__*/styled.button.withConfig({
29004
+ displayName: "CraftBook__SearchButton",
28790
29005
  componentId: "sc-19q95ue-5"
28791
- })(["display:flex;width:100%;min-height:0;flex:1;@media (max-width:", "){flex-direction:column;}"], mobilePortrait.width);
28792
- var ItemTypes = /*#__PURE__*/styled.div.withConfig({
28793
- displayName: "CraftBook__ItemTypes",
29006
+ })(["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);
29007
+ var SearchContainer$1 = /*#__PURE__*/styled.div.withConfig({
29008
+ displayName: "CraftBook__SearchContainer",
28794
29009
  componentId: "sc-19q95ue-6"
28795
- })(["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);
28796
-
28797
- var Dropdown = function Dropdown(_ref) {
28798
- var options = _ref.options,
28799
- width = _ref.width,
28800
- onChange = _ref.onChange,
28801
- _ref$opensUp = _ref.opensUp,
28802
- opensUp = _ref$opensUp === void 0 ? false : _ref$opensUp;
28803
- var dropdownId = v4();
28804
- var _useState = useState(''),
28805
- selectedValue = _useState[0],
28806
- setSelectedValue = _useState[1];
28807
- var _useState2 = useState(''),
28808
- selectedOption = _useState2[0],
28809
- setSelectedOption = _useState2[1];
28810
- var _useState3 = useState(false),
28811
- opened = _useState3[0],
28812
- setOpened = _useState3[1];
28813
- useEffect(function () {
28814
- var firstOption = options[0];
28815
- if (firstOption) {
28816
- var change = !selectedValue;
28817
- if (!change) {
28818
- change = options.filter(function (o) {
28819
- return o.value === selectedValue;
28820
- }).length < 1;
28821
- }
28822
- if (change) {
28823
- setSelectedValue(firstOption.value);
28824
- setSelectedOption(firstOption.option);
28825
- }
28826
- }
28827
- }, [options]);
28828
- useEffect(function () {
28829
- if (selectedValue) {
28830
- onChange(selectedValue);
28831
- }
28832
- }, [selectedValue]);
28833
- return React.createElement(Container$d, {
28834
- onMouseLeave: function onMouseLeave() {
28835
- return setOpened(false);
28836
- },
28837
- width: width
28838
- }, React.createElement(DropdownSelect$1, {
28839
- id: "dropdown-" + dropdownId,
28840
- className: "rpgui-dropdown-imp rpgui-dropdown-imp-header",
28841
- onPointerUp: function onPointerUp() {
28842
- return setOpened(function (prev) {
28843
- return !prev;
28844
- });
28845
- }
28846
- }, React.createElement("label", null, "\u25BC"), " ", selectedOption), React.createElement(DropdownOptions$1, {
28847
- className: "rpgui-dropdown-imp",
28848
- opened: opened,
28849
- opensUp: opensUp
28850
- }, options.map(function (option) {
28851
- return React.createElement("li", {
28852
- key: option.id,
28853
- onPointerUp: function onPointerUp() {
28854
- setSelectedValue(option.value);
28855
- setSelectedOption(option.option);
28856
- setOpened(false);
28857
- }
28858
- }, option.option);
28859
- })));
28860
- };
28861
- var Container$d = /*#__PURE__*/styled.div.withConfig({
28862
- displayName: "Dropdown__Container",
28863
- componentId: "sc-8arn65-0"
28864
- })(["position:relative;width:", ";"], function (props) {
28865
- return props.width || '100%';
29010
+ })(["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);}}"]);
29011
+ var ContentContainer = /*#__PURE__*/styled.div.withConfig({
29012
+ displayName: "CraftBook__ContentContainer",
29013
+ componentId: "sc-19q95ue-7"
29014
+ })(["flex:1;min-height:0;padding:16px;padding-right:0;padding-bottom:0;overflow:hidden;width:100%;"]);
29015
+ var RadioInputScroller = /*#__PURE__*/styled.div.withConfig({
29016
+ displayName: "CraftBook__RadioInputScroller",
29017
+ componentId: "sc-19q95ue-8"
29018
+ })(["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);
29019
+ var CraftingRecipeWrapper = /*#__PURE__*/styled.div.withConfig({
29020
+ displayName: "CraftBook__CraftingRecipeWrapper",
29021
+ componentId: "sc-19q95ue-9"
29022
+ })(["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) {
29023
+ return props.isSelected && "\n background: rgba(255, 215, 0, 0.1);\n ";
28866
29024
  });
28867
- var DropdownSelect$1 = /*#__PURE__*/styled.p.withConfig({
28868
- displayName: "Dropdown__DropdownSelect",
28869
- componentId: "sc-8arn65-1"
28870
- })(["width:100%;box-sizing:border-box;label{display:inline-block;transform:translateY(-2px);}"]);
28871
- var DropdownOptions$1 = /*#__PURE__*/styled.ul.withConfig({
28872
- displayName: "Dropdown__DropdownOptions",
28873
- componentId: "sc-8arn65-2"
28874
- })(["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) {
28875
- return props.opened ? 'block' : 'none';
29025
+ var PinButton = /*#__PURE__*/styled.button.withConfig({
29026
+ displayName: "CraftBook__PinButton",
29027
+ componentId: "sc-19q95ue-10"
29028
+ })(["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) {
29029
+ return props.isPinned ? uiColors.yellow : uiColors.lightGray;
28876
29030
  }, function (props) {
28877
- return props.opensUp ? '100%' : 'auto';
29031
+ return props.isPinned ? 1 : 0.6;
29032
+ }, uiColors.yellow);
29033
+ var Footer = /*#__PURE__*/styled.div.withConfig({
29034
+ displayName: "CraftBook__Footer",
29035
+ componentId: "sc-19q95ue-11"
29036
+ })(["display:flex;justify-content:flex-end;gap:16px;padding:8px;button{min-width:100px;}@media (max-width:", "){justify-content:center;}"], mobilePortrait.width);
29037
+ var PaginationContainer = /*#__PURE__*/styled.div.withConfig({
29038
+ displayName: "CraftBook__PaginationContainer",
29039
+ componentId: "sc-19q95ue-12"
29040
+ })(["display:flex;align-items:center;justify-content:center;gap:16px;padding:8px;margin-top:8px;border-top:1px solid ", ";"], uiColors.darkGray);
29041
+ var PaginationButton = /*#__PURE__*/styled.button.withConfig({
29042
+ displayName: "CraftBook__PaginationButton",
29043
+ componentId: "sc-19q95ue-13"
29044
+ })(["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) {
29045
+ return props.disabled ? uiColors.darkGray : uiColors.yellow;
28878
29046
  }, function (props) {
28879
- return props.opensUp ? 'auto' : '100%';
29047
+ return props.disabled ? 'not-allowed' : 'pointer';
29048
+ }, function (props) {
29049
+ return props.disabled ? 0.5 : 0.8;
28880
29050
  });
29051
+ var PageInfo = /*#__PURE__*/styled.div.withConfig({
29052
+ displayName: "CraftBook__PageInfo",
29053
+ componentId: "sc-19q95ue-14"
29054
+ })(["color:", ";font-size:0.8rem;font-family:'Press Start 2P',cursive;"], uiColors.lightGray);
28881
29055
 
28882
29056
  var DropdownSelectorContainer = function DropdownSelectorContainer(_ref) {
28883
29057
  var title = _ref.title,
@@ -30889,7 +31063,7 @@ var ItemSelector = function ItemSelector(_ref) {
30889
31063
  style: {
30890
31064
  width: '100%'
30891
31065
  }
30892
- }, React.createElement(Title$3, null, 'Harvesting instruments'), React.createElement(Subtitle$1, null, 'Use the tool, you need it'), React.createElement("hr", {
31066
+ }, React.createElement(Title$3, null, 'Harvesting instruments'), React.createElement(Subtitle, null, 'Use the tool, you need it'), React.createElement("hr", {
30893
31067
  className: "golden"
30894
31068
  })), React.createElement(RadioInputScroller$1, null, options == null ? void 0 : options.map(function (option, index) {
30895
31069
  return React.createElement(RadioOptionsWrapper$1, {
@@ -30911,7 +31085,7 @@ var ItemSelector = function ItemSelector(_ref) {
30911
31085
  alignItems: 'center'
30912
31086
  }
30913
31087
  }, option.name, " ", React.createElement("br", null), option.description)));
30914
- })), React.createElement(ButtonWrapper$1, null, React.createElement(Button, {
31088
+ })), React.createElement(ButtonWrapper, null, React.createElement(Button, {
30915
31089
  buttonType: ButtonTypes.RPGUIButton,
30916
31090
  onPointerDown: onClose
30917
31091
  }, "Cancel"), React.createElement(Button, {
@@ -30922,7 +31096,7 @@ var Title$3 = /*#__PURE__*/styled.h1.withConfig({
30922
31096
  displayName: "ItemSelector__Title",
30923
31097
  componentId: "sc-gptoxp-0"
30924
31098
  })(["font-size:0.6rem;color:yellow !important;"]);
30925
- var Subtitle$1 = /*#__PURE__*/styled.h1.withConfig({
31099
+ var Subtitle = /*#__PURE__*/styled.h1.withConfig({
30926
31100
  displayName: "ItemSelector__Subtitle",
30927
31101
  componentId: "sc-gptoxp-1"
30928
31102
  })(["font-size:0.4rem;color:yellow !important;"]);
@@ -30938,7 +31112,7 @@ var RadioOptionsWrapper$1 = /*#__PURE__*/styled.div.withConfig({
30938
31112
  displayName: "ItemSelector__RadioOptionsWrapper",
30939
31113
  componentId: "sc-gptoxp-4"
30940
31114
  })(["display:flex;align-items:stretch;margin-bottom:40px;"]);
30941
- var ButtonWrapper$1 = /*#__PURE__*/styled.div.withConfig({
31115
+ var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
30942
31116
  displayName: "ItemSelector__ButtonWrapper",
30943
31117
  componentId: "sc-gptoxp-5"
30944
31118
  })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
@@ -31834,7 +32008,7 @@ var PartyCreate = function PartyCreate(_ref) {
31834
32008
  }))), React.createElement("h1", null, "Type your party name"), React.createElement(Input, {
31835
32009
  placeholder: "Type party name",
31836
32010
  type: "text"
31837
- }), React.createElement(ButtonWrapper$2, null, React.createElement(Button, {
32011
+ }), React.createElement(ButtonWrapper$1, null, React.createElement(Button, {
31838
32012
  buttonType: ButtonTypes.RPGUIButton,
31839
32013
  onPointerDown: function onPointerDown() {
31840
32014
  onCreate();
@@ -31856,7 +32030,7 @@ var Title$4 = /*#__PURE__*/styled.h1.withConfig({
31856
32030
  displayName: "PartyCreate__Title",
31857
32031
  componentId: "sc-13brop0-1"
31858
32032
  })(["font-size:0.6rem;color:", " !important;"], uiColors.yellow);
31859
- var ButtonWrapper$2 = /*#__PURE__*/styled.div.withConfig({
32033
+ var ButtonWrapper$1 = /*#__PURE__*/styled.div.withConfig({
31860
32034
  displayName: "PartyCreate__ButtonWrapper",
31861
32035
  componentId: "sc-13brop0-2"
31862
32036
  })(["margin-top:10px;width:100%;display:flex;justify-content:space-around;align-items:center;.cancel-button{filter:grayscale(0.7);}"]);
@@ -32573,7 +32747,7 @@ var formatQuestStatus = function formatQuestStatus(status) {
32573
32747
  });
32574
32748
  };
32575
32749
 
32576
- var InputRadio$1 = function InputRadio(_ref) {
32750
+ var InputRadio = function InputRadio(_ref) {
32577
32751
  var name = _ref.name,
32578
32752
  items = _ref.items,
32579
32753
  onChange = _ref.onChange;
@@ -33915,7 +34089,7 @@ var TradingMenu = function TradingMenu(_ref) {
33915
34089
  scale: scale,
33916
34090
  isBuy: isBuy()
33917
34091
  });
33918
- })), 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, {
34092
+ })), 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, {
33919
34093
  buttonType: ButtonTypes.RPGUIButton,
33920
34094
  disabled: !hasGoldForSale(),
33921
34095
  onPointerDown: function onPointerDown() {
@@ -33950,7 +34124,7 @@ var AlertText = /*#__PURE__*/styled.p.withConfig({
33950
34124
  displayName: "TradingMenu__AlertText",
33951
34125
  componentId: "sc-1wjsz1l-5"
33952
34126
  })(["color:red !important;text-align:center;margin:0.3rem 0;font-size:0.5rem;"]);
33953
- var ButtonWrapper$3 = /*#__PURE__*/styled.div.withConfig({
34127
+ var ButtonWrapper$2 = /*#__PURE__*/styled.div.withConfig({
33954
34128
  displayName: "TradingMenu__ButtonWrapper",
33955
34129
  componentId: "sc-1wjsz1l-6"
33956
34130
  })(["display:flex;justify-content:space-around;width:100%;margin-top:1rem;"]);
@@ -34110,5 +34284,5 @@ var LessonContainer = /*#__PURE__*/styled.div.withConfig({
34110
34284
  componentId: "sc-7tgzv2-6"
34111
34285
  })(["display:flex;flex-direction:column;justify-content:space-between;min-height:200px;p{font-size:0.7rem !important;}"]);
34112
34286
 
34113
- 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 };
34287
+ 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 };
34114
34288
  //# sourceMappingURL=long-bow.esm.js.map