@rpg-engine/long-bow 0.1.76 → 0.1.79

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 (60) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +181 -181
  3. package/dist/components/ScrollList.d.ts +15 -0
  4. package/dist/components/store/UI.store.d.ts +3 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/long-bow.cjs.development.js +164 -10
  7. package/dist/long-bow.cjs.development.js.map +1 -1
  8. package/dist/long-bow.cjs.production.min.js +1 -1
  9. package/dist/long-bow.cjs.production.min.js.map +1 -1
  10. package/dist/long-bow.esm.js +164 -11
  11. package/dist/long-bow.esm.js.map +1 -1
  12. package/dist/mocks/skills.mocks.d.ts +6 -0
  13. package/package.json +96 -96
  14. package/src/components/Abstractions/SlotsContainer.tsx +42 -42
  15. package/src/components/Button.tsx +29 -29
  16. package/src/components/Chat/Chat.tsx +193 -193
  17. package/src/components/CheckButton.tsx +65 -65
  18. package/src/components/DraggableContainer.tsx +150 -150
  19. package/src/components/Dropdown.tsx +57 -57
  20. package/src/components/Equipment/EquipmentSet.tsx +179 -179
  21. package/src/components/Input.tsx +11 -11
  22. package/src/components/Item/Cards/ItemCard.tsx +36 -36
  23. package/src/components/Item/Inventory/ItemContainer.tsx +113 -113
  24. package/src/components/Item/Inventory/ItemSlot.tsx +158 -158
  25. package/src/components/Item/Inventory/itemContainerHelper.ts +81 -81
  26. package/src/components/ListMenu.tsx +65 -65
  27. package/src/components/Multitab/Tab.tsx +57 -57
  28. package/src/components/Multitab/TabBody.tsx +13 -13
  29. package/src/components/Multitab/TabsContainer.tsx +97 -99
  30. package/src/components/NPCDialog/NPCDialog.tsx +145 -145
  31. package/src/components/NPCDialog/NPCDialogText.tsx +53 -53
  32. package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +242 -242
  33. package/src/components/ProgressBar.tsx +91 -91
  34. package/src/components/RPGUIContainer.tsx +47 -47
  35. package/src/components/RPGUIRoot.tsx +14 -14
  36. package/src/components/RadioButton.tsx +53 -53
  37. package/src/components/RangeSlider.tsx +68 -68
  38. package/src/components/ScrollList.tsx +77 -0
  39. package/src/components/SimpleProgressBar.tsx +62 -62
  40. package/src/components/SkillProgressBar.tsx +124 -124
  41. package/src/components/SkillsContainer.tsx +235 -235
  42. package/src/components/TextArea.tsx +11 -11
  43. package/src/components/Truncate.tsx +25 -25
  44. package/src/components/shared/Column.tsx +16 -16
  45. package/src/components/shared/SpriteFromAtlas.tsx +99 -99
  46. package/src/components/shared/SpriteIcon.tsx +67 -67
  47. package/src/components/store/UI.store.ts +205 -192
  48. package/src/components/typography/DynamicText.tsx +49 -49
  49. package/src/constants/uiColors.ts +10 -10
  50. package/src/hooks/useEventListener.ts +21 -21
  51. package/src/hooks/useOutsideAlerter.ts +25 -25
  52. package/src/index.tsx +25 -24
  53. package/src/libs/StringHelpers.ts +3 -3
  54. package/src/mocks/atlas/icons/icons.json +303 -303
  55. package/src/mocks/atlas/items/items.json +5195 -5195
  56. package/src/mocks/equipmentSet.mocks.ts +347 -347
  57. package/src/mocks/itemContainer.mocks.ts +249 -249
  58. package/src/mocks/skills.mocks.ts +122 -116
  59. package/src/types/eventTypes.ts +4 -4
  60. package/src/types/index.d.ts +2 -2
@@ -1,47 +1,47 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
3
-
4
- export enum RPGUIContainerTypes {
5
- Framed = 'framed',
6
- FramedGold = 'framed-golden',
7
- FramedGold2 = 'framed-golden-2',
8
- FramedGrey = 'framed-grey',
9
- }
10
- export interface IRPGUIContainerProps {
11
- type: RPGUIContainerTypes;
12
- children: React.ReactNode;
13
- width?: string;
14
- height?: string;
15
- className?: string;
16
- }
17
-
18
- export const RPGUIContainer: React.FC<IRPGUIContainerProps> = ({
19
- children,
20
- type,
21
- width = '50%',
22
- height,
23
- className,
24
- }) => {
25
- return (
26
- <Container
27
- width={width}
28
- height={height || 'auto'}
29
- className={`rpgui-container ${type} ${className}`}
30
- >
31
- {children}
32
- </Container>
33
- );
34
- };
35
-
36
- interface IContainerProps {
37
- width: string;
38
- height: string;
39
- }
40
-
41
- const Container = styled.div<IContainerProps>`
42
- height: ${props => props.height};
43
- width: ${({ width }) => width};
44
- display: flex;
45
- flex-wrap: wrap;
46
- image-rendering: pixelated;
47
- `;
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ export enum RPGUIContainerTypes {
5
+ Framed = 'framed',
6
+ FramedGold = 'framed-golden',
7
+ FramedGold2 = 'framed-golden-2',
8
+ FramedGrey = 'framed-grey',
9
+ }
10
+ export interface IRPGUIContainerProps {
11
+ type: RPGUIContainerTypes;
12
+ children: React.ReactNode;
13
+ width?: string;
14
+ height?: string;
15
+ className?: string;
16
+ }
17
+
18
+ export const RPGUIContainer: React.FC<IRPGUIContainerProps> = ({
19
+ children,
20
+ type,
21
+ width = '50%',
22
+ height,
23
+ className,
24
+ }) => {
25
+ return (
26
+ <Container
27
+ width={width}
28
+ height={height || 'auto'}
29
+ className={`rpgui-container ${type} ${className}`}
30
+ >
31
+ {children}
32
+ </Container>
33
+ );
34
+ };
35
+
36
+ interface IContainerProps {
37
+ width: string;
38
+ height: string;
39
+ }
40
+
41
+ const Container = styled.div<IContainerProps>`
42
+ height: ${props => props.height};
43
+ width: ${({ width }) => width};
44
+ display: flex;
45
+ flex-wrap: wrap;
46
+ image-rendering: pixelated;
47
+ `;
@@ -1,14 +1,14 @@
1
- import React from 'react';
2
- import 'rpgui/rpgui.min.css';
3
- import 'rpgui/rpgui.min.js';
4
-
5
- interface IProps {
6
- children: React.ReactNode;
7
- }
8
-
9
- //@ts-ignore
10
- export const _RPGUI = RPGUI;
11
-
12
- export const RPGUIRoot: React.FC<IProps> = ({ children }) => {
13
- return <div className="rpgui-content">{children}</div>;
14
- };
1
+ import React from 'react';
2
+ import 'rpgui/rpgui.min.css';
3
+ import 'rpgui/rpgui.min.js';
4
+
5
+ interface IProps {
6
+ children: React.ReactNode;
7
+ }
8
+
9
+ //@ts-ignore
10
+ export const _RPGUI = RPGUI;
11
+
12
+ export const RPGUIRoot: React.FC<IProps> = ({ children }) => {
13
+ return <div className="rpgui-content">{children}</div>;
14
+ };
@@ -1,53 +1,53 @@
1
- import React, { useEffect, useState } from 'react';
2
-
3
- export interface IRadioItems {
4
- label: string;
5
- value: string;
6
- }
7
-
8
- export interface IRadioProps {
9
- name: string;
10
- items: IRadioItems[];
11
- onChange: (value: string) => void;
12
- }
13
-
14
- export const InputRadio: React.FC<IRadioProps> = ({
15
- name,
16
- items,
17
- onChange,
18
- }) => {
19
- const [selectedValue, setSelectedValue] = useState<string>();
20
- const handleClick = () => {
21
- let element = document.querySelector(
22
- `input[name=${name}]:checked`
23
- ) as HTMLInputElement;
24
- const elementValue = element.value;
25
- setSelectedValue(elementValue);
26
- };
27
-
28
- useEffect(() => {
29
- if (selectedValue) {
30
- onChange(selectedValue);
31
- }
32
- }, [selectedValue]);
33
-
34
- return (
35
- <div id="elemento-radio">
36
- {items.map(element => {
37
- return (
38
- <>
39
- <input
40
- key={element.value}
41
- className="rpgui-radio"
42
- value={element.value}
43
- name={name}
44
- type="radio"
45
- />
46
- <label onClick={handleClick}>{element.label}</label>
47
- <br />
48
- </>
49
- );
50
- })}
51
- </div>
52
- );
53
- };
1
+ import React, { useEffect, useState } from 'react';
2
+
3
+ export interface IRadioItems {
4
+ label: string;
5
+ value: string;
6
+ }
7
+
8
+ export interface IRadioProps {
9
+ name: string;
10
+ items: IRadioItems[];
11
+ onChange: (value: string) => void;
12
+ }
13
+
14
+ export const InputRadio: React.FC<IRadioProps> = ({
15
+ name,
16
+ items,
17
+ onChange,
18
+ }) => {
19
+ const [selectedValue, setSelectedValue] = useState<string>();
20
+ const handleClick = () => {
21
+ let element = document.querySelector(
22
+ `input[name=${name}]:checked`
23
+ ) as HTMLInputElement;
24
+ const elementValue = element.value;
25
+ setSelectedValue(elementValue);
26
+ };
27
+
28
+ useEffect(() => {
29
+ if (selectedValue) {
30
+ onChange(selectedValue);
31
+ }
32
+ }, [selectedValue]);
33
+
34
+ return (
35
+ <div id="elemento-radio">
36
+ {items.map(element => {
37
+ return (
38
+ <>
39
+ <input
40
+ key={element.value}
41
+ className="rpgui-radio"
42
+ value={element.value}
43
+ name={name}
44
+ type="radio"
45
+ />
46
+ <label onClick={handleClick}>{element.label}</label>
47
+ <br />
48
+ </>
49
+ );
50
+ })}
51
+ </div>
52
+ );
53
+ };
@@ -1,68 +1,68 @@
1
- import React, { useState } from 'react';
2
- import styled from 'styled-components';
3
- import { v4 as uuidv4 } from 'uuid';
4
- import { useEventListener } from '../hooks/useEventListener';
5
- import { _RPGUI } from './RPGUIRoot';
6
-
7
- export enum RangeSliderType {
8
- Slider = 'rpgui-slider',
9
- GoldSlider = 'rpgui-slider golden',
10
- }
11
-
12
- export interface IRangeSliderProps {
13
- type: RangeSliderType;
14
- valueMin: number;
15
- valueMax: number;
16
- width: string;
17
- onChange: (value: number) => void;
18
- }
19
-
20
- export const RangeSlider: React.FC<IRangeSliderProps> = ({
21
- type,
22
- valueMin,
23
- valueMax,
24
- width,
25
- onChange,
26
- }) => {
27
- const sliderId = uuidv4();
28
-
29
- const [wasMouseDownFirst, setWasMouseDownFirst] = useState<boolean>(false);
30
-
31
- useEventListener('mouseup', () => {
32
- if (wasMouseDownFirst) {
33
- onHandleMouseUp();
34
- }
35
- setWasMouseDownFirst(false);
36
- });
37
-
38
- const onHandleMouseUp = () => {
39
- const rpguiSlider = document.getElementById(`rpgui-slider-${sliderId}`);
40
- const value = _RPGUI.get_value(rpguiSlider);
41
-
42
- onChange(Number(value));
43
- };
44
-
45
- return (
46
- <div
47
- onMouseUp={onHandleMouseUp}
48
- onMouseDown={() => setWasMouseDownFirst(true)}
49
- >
50
- <Input
51
- className={
52
- type === RangeSliderType.Slider
53
- ? RangeSliderType.Slider
54
- : RangeSliderType.GoldSlider
55
- }
56
- type="range"
57
- style={{ width: width }}
58
- min={valueMin}
59
- max={valueMax}
60
- id={`rpgui-slider-${sliderId}`}
61
- />
62
- </div>
63
- );
64
- };
65
-
66
- const Input = styled.input`
67
- opacity: 0;
68
- `;
1
+ import React, { useState } from 'react';
2
+ import styled from 'styled-components';
3
+ import { v4 as uuidv4 } from 'uuid';
4
+ import { useEventListener } from '../hooks/useEventListener';
5
+ import { _RPGUI } from './RPGUIRoot';
6
+
7
+ export enum RangeSliderType {
8
+ Slider = 'rpgui-slider',
9
+ GoldSlider = 'rpgui-slider golden',
10
+ }
11
+
12
+ export interface IRangeSliderProps {
13
+ type: RangeSliderType;
14
+ valueMin: number;
15
+ valueMax: number;
16
+ width: string;
17
+ onChange: (value: number) => void;
18
+ }
19
+
20
+ export const RangeSlider: React.FC<IRangeSliderProps> = ({
21
+ type,
22
+ valueMin,
23
+ valueMax,
24
+ width,
25
+ onChange,
26
+ }) => {
27
+ const sliderId = uuidv4();
28
+
29
+ const [wasMouseDownFirst, setWasMouseDownFirst] = useState<boolean>(false);
30
+
31
+ useEventListener('mouseup', () => {
32
+ if (wasMouseDownFirst) {
33
+ onHandleMouseUp();
34
+ }
35
+ setWasMouseDownFirst(false);
36
+ });
37
+
38
+ const onHandleMouseUp = () => {
39
+ const rpguiSlider = document.getElementById(`rpgui-slider-${sliderId}`);
40
+ const value = _RPGUI.get_value(rpguiSlider);
41
+
42
+ onChange(Number(value));
43
+ };
44
+
45
+ return (
46
+ <div
47
+ onMouseUp={onHandleMouseUp}
48
+ onMouseDown={() => setWasMouseDownFirst(true)}
49
+ >
50
+ <Input
51
+ className={
52
+ type === RangeSliderType.Slider
53
+ ? RangeSliderType.Slider
54
+ : RangeSliderType.GoldSlider
55
+ }
56
+ type="range"
57
+ style={{ width: width }}
58
+ min={valueMin}
59
+ max={valueMax}
60
+ id={`rpgui-slider-${sliderId}`}
61
+ />
62
+ </div>
63
+ );
64
+ };
65
+
66
+ const Input = styled.input`
67
+ opacity: 0;
68
+ `;
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { DraggableContainer } from './DraggableContainer';
4
+
5
+ interface IListMenuOption {
6
+ id: string;
7
+ text: string;
8
+ }
9
+
10
+ export interface IListMenuProps {
11
+ x: number;
12
+ y: number;
13
+ options: IListMenuOption[];
14
+ onSelected: (selectedOptionId: string) => void;
15
+ fontSize?: number;
16
+ title: string;
17
+ }
18
+
19
+ export const ListMenu: React.FC<IListMenuProps> = ({
20
+ options,
21
+ onSelected,
22
+ title,
23
+ }) => {
24
+ return (
25
+ <ScrollListContainer title={title}>
26
+ <SkillSplitDiv>
27
+ <hr className="golden" />
28
+ </SkillSplitDiv>
29
+
30
+ <ListContainer className="rpgui-list-imp">
31
+ {options.map(params => (
32
+ <ListElement
33
+ key={params?.id}
34
+ onClick={() => {
35
+ onSelected(params?.id);
36
+ }}
37
+ >
38
+ {params?.text || 'No text'}
39
+ </ListElement>
40
+ ))}
41
+ </ListContainer>
42
+ </ScrollListContainer>
43
+ );
44
+ };
45
+
46
+ const ScrollListContainer = styled(DraggableContainer)`
47
+ border: 1px solid black;
48
+ width: 400px;
49
+ height: 400px;
50
+ .DraggableContainer__TitleContainer-sc-184mpyl-2 {
51
+ width: auto;
52
+ height: auto;
53
+ }
54
+ `;
55
+
56
+ const SkillSplitDiv = styled.div`
57
+ width: 100%;
58
+ font-size: 11px;
59
+ margin-bottom: 10px;
60
+ hr {
61
+ margin: 0px;
62
+ padding: 0px;
63
+ }
64
+ p {
65
+ margin-bottom: 0px;
66
+ }
67
+ `;
68
+
69
+ const ListContainer = styled.ul`
70
+ border: none;
71
+ width: 400px;
72
+ height: 250px;
73
+ overflow-y: scroll;
74
+ `;
75
+ const ListElement = styled.li`
76
+ margin-right: 0.5rem;
77
+ `;
@@ -1,62 +1,62 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
3
-
4
- export interface ISimpleProgressBarProps {
5
- value: number;
6
- bgColor?: string;
7
- margin?: number;
8
- }
9
-
10
- export const SimpleProgressBar: React.FC<ISimpleProgressBarProps> = ({
11
- value,
12
- bgColor = 'red',
13
- margin = 20,
14
- }) => {
15
- return (
16
- <Container className="simple-progress-bar">
17
- <ProgressBarContainer margin={margin}>
18
- <BackgroundBar>
19
- <Progress value={value} bgColor={bgColor} />
20
- </BackgroundBar>
21
- </ProgressBarContainer>
22
- </Container>
23
- );
24
- };
25
-
26
- const Container = styled.div`
27
- display: flex;
28
- justify-content: center;
29
- align-items: center;
30
- width: 100%;
31
- `;
32
-
33
- const BackgroundBar = styled.span`
34
- background-color: rgba(0, 0, 0, 0.075);
35
- `;
36
-
37
- interface ISimpleProgressBarThemeProps {
38
- value: number;
39
- bgColor: string;
40
- }
41
-
42
- const Progress = styled.span`
43
- background-color: ${(props: ISimpleProgressBarThemeProps) => props.bgColor};
44
- width: ${(props: ISimpleProgressBarThemeProps) => props.value}%;
45
- `;
46
-
47
- interface ISimpleProgressBarTheme2Props {
48
- margin: number;
49
- }
50
-
51
- const ProgressBarContainer = styled.div`
52
- border-radius: 60px;
53
- border: 1px solid #282424;
54
- overflow: hidden;
55
- width: 100%;
56
- span {
57
- display: block;
58
- height: 100%;
59
- }
60
- height: 8px;
61
- margin-left: ${(props: ISimpleProgressBarTheme2Props) => props.margin}px;
62
- `;
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ export interface ISimpleProgressBarProps {
5
+ value: number;
6
+ bgColor?: string;
7
+ margin?: number;
8
+ }
9
+
10
+ export const SimpleProgressBar: React.FC<ISimpleProgressBarProps> = ({
11
+ value,
12
+ bgColor = 'red',
13
+ margin = 20,
14
+ }) => {
15
+ return (
16
+ <Container className="simple-progress-bar">
17
+ <ProgressBarContainer margin={margin}>
18
+ <BackgroundBar>
19
+ <Progress value={value} bgColor={bgColor} />
20
+ </BackgroundBar>
21
+ </ProgressBarContainer>
22
+ </Container>
23
+ );
24
+ };
25
+
26
+ const Container = styled.div`
27
+ display: flex;
28
+ justify-content: center;
29
+ align-items: center;
30
+ width: 100%;
31
+ `;
32
+
33
+ const BackgroundBar = styled.span`
34
+ background-color: rgba(0, 0, 0, 0.075);
35
+ `;
36
+
37
+ interface ISimpleProgressBarThemeProps {
38
+ value: number;
39
+ bgColor: string;
40
+ }
41
+
42
+ const Progress = styled.span`
43
+ background-color: ${(props: ISimpleProgressBarThemeProps) => props.bgColor};
44
+ width: ${(props: ISimpleProgressBarThemeProps) => props.value}%;
45
+ `;
46
+
47
+ interface ISimpleProgressBarTheme2Props {
48
+ margin: number;
49
+ }
50
+
51
+ const ProgressBarContainer = styled.div`
52
+ border-radius: 60px;
53
+ border: 1px solid #282424;
54
+ overflow: hidden;
55
+ width: 100%;
56
+ span {
57
+ display: block;
58
+ height: 100%;
59
+ }
60
+ height: 8px;
61
+ margin-left: ${(props: ISimpleProgressBarTheme2Props) => props.margin}px;
62
+ `;