@rpg-engine/long-bow 0.8.14 → 0.8.15
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.
- package/dist/components/ConfirmModal.d.ts +2 -2
- package/dist/components/Item/Inventory/ItemPropertyColorSelector.d.ts +6 -2
- package/dist/long-bow.cjs.development.js +109 -58
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +109 -58
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/UI/dropdownsAndSelectors/ItemPropertyColorSelector.stories.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/ConfirmModal.tsx +20 -8
- package/src/components/Item/Inventory/ItemPropertyColorSelector.tsx +118 -31
- package/src/stories/UI/dropdownsAndSelectors/ItemPropertyColorSelector.stories.tsx +51 -25
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
export interface IConfirmModalProps {
|
|
3
3
|
onConfirm: () => void;
|
|
4
4
|
onClose: () => void;
|
|
5
|
-
message?: string;
|
|
5
|
+
message?: string | ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export declare const ConfirmModal: React.FC<IConfirmModalProps>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface IColorSelectorProps {
|
|
3
3
|
selectedColor: string;
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
onConfirm: (color: string) => void;
|
|
7
7
|
onChange: (color: string) => void;
|
|
8
|
+
costWarning?: {
|
|
9
|
+
cost: number;
|
|
10
|
+
currency?: string;
|
|
11
|
+
};
|
|
8
12
|
}
|
|
9
|
-
export declare const ColorSelector: React.FC<
|
|
13
|
+
export declare const ColorSelector: React.FC<IColorSelectorProps>;
|
|
10
14
|
export {};
|
|
@@ -32769,48 +32769,139 @@ var ItemsContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
32769
32769
|
return isFullScreen && '50%';
|
|
32770
32770
|
});
|
|
32771
32771
|
|
|
32772
|
+
var ConfirmModal = function ConfirmModal(_ref) {
|
|
32773
|
+
var onConfirm = _ref.onConfirm,
|
|
32774
|
+
onClose = _ref.onClose,
|
|
32775
|
+
_ref$message = _ref.message,
|
|
32776
|
+
message = _ref$message === void 0 ? 'Are you sure?' : _ref$message;
|
|
32777
|
+
var handleConfirm = function handleConfirm(e) {
|
|
32778
|
+
e.preventDefault();
|
|
32779
|
+
e.stopPropagation();
|
|
32780
|
+
onConfirm();
|
|
32781
|
+
};
|
|
32782
|
+
var handleClose = function handleClose(e) {
|
|
32783
|
+
e.preventDefault();
|
|
32784
|
+
e.stopPropagation();
|
|
32785
|
+
onClose();
|
|
32786
|
+
};
|
|
32787
|
+
return React__default.createElement(ModalPortal, null, React__default.createElement(Background, null), React__default.createElement(Container$t, {
|
|
32788
|
+
onClick: handleClose
|
|
32789
|
+
}, React__default.createElement(DraggableContainer, {
|
|
32790
|
+
width: "auto",
|
|
32791
|
+
dragDisabled: true
|
|
32792
|
+
}, React__default.createElement(Wrapper$1, {
|
|
32793
|
+
onClick: function onClick(e) {
|
|
32794
|
+
return e.stopPropagation();
|
|
32795
|
+
}
|
|
32796
|
+
}, typeof message === 'string' ? React__default.createElement("p", null, message) : message, React__default.createElement(ButtonsWrapper, null, React__default.createElement("div", {
|
|
32797
|
+
className: "cancel-button"
|
|
32798
|
+
}, React__default.createElement(Button, {
|
|
32799
|
+
buttonType: exports.ButtonTypes.RPGUIButton,
|
|
32800
|
+
onClick: handleClose
|
|
32801
|
+
}, "No")), React__default.createElement(Button, {
|
|
32802
|
+
buttonType: exports.ButtonTypes.RPGUIButton,
|
|
32803
|
+
onClick: handleConfirm
|
|
32804
|
+
}, "Yes"))))));
|
|
32805
|
+
};
|
|
32806
|
+
var Background = /*#__PURE__*/styled__default.div.withConfig({
|
|
32807
|
+
displayName: "ConfirmModal__Background",
|
|
32808
|
+
componentId: "sc-11qkyu1-0"
|
|
32809
|
+
})(["position:absolute;width:100%;height:100%;background-color:#000000;opacity:0.5;left:0;top:0;z-index:1000;"]);
|
|
32810
|
+
var Container$t = /*#__PURE__*/styled__default.div.withConfig({
|
|
32811
|
+
displayName: "ConfirmModal__Container",
|
|
32812
|
+
componentId: "sc-11qkyu1-1"
|
|
32813
|
+
})(["position:absolute;width:100%;height:100%;left:0;top:0;display:flex;justify-content:center;align-items:center;z-index:1001;"]);
|
|
32814
|
+
var Wrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
32815
|
+
displayName: "ConfirmModal__Wrapper",
|
|
32816
|
+
componentId: "sc-11qkyu1-2"
|
|
32817
|
+
})(["p{margin:0;}"]);
|
|
32818
|
+
var ButtonsWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
32819
|
+
displayName: "ConfirmModal__ButtonsWrapper",
|
|
32820
|
+
componentId: "sc-11qkyu1-3"
|
|
32821
|
+
})(["display:flex;justify-content:flex-end;gap:5px;margin-top:5px;.cancel-button{filter:grayscale(0.7);}"]);
|
|
32822
|
+
|
|
32772
32823
|
var ColorSelector = function ColorSelector(_ref) {
|
|
32773
32824
|
var selectedColor = _ref.selectedColor,
|
|
32774
32825
|
isOpen = _ref.isOpen,
|
|
32775
32826
|
onClose = _ref.onClose,
|
|
32776
32827
|
onConfirm = _ref.onConfirm,
|
|
32777
|
-
_onChange = _ref.onChange
|
|
32828
|
+
_onChange = _ref.onChange,
|
|
32829
|
+
costWarning = _ref.costWarning;
|
|
32778
32830
|
var _useState = React.useState(selectedColor),
|
|
32779
32831
|
currentColor = _useState[0],
|
|
32780
32832
|
setCurrentColor = _useState[1];
|
|
32833
|
+
var _useState2 = React.useState(false),
|
|
32834
|
+
showConfirmModal = _useState2[0],
|
|
32835
|
+
setShowConfirmModal = _useState2[1];
|
|
32781
32836
|
React.useEffect(function () {
|
|
32782
32837
|
if (isOpen) setCurrentColor(selectedColor);
|
|
32783
32838
|
}, [isOpen, selectedColor]);
|
|
32784
|
-
var handleConfirm = function handleConfirm() {
|
|
32839
|
+
var handleConfirm = function handleConfirm(e) {
|
|
32840
|
+
e.preventDefault();
|
|
32841
|
+
if (costWarning) {
|
|
32842
|
+
setShowConfirmModal(true);
|
|
32843
|
+
} else {
|
|
32844
|
+
onConfirm(currentColor);
|
|
32845
|
+
onClose();
|
|
32846
|
+
}
|
|
32847
|
+
};
|
|
32848
|
+
var handleConfirmCost = function handleConfirmCost() {
|
|
32785
32849
|
onConfirm(currentColor);
|
|
32850
|
+
setShowConfirmModal(false);
|
|
32786
32851
|
onClose();
|
|
32787
32852
|
};
|
|
32853
|
+
var handleClose = function handleClose() {
|
|
32854
|
+
setShowConfirmModal(false);
|
|
32855
|
+
};
|
|
32856
|
+
var renderConfirmMessage = function renderConfirmMessage() {
|
|
32857
|
+
return React__default.createElement(ConfirmContent, null, React__default.createElement("p", null, "Cost:", React__default.createElement(CostDisplay, null, costWarning == null ? void 0 : costWarning.cost.toLocaleString(), (costWarning == null ? void 0 : costWarning.currency) || ' gold')), React__default.createElement("p", null, "Proceed with color change?"));
|
|
32858
|
+
};
|
|
32788
32859
|
if (!isOpen) return null;
|
|
32789
|
-
return
|
|
32860
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(DraggableContainer, {
|
|
32790
32861
|
type: exports.RPGUIContainerTypes.Framed,
|
|
32791
32862
|
cancelDrag: ".react-colorful",
|
|
32792
|
-
width: "
|
|
32863
|
+
width: "25rem",
|
|
32793
32864
|
onCloseButton: onClose
|
|
32794
|
-
}, React__default.createElement(Container$
|
|
32865
|
+
}, React__default.createElement(Container$u, null, React__default.createElement(Header$3, null, "Select Color"), React__default.createElement(ColorPickerWrapper, null, React__default.createElement(reactColorful.HexColorPicker, {
|
|
32795
32866
|
color: currentColor,
|
|
32796
32867
|
onChange: function onChange(color) {
|
|
32797
32868
|
setCurrentColor(color);
|
|
32798
32869
|
_onChange(color);
|
|
32799
32870
|
}
|
|
32800
|
-
}), React__default.createElement(Button, {
|
|
32871
|
+
})), React__default.createElement(ButtonContainer$2, null, React__default.createElement(Button, {
|
|
32801
32872
|
buttonType: exports.ButtonTypes.RPGUIButton,
|
|
32802
32873
|
type: "button",
|
|
32803
32874
|
onClick: handleConfirm
|
|
32804
|
-
}, "Confirm")))
|
|
32875
|
+
}, "Confirm")))), showConfirmModal && costWarning && React__default.createElement(ConfirmModal, {
|
|
32876
|
+
message: renderConfirmMessage(),
|
|
32877
|
+
onConfirm: handleConfirmCost,
|
|
32878
|
+
onClose: handleClose
|
|
32879
|
+
}));
|
|
32805
32880
|
};
|
|
32806
|
-
var Container$
|
|
32881
|
+
var Container$u = /*#__PURE__*/styled__default.div.withConfig({
|
|
32807
32882
|
displayName: "ItemPropertyColorSelector__Container",
|
|
32808
32883
|
componentId: "sc-me1r4z-0"
|
|
32809
|
-
})(["
|
|
32884
|
+
})(["text-align:center;background:inherit;display:flex;flex-direction:column;gap:1.5rem;align-items:center;width:100%;max-width:24rem;margin:0 auto;"]);
|
|
32810
32885
|
var Header$3 = /*#__PURE__*/styled__default.h2.withConfig({
|
|
32811
32886
|
displayName: "ItemPropertyColorSelector__Header",
|
|
32812
32887
|
componentId: "sc-me1r4z-1"
|
|
32813
|
-
})(["
|
|
32888
|
+
})(["color:white;font-size:1rem;margin:0;width:100%;text-align:center;"]);
|
|
32889
|
+
var ColorPickerWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
32890
|
+
displayName: "ItemPropertyColorSelector__ColorPickerWrapper",
|
|
32891
|
+
componentId: "sc-me1r4z-2"
|
|
32892
|
+
})(["display:flex;justify-content:center;width:100%;.react-colorful{width:100%;max-width:200px;}"]);
|
|
32893
|
+
var ButtonContainer$2 = /*#__PURE__*/styled__default.div.withConfig({
|
|
32894
|
+
displayName: "ItemPropertyColorSelector__ButtonContainer",
|
|
32895
|
+
componentId: "sc-me1r4z-3"
|
|
32896
|
+
})(["display:flex;justify-content:center;width:100%;"]);
|
|
32897
|
+
var ConfirmContent = /*#__PURE__*/styled__default.div.withConfig({
|
|
32898
|
+
displayName: "ItemPropertyColorSelector__ConfirmContent",
|
|
32899
|
+
componentId: "sc-me1r4z-4"
|
|
32900
|
+
})(["display:flex;flex-direction:column;gap:0.5rem;text-align:center;font-family:'Press Start 2P',cursive;font-size:0.75rem;"]);
|
|
32901
|
+
var CostDisplay = /*#__PURE__*/styled__default.span.withConfig({
|
|
32902
|
+
displayName: "ItemPropertyColorSelector__CostDisplay",
|
|
32903
|
+
componentId: "sc-me1r4z-5"
|
|
32904
|
+
})(["color:", " !important;"], uiColors.yellow);
|
|
32814
32905
|
|
|
32815
32906
|
var ItemPropertySimpleHandler = function ItemPropertySimpleHandler(_ref) {
|
|
32816
32907
|
var isOpen = _ref.isOpen,
|
|
@@ -33141,7 +33232,7 @@ var ListMenu = function ListMenu(_ref) {
|
|
|
33141
33232
|
onSelected = _ref.onSelected,
|
|
33142
33233
|
x = _ref.x,
|
|
33143
33234
|
y = _ref.y;
|
|
33144
|
-
return React__default.createElement(Container$
|
|
33235
|
+
return React__default.createElement(Container$v, {
|
|
33145
33236
|
x: x,
|
|
33146
33237
|
y: y
|
|
33147
33238
|
}, React__default.createElement("ul", {
|
|
@@ -33158,7 +33249,7 @@ var ListMenu = function ListMenu(_ref) {
|
|
|
33158
33249
|
}, (params == null ? void 0 : params.text) || 'No text');
|
|
33159
33250
|
})));
|
|
33160
33251
|
};
|
|
33161
|
-
var Container$
|
|
33252
|
+
var Container$v = /*#__PURE__*/styled__default.div.withConfig({
|
|
33162
33253
|
displayName: "ListMenu__Container",
|
|
33163
33254
|
componentId: "sc-i9097t-0"
|
|
33164
33255
|
})(["display:flex;flex-direction:column;width:100%;justify-content:start;align-items:flex-start;position:absolute;top:", "px;left:", "px;li{font-size:", ";}"], function (props) {
|
|
@@ -33177,7 +33268,7 @@ var Pager = function Pager(_ref) {
|
|
|
33177
33268
|
itemsPerPage = _ref.itemsPerPage,
|
|
33178
33269
|
onPageChange = _ref.onPageChange;
|
|
33179
33270
|
var totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
33180
|
-
return React__default.createElement(Container$
|
|
33271
|
+
return React__default.createElement(Container$w, null, React__default.createElement("p", null, "Total items: ", totalItems), React__default.createElement(PagerContainer, null, React__default.createElement("button", {
|
|
33181
33272
|
disabled: currentPage === 1,
|
|
33182
33273
|
onPointerDown: function onPointerDown() {
|
|
33183
33274
|
return onPageChange(Math.max(currentPage - 1, 1));
|
|
@@ -33191,7 +33282,7 @@ var Pager = function Pager(_ref) {
|
|
|
33191
33282
|
}
|
|
33192
33283
|
}, '>')));
|
|
33193
33284
|
};
|
|
33194
|
-
var Container$
|
|
33285
|
+
var Container$w = /*#__PURE__*/styled__default.div.withConfig({
|
|
33195
33286
|
displayName: "Pager__Container",
|
|
33196
33287
|
componentId: "sc-1ekmf50-0"
|
|
33197
33288
|
})(["display:flex;flex-direction:column;align-items:center;p{margin:0;font-size:", ";}"], uiFonts.size.xsmall);
|
|
@@ -33200,46 +33291,6 @@ var PagerContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
33200
33291
|
componentId: "sc-1ekmf50-1"
|
|
33201
33292
|
})(["display:flex;justify-content:center;align-items:center;gap:5px;p{margin:0;}div{color:white;}button{width:40px;height:40px;background-color:", ";border:none;border-radius:5px;color:white;:hover{background-color:", ";}:disabled{opacity:0.5;}&.active{background-color:", ";font-weight:bold;color:black;}}"], uiColors.darkGray, uiColors.lightGray, uiColors.orange);
|
|
33202
33293
|
|
|
33203
|
-
var ConfirmModal = function ConfirmModal(_ref) {
|
|
33204
|
-
var onConfirm = _ref.onConfirm,
|
|
33205
|
-
onClose = _ref.onClose,
|
|
33206
|
-
message = _ref.message;
|
|
33207
|
-
return React__default.createElement(ModalPortal, null, React__default.createElement(Background, null), React__default.createElement(Container$w, {
|
|
33208
|
-
onPointerDown: onClose
|
|
33209
|
-
}, React__default.createElement(DraggableContainer, {
|
|
33210
|
-
width: "auto",
|
|
33211
|
-
dragDisabled: true
|
|
33212
|
-
}, React__default.createElement(Wrapper$1, {
|
|
33213
|
-
onPointerDown: function onPointerDown(e) {
|
|
33214
|
-
return e.stopPropagation();
|
|
33215
|
-
}
|
|
33216
|
-
}, React__default.createElement("p", null, message != null ? message : 'Are you sure?'), React__default.createElement(ButtonsWrapper, null, React__default.createElement("div", {
|
|
33217
|
-
className: "cancel-button"
|
|
33218
|
-
}, React__default.createElement(Button, {
|
|
33219
|
-
buttonType: exports.ButtonTypes.RPGUIButton,
|
|
33220
|
-
onPointerDown: onClose
|
|
33221
|
-
}, "No")), React__default.createElement(Button, {
|
|
33222
|
-
buttonType: exports.ButtonTypes.RPGUIButton,
|
|
33223
|
-
onPointerDown: onConfirm
|
|
33224
|
-
}, "Yes"))))));
|
|
33225
|
-
};
|
|
33226
|
-
var Background = /*#__PURE__*/styled__default.div.withConfig({
|
|
33227
|
-
displayName: "ConfirmModal__Background",
|
|
33228
|
-
componentId: "sc-11qkyu1-0"
|
|
33229
|
-
})(["position:absolute;width:100%;height:100%;background-color:#000000;opacity:0.5;left:0;top:0;z-index:1000;"]);
|
|
33230
|
-
var Container$w = /*#__PURE__*/styled__default.div.withConfig({
|
|
33231
|
-
displayName: "ConfirmModal__Container",
|
|
33232
|
-
componentId: "sc-11qkyu1-1"
|
|
33233
|
-
})(["position:absolute;width:100%;height:100%;left:0;top:0;display:flex;justify-content:center;align-items:center;z-index:1001;"]);
|
|
33234
|
-
var Wrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
33235
|
-
displayName: "ConfirmModal__Wrapper",
|
|
33236
|
-
componentId: "sc-11qkyu1-2"
|
|
33237
|
-
})(["p{margin:0;}"]);
|
|
33238
|
-
var ButtonsWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
33239
|
-
displayName: "ConfirmModal__ButtonsWrapper",
|
|
33240
|
-
componentId: "sc-11qkyu1-3"
|
|
33241
|
-
})(["display:flex;justify-content:flex-end;gap:5px;margin-top:5px;.cancel-button{filter:grayscale(0.7);}"]);
|
|
33242
|
-
|
|
33243
33294
|
var MarketplaceRows = function MarketplaceRows(_ref) {
|
|
33244
33295
|
var atlasJSON = _ref.atlasJSON,
|
|
33245
33296
|
atlasIMG = _ref.atlasIMG,
|
|
@@ -33285,7 +33336,7 @@ var MarketplaceRows = function MarketplaceRows(_ref) {
|
|
|
33285
33336
|
maxLines: 1,
|
|
33286
33337
|
maxWidth: "200px",
|
|
33287
33338
|
fontSize: "10px"
|
|
33288
|
-
}, "$", itemPrice)))), React__default.createElement(ButtonContainer$
|
|
33339
|
+
}, "$", itemPrice)))), React__default.createElement(ButtonContainer$3, null, React__default.createElement(Button, {
|
|
33289
33340
|
buttonType: exports.ButtonTypes.RPGUIButton,
|
|
33290
33341
|
disabled: disabled,
|
|
33291
33342
|
onPointerDown: function onPointerDown() {
|
|
@@ -33327,7 +33378,7 @@ var PriceValue = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
33327
33378
|
displayName: "MarketplaceRows__PriceValue",
|
|
33328
33379
|
componentId: "sc-wmpr1o-7"
|
|
33329
33380
|
})(["margin-left:40px;"]);
|
|
33330
|
-
var ButtonContainer$
|
|
33381
|
+
var ButtonContainer$3 = /*#__PURE__*/styled__default.div.withConfig({
|
|
33331
33382
|
displayName: "MarketplaceRows__ButtonContainer",
|
|
33332
33383
|
componentId: "sc-wmpr1o-8"
|
|
33333
33384
|
})(["margin:auto;"]);
|
|
@@ -34095,7 +34146,7 @@ var PartyManagerRow = function PartyManagerRow(_ref) {
|
|
|
34095
34146
|
}, charName, " ", isCurrentUser ? '(You)' : '', " ", isLeader ? '(Leader)' : '')), React__default.createElement(TextContainer$5, null, React__default.createElement(Ellipsis, {
|
|
34096
34147
|
maxLines: 1,
|
|
34097
34148
|
maxWidth: "300px"
|
|
34098
|
-
}, charClass)), React__default.createElement(ButtonContainer$
|
|
34149
|
+
}, charClass)), React__default.createElement(ButtonContainer$4, null, canRemove && React__default.createElement(HighlightedText, {
|
|
34099
34150
|
onPointerDown: function onPointerDown() {
|
|
34100
34151
|
return onRemovePlayer(id);
|
|
34101
34152
|
}
|
|
@@ -34113,7 +34164,7 @@ var TextContainer$5 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
34113
34164
|
displayName: "PartyManagerRows__TextContainer",
|
|
34114
34165
|
componentId: "sc-uqajew-1"
|
|
34115
34166
|
})(["color:", ";overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"], uiColors.white);
|
|
34116
|
-
var ButtonContainer$
|
|
34167
|
+
var ButtonContainer$4 = /*#__PURE__*/styled__default.div.withConfig({
|
|
34117
34168
|
displayName: "PartyManagerRows__ButtonContainer",
|
|
34118
34169
|
componentId: "sc-uqajew-2"
|
|
34119
34170
|
})(["display:flex;align-items:center;gap:1rem;justify-content:flex-start;"]);
|