@rpg-engine/long-bow 0.6.59 → 0.6.62
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/TableTab/TableTab.d.ts +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +70 -8
- 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 +70 -9
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/TableTab.stories.d.ts +7 -0
- package/package.json +1 -1
- package/src/components/SkillProgressBar.tsx +15 -15
- package/src/components/TableTab/TableTab.tsx +93 -0
- package/src/index.tsx +1 -0
- package/src/mocks/skills.mocks.ts +9 -9
- package/src/stories/TableTab.stories.tsx +64 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TabItem {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
content: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface TableTabProps {
|
|
8
|
+
tabs: TabItem[];
|
|
9
|
+
activeColor?: string;
|
|
10
|
+
activeTextColor: string;
|
|
11
|
+
inactiveColor?: string;
|
|
12
|
+
borderColor?: string;
|
|
13
|
+
hoverColor?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const TableTab: React.FC<TableTabProps>;
|
|
16
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from './components/SkillProgressBar';
|
|
|
45
45
|
export * from './components/SkillsContainer';
|
|
46
46
|
export * from './components/Spellbook/Spellbook';
|
|
47
47
|
export * from './components/Stepper';
|
|
48
|
+
export * from './components/TableTab/TableTab';
|
|
48
49
|
export * from './components/TextArea';
|
|
49
50
|
export * from './components/TimeWidget/TimeWidget';
|
|
50
51
|
export * from './components/TradingMenu/TradingMenu';
|
|
@@ -32147,15 +32147,14 @@ var SkillProgressBar = function SkillProgressBar(_ref) {
|
|
|
32147
32147
|
buffAndDebuff = _ref.buffAndDebuff;
|
|
32148
32148
|
// Skill points needed to start the current level
|
|
32149
32149
|
var baseSkillPoints = shared.getSPForLevel(level);
|
|
32150
|
-
|
|
32151
|
-
|
|
32152
|
-
|
|
32153
|
-
|
|
32154
|
-
|
|
32155
|
-
var
|
|
32156
|
-
// Calculate progress percentage towards the next level
|
|
32157
|
-
var progress = Math.min(100, Math.max(0, excessSkillPoints / totalPointsForLevelUp * 100));
|
|
32150
|
+
var calculateProgress = function calculateProgress() {
|
|
32151
|
+
var totalPointsForLevelUp = Math.max(1, skillPointsToNextLevel - baseSkillPoints);
|
|
32152
|
+
var excessSkillPoints = Math.max(0, currentSkillPoints - baseSkillPoints);
|
|
32153
|
+
return Math.min(100, Math.max(0, excessSkillPoints / totalPointsForLevelUp * 100));
|
|
32154
|
+
};
|
|
32155
|
+
var progress = calculateProgress();
|
|
32158
32156
|
var skillsBuffsCalc = function skillsBuffsCalc(level, buffAndDebuff) {
|
|
32157
|
+
if (buffAndDebuff === 0) return '0';
|
|
32159
32158
|
var result = level * (buffAndDebuff / 100);
|
|
32160
32159
|
return result > 0 ? "+" + result.toFixed(2) : "" + result.toFixed(2);
|
|
32161
32160
|
};
|
|
@@ -32884,6 +32883,68 @@ var ProgressIndicator = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
32884
32883
|
return isActive ? '0 0 0 1px black, 1px 1px 0 1px black, 2px 2px 0 1px black, -1px -1px 0 1px black' : '0 0 0 1px black, 1px 1px 0 1px gray, 2px 2px 0 1px gray, -1px -1px 0 1px gray';
|
|
32885
32884
|
});
|
|
32886
32885
|
|
|
32886
|
+
var TableTab = function TableTab(_ref) {
|
|
32887
|
+
var _tabs$find;
|
|
32888
|
+
var tabs = _ref.tabs,
|
|
32889
|
+
_ref$activeColor = _ref.activeColor,
|
|
32890
|
+
activeColor = _ref$activeColor === void 0 ? '#fef08a' : _ref$activeColor,
|
|
32891
|
+
_ref$activeTextColor = _ref.activeTextColor,
|
|
32892
|
+
activeTextColor = _ref$activeTextColor === void 0 ? '#000000' : _ref$activeTextColor,
|
|
32893
|
+
_ref$inactiveColor = _ref.inactiveColor,
|
|
32894
|
+
inactiveColor = _ref$inactiveColor === void 0 ? '#6b7280' : _ref$inactiveColor,
|
|
32895
|
+
_ref$borderColor = _ref.borderColor,
|
|
32896
|
+
borderColor = _ref$borderColor === void 0 ? '#f59e0b' : _ref$borderColor,
|
|
32897
|
+
_ref$hoverColor = _ref.hoverColor,
|
|
32898
|
+
hoverColor = _ref$hoverColor === void 0 ? '#fef3c7' : _ref$hoverColor;
|
|
32899
|
+
var _useState = React.useState(tabs[0].id),
|
|
32900
|
+
activeTab = _useState[0],
|
|
32901
|
+
setActiveTab = _useState[1];
|
|
32902
|
+
return React__default.createElement(TableWrapper$1, null, React__default.createElement(TabHeader, {
|
|
32903
|
+
borderColor: borderColor
|
|
32904
|
+
}, tabs.map(function (tab) {
|
|
32905
|
+
return React__default.createElement(TabButton, {
|
|
32906
|
+
key: tab.id,
|
|
32907
|
+
active: activeTab === tab.id,
|
|
32908
|
+
activeColor: activeColor,
|
|
32909
|
+
activeTextColor: activeTextColor,
|
|
32910
|
+
inactiveColor: inactiveColor,
|
|
32911
|
+
borderColor: borderColor,
|
|
32912
|
+
hoverColor: hoverColor,
|
|
32913
|
+
onClick: function onClick() {
|
|
32914
|
+
return setActiveTab(tab.id);
|
|
32915
|
+
}
|
|
32916
|
+
}, tab.title);
|
|
32917
|
+
})), React__default.createElement(ContentWrapper, null, (_tabs$find = tabs.find(function (tab) {
|
|
32918
|
+
return tab.id === activeTab;
|
|
32919
|
+
})) == null ? void 0 : _tabs$find.content));
|
|
32920
|
+
};
|
|
32921
|
+
var TableWrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
32922
|
+
displayName: "TableTab__TableWrapper",
|
|
32923
|
+
componentId: "sc-m1diiu-0"
|
|
32924
|
+
})(["width:100%;"]);
|
|
32925
|
+
var TabHeader = /*#__PURE__*/styled__default.div.withConfig({
|
|
32926
|
+
displayName: "TableTab__TabHeader",
|
|
32927
|
+
componentId: "sc-m1diiu-1"
|
|
32928
|
+
})(["display:flex;border-bottom:1px solid ", ";"], function (props) {
|
|
32929
|
+
return props.borderColor;
|
|
32930
|
+
});
|
|
32931
|
+
var TabButton = /*#__PURE__*/styled__default.button.withConfig({
|
|
32932
|
+
displayName: "TableTab__TabButton",
|
|
32933
|
+
componentId: "sc-m1diiu-2"
|
|
32934
|
+
})(["flex:1;padding:0.5rem 1rem;font-size:0.875rem;font-weight:500;border-right:1px solid ", ";background-color:", ";color:", ";&:last-child{border-right:none;}&:hover{background-color:", ";}"], function (props) {
|
|
32935
|
+
return props.borderColor;
|
|
32936
|
+
}, function (props) {
|
|
32937
|
+
return props.active ? props.activeColor : 'transparent';
|
|
32938
|
+
}, function (props) {
|
|
32939
|
+
return props.active ? props.activeTextColor : props.inactiveColor;
|
|
32940
|
+
}, function (props) {
|
|
32941
|
+
return props.active ? props.activeColor : props.hoverColor;
|
|
32942
|
+
});
|
|
32943
|
+
var ContentWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
32944
|
+
displayName: "TableTab__ContentWrapper",
|
|
32945
|
+
componentId: "sc-m1diiu-3"
|
|
32946
|
+
})(["padding:1rem;"]);
|
|
32947
|
+
|
|
32887
32948
|
var TextArea = function TextArea(_ref) {
|
|
32888
32949
|
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
32889
32950
|
return React__default.createElement("textarea", Object.assign({}, props));
|
|
@@ -33425,6 +33486,7 @@ exports.Spellbook = Spellbook;
|
|
|
33425
33486
|
exports.SpriteFromAtlas = SpriteFromAtlas;
|
|
33426
33487
|
exports.Stepper = Stepper;
|
|
33427
33488
|
exports.TabBody = TabBody;
|
|
33489
|
+
exports.TableTab = TableTab;
|
|
33428
33490
|
exports.TabsContainer = TabsContainer;
|
|
33429
33491
|
exports.TextArea = TextArea;
|
|
33430
33492
|
exports.TimeWidget = TimeWidget;
|