@rpg-engine/long-bow 0.2.29 → 0.2.34

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 (40) hide show
  1. package/dist/components/Arrow/SelectArrow.d.ts +8 -0
  2. package/dist/components/TradingMenu/TradingItemRow.d.ts +9 -0
  3. package/dist/components/TradingMenu/TradingMenu.d.ts +12 -0
  4. package/dist/components/TradingMenu/items.mock.d.ts +2 -2
  5. package/dist/components/shared/Ellipsis.d.ts +3 -1
  6. package/dist/index.d.ts +3 -3
  7. package/dist/long-bow.cjs.development.js +543 -502
  8. package/dist/long-bow.cjs.development.js.map +1 -1
  9. package/dist/long-bow.cjs.production.min.js +1 -1
  10. package/dist/long-bow.cjs.production.min.js.map +1 -1
  11. package/dist/long-bow.esm.js +543 -502
  12. package/dist/long-bow.esm.js.map +1 -1
  13. package/dist/stories/Arrow.stories.d.ts +5 -0
  14. package/dist/stories/ItemTradingComponent.stories.d.ts +1 -1
  15. package/dist/stories/{TrandingMenu.stories.d.ts → TradingMenu.stories.d.ts} +1 -1
  16. package/package.json +2 -2
  17. package/src/components/Arrow/SelectArrow.tsx +65 -0
  18. package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-left-clicked.png +0 -0
  19. package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-left.png +0 -0
  20. package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-right-clicked.png +0 -0
  21. package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-right.png +0 -0
  22. package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-left-clicked.png +0 -0
  23. package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-left.png +0 -0
  24. package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-right-clicked.png +0 -0
  25. package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-right.png +0 -0
  26. package/src/components/NPCDialog/.DS_Store +0 -0
  27. package/src/components/NPCDialog/img/.DS_Store +0 -0
  28. package/src/components/PropertySelect/PropertySelect.tsx +12 -34
  29. package/src/components/QuestInfo/QuestInfo.tsx +8 -34
  30. package/src/components/TradingMenu/TradingItemRow.tsx +172 -0
  31. package/src/components/TradingMenu/{TrandingMenu.tsx → TradingMenu.tsx} +30 -52
  32. package/src/components/TradingMenu/items.mock.ts +21 -20
  33. package/src/components/shared/Ellipsis.tsx +25 -6
  34. package/src/index.tsx +3 -3
  35. package/src/stories/Arrow.stories.tsx +26 -0
  36. package/src/stories/ItemTradingComponent.stories.tsx +6 -6
  37. package/src/stories/{TrandingMenu.stories.tsx → TradingMenu.stories.tsx} +5 -5
  38. package/dist/components/TradingMenu/TrandingMenu.d.ts +0 -12
  39. package/dist/components/TradingMenu/itemComponent.d.ts +0 -9
  40. package/src/components/TradingMenu/itemComponent.tsx +0 -158
@@ -1,87 +1,88 @@
1
- import { ITransactionItem } from '@rpg-engine/shared';
2
- export const itemMock: ITransactionItem[] = [
1
+ import { ITradeResponseItem } from '@rpg-engine/shared';
2
+ export const itemMock: ITradeResponseItem[] = [
3
3
  {
4
4
  texturePath: 'swords/broad-sword.png',
5
+ itemId: 'itemId03',
6
+ name: 'Silver Short Sword Premium',
7
+ price: 100,
8
+ key: 'Short sword',
9
+ },
10
+ {
11
+ texturePath: "swords/corruption-sword.png",
5
12
  itemId: 'itemId01',
6
- name: 'sword',
13
+ name: 'Short sword Best',
7
14
  price: 100,
8
15
  key: 'Short sword',
9
16
  },
10
17
  {
11
18
  texturePath: 'swords/broad-sword.png',
12
19
  itemId: 'itemId02',
13
- name: 'sword',
20
+ name: 'Short sword Trade',
14
21
  price: 100,
15
22
  key: 'Short sword',
16
23
  },
17
24
  {
18
25
  texturePath: 'swords/broad-sword.png',
19
26
  itemId: 'itemId03',
20
- name: 'sword',
27
+ name: 'Short sword',
21
28
  price: 100,
22
29
  key: 'Short sword',
23
30
  },
24
31
  {
25
32
  texturePath: 'swords/broad-sword.png',
26
33
  itemId: 'itemId01',
27
- name: 'sword',
34
+ name: 'Short sword',
28
35
  price: 100,
29
36
  key: 'Short sword',
30
37
  },
31
38
  {
32
39
  texturePath: 'swords/broad-sword.png',
33
40
  itemId: 'itemId02',
34
- name: 'sword',
41
+ name: 'Short sword',
35
42
  price: 100,
36
43
  key: 'Short sword',
37
44
  },
38
45
  {
39
46
  texturePath: 'swords/broad-sword.png',
40
47
  itemId: 'itemId03',
41
- name: 'sword',
48
+ name: 'Short sword',
42
49
  price: 100,
43
50
  key: 'Short sword',
44
51
  },
45
52
  {
46
53
  texturePath: 'swords/broad-sword.png',
47
54
  itemId: 'itemId01',
48
- name: 'sword',
55
+ name: 'Short sword',
49
56
  price: 100,
50
57
  key: 'Short sword',
51
58
  },
52
59
  {
53
60
  texturePath: 'swords/broad-sword.png',
54
61
  itemId: 'itemId02',
55
- name: 'sword',
62
+ name: 'Short sword',
56
63
  price: 100,
57
64
  key: 'Short sword',
58
65
  },
59
66
  {
60
67
  texturePath: 'swords/broad-sword.png',
61
68
  itemId: 'itemId03',
62
- name: 'sword',
69
+ name: 'Short sword',
63
70
  price: 100,
64
71
  key: 'Short sword',
65
72
  },
66
73
  {
67
74
  texturePath: 'swords/broad-sword.png',
68
75
  itemId: 'itemId01',
69
- name: 'sword',
76
+ name: 'Short sword',
70
77
  price: 100,
71
78
  key: 'Short sword',
72
79
  },
73
80
  {
74
81
  texturePath: 'swords/broad-sword.png',
75
82
  itemId: 'itemId02',
76
- name: 'sword',
77
- price: 100,
78
- key: 'Short sword',
79
- },
80
- {
81
- texturePath: 'swords/broad-sword.png',
82
- itemId: 'itemId03',
83
- name: 'sword',
83
+ name: 'Short sword',
84
84
  price: 100,
85
85
  key: 'Short sword',
86
86
  },
87
+
87
88
  ];
@@ -4,25 +4,43 @@ import styled from 'styled-components';
4
4
  interface IProps {
5
5
  children: React.ReactNode;
6
6
  maxLines: 1 | 2 | 3;
7
+ maxWidth: number;
8
+ fontSize?: string;
7
9
  }
8
10
 
9
- export const Ellipsis = ({ children, maxLines }: IProps) => {
11
+ export const Ellipsis = ({
12
+ children,
13
+ maxLines,
14
+ maxWidth,
15
+ fontSize,
16
+ }: IProps) => {
10
17
  return (
11
- <Container>
12
- <div className={`ellipsis-${maxLines}-lines`}>{children}</div>
18
+ <Container maxWidth={maxWidth} fontSize={fontSize}>
19
+ <p className={`ellipsis-${maxLines}-lines`}>{children}</p>
13
20
  </Container>
14
21
  );
15
22
  };
16
23
 
17
- const Container = styled.div`
24
+ interface IContainerProps {
25
+ maxWidth: number;
26
+ fontSize?: string;
27
+ }
28
+
29
+ const Container = styled.div<IContainerProps>`
30
+ p {
31
+ font-size: ${props => props.fontSize || '1rem'};
32
+ }
33
+
18
34
  .ellipsis-1-lines {
19
35
  white-space: nowrap;
20
36
  text-overflow: ellipsis;
21
37
  overflow: hidden;
38
+ max-width: ${props => props.maxWidth}px;
22
39
  }
23
40
  .ellipsis-2-lines {
24
41
  display: -webkit-box;
25
- max-width: 100%;
42
+ max-width: ${props => props.maxWidth}px;
43
+
26
44
  height: 25px;
27
45
  margin: 0 auto;
28
46
  line-height: 1;
@@ -33,7 +51,8 @@ const Container = styled.div`
33
51
  }
34
52
  .ellipsis-3-lines {
35
53
  display: -webkit-box;
36
- max-width: 100%;
54
+ max-width: ${props => props.maxWidth}px;
55
+
37
56
  height: 43px;
38
57
  margin: 0 auto;
39
58
  line-height: 1;
package/src/index.tsx CHANGED
@@ -5,11 +5,13 @@ export * from './components/CheckButton';
5
5
  export * from './components/DraggableContainer';
6
6
  export * from './components/Dropdown';
7
7
  export * from './components/Equipment/EquipmentSet';
8
+ export * from './components/HistoryDialog';
8
9
  export * from './components/Input';
9
10
  export * from './components/Item/Inventory/ItemContainer';
10
11
  export * from './components/Item/Inventory/ItemSlot';
11
12
  export * from './components/ListMenu';
12
13
  export * from './components/NPCDialog/NPCDialog';
14
+ export * from './components/NPCDialog/NPCMultiDialog';
13
15
  export * from './components/NPCDialog/QuestionDialog/QuestionDialog';
14
16
  export * from './components/ProgressBar';
15
17
  export * from './components/PropertySelect/PropertySelect';
@@ -23,9 +25,7 @@ export * from './components/shared/SpriteFromAtlas';
23
25
  export * from './components/SkillProgressBar';
24
26
  export * from './components/SkillsContainer';
25
27
  export * from './components/TextArea';
28
+ export * from './components/TradingMenu/TradingMenu';
26
29
  export * from './components/Truncate';
27
30
  export * from './components/typography/DynamicText';
28
- export * from './components/NPCDialog/NPCMultiDialog';
29
- export * from './components/HistoryDialog';
30
- export * from './components/TradingMenu/TrandingMenu';
31
31
  export { useEventListener } from './hooks/useEventListener';
@@ -0,0 +1,26 @@
1
+ import { Meta, Story } from '@storybook/react';
2
+ import React from 'react';
3
+ import { RPGUIRoot } from '..';
4
+ import SelectArrow, { ArrowBarProps } from '../components/Arrow/SelectArrow';
5
+
6
+ const meta: Meta = {
7
+ title: 'Arrow',
8
+ component: SelectArrow,
9
+ };
10
+
11
+ export default meta;
12
+
13
+ const Template: Story<ArrowBarProps> = args => (
14
+ <RPGUIRoot>
15
+ <SelectArrow {...args} />
16
+ </RPGUIRoot>
17
+ );
18
+
19
+ export const Default = Template.bind({});
20
+
21
+ Default.args = {
22
+ direction: 'left',
23
+ onClick: () => {
24
+ console.log('clicked');
25
+ },
26
+ };
@@ -1,14 +1,14 @@
1
+ import { ITransactionItem } from '@rpg-engine/shared';
1
2
  import { Meta, Story } from '@storybook/react';
2
3
  import React from 'react';
3
4
  import { RPGUIRoot } from '../components/RPGUIRoot';
5
+ import { itemMock } from '../components/TradingMenu/items.mock';
4
6
  import {
5
- ItemTradingComponent,
6
7
  ITradeComponentProps,
7
- } from '../components/TradingMenu/itemComponent';
8
+ TradingItemRow,
9
+ } from '../components/TradingMenu/TradingItemRow';
8
10
  import atlasJSON from '../mocks/atlas/items/items.json';
9
11
  import atlasIMG from '../mocks/atlas/items/items.png';
10
- import { itemMock } from '../components/TradingMenu/items.mock';
11
- import { ITransactionItem } from '@rpg-engine/shared';
12
12
 
13
13
  const updateChartTotals = (itemInfo: ITransactionItem) => {
14
14
  console.log(itemInfo);
@@ -20,13 +20,13 @@ const updateChartTotals = (itemInfo: ITransactionItem) => {
20
20
 
21
21
  const meta: Meta = {
22
22
  title: 'Trading Item',
23
- component: ItemTradingComponent,
23
+ component: TradingItemRow,
24
24
  };
25
25
  export default meta;
26
26
 
27
27
  const Template: Story<ITradeComponentProps> = args => (
28
28
  <RPGUIRoot>
29
- <ItemTradingComponent {...args} traderItem={itemMock[0]} />
29
+ <TradingItemRow {...args} traderItem={itemMock[0]} />
30
30
  </RPGUIRoot>
31
31
  );
32
32
 
@@ -1,24 +1,24 @@
1
1
  import { Meta, Story } from '@storybook/react';
2
2
  import React from 'react';
3
3
  import { RPGUIRoot } from '../components/RPGUIRoot';
4
+ import { itemMock } from '../components/TradingMenu/items.mock';
4
5
  import {
5
- TrandingMenu,
6
6
  ITrandingMenu,
7
- } from '../components/TradingMenu/TrandingMenu';
7
+ TradingMenu,
8
+ } from '../components/TradingMenu/TradingMenu';
8
9
  import atlasJSON from '../mocks/atlas/items/items.json';
9
10
  import atlasIMG from '../mocks/atlas/items/items.png';
10
- import { itemMock } from '../components/TradingMenu/items.mock';
11
11
 
12
12
  const meta: Meta = {
13
13
  title: 'Trading Menu',
14
- component: TrandingMenu,
14
+ component: TradingMenu,
15
15
  };
16
16
 
17
17
  export default meta;
18
18
 
19
19
  const Template: Story<ITrandingMenu> = args => (
20
20
  <RPGUIRoot>
21
- <TrandingMenu {...args} />
21
+ <TradingMenu {...args} />
22
22
  </RPGUIRoot>
23
23
  );
24
24
 
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { ITransactionItem, TradeTransactionType } from '@rpg-engine/shared';
3
- export interface ITrandingMenu {
4
- traderItems: ITransactionItem[];
5
- onClose: () => void;
6
- type: TradeTransactionType;
7
- atlasJSON: any;
8
- atlasIMG: any;
9
- characterAvailableGold: number;
10
- onChangeTraderItems: (traderItems: ITransactionItem[]) => void;
11
- }
12
- export declare const TrandingMenu: React.FC<ITrandingMenu>;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { ITransactionItem } from '@rpg-engine/shared';
3
- export interface ITradeComponentProps {
4
- traderItem: ITransactionItem;
5
- updateChartTotals: (traderItem: ITransactionItem) => void;
6
- atlasJSON: any;
7
- atlasIMG: any;
8
- }
9
- export declare const ItemTradingComponent: React.FC<ITradeComponentProps>;
@@ -1,158 +0,0 @@
1
- import React, { useState } from 'react';
2
- import styled from 'styled-components';
3
- import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
4
- import LeftArrowClickIcon from '../PropertySelect/img/ui-arrows/arrow01-left-clicked.png';
5
- import LeftArrowIcon from '../PropertySelect/img/ui-arrows/arrow01-left.png';
6
- import RightArrowClickIcon from '../PropertySelect/img/ui-arrows/arrow01-right-clicked.png';
7
- import RightArrowIcon from '../PropertySelect/img/ui-arrows/arrow01-right.png';
8
- import { ITransactionItem } from '@rpg-engine/shared';
9
-
10
- export interface ITradeComponentProps {
11
- traderItem: ITransactionItem;
12
- updateChartTotals: (traderItem: ITransactionItem) => void;
13
- atlasJSON: any;
14
- atlasIMG: any;
15
- }
16
-
17
- export const ItemTradingComponent: React.FC<ITradeComponentProps> = ({
18
- atlasIMG,
19
- atlasJSON,
20
- updateChartTotals,
21
- traderItem,
22
- }) => {
23
- const [itemQuantity, setItemQuantity] = useState(0);
24
-
25
- const onLeftClick = () => {
26
- if (itemQuantity > 0) {
27
- const newQuantity = itemQuantity - 1;
28
- setItemQuantity(newQuantity);
29
- updateChartTotals({
30
- key: traderItem.key,
31
- itemId: traderItem.itemId,
32
- qty: newQuantity,
33
- price: traderItem.price,
34
- texturePath: traderItem.texturePath,
35
- name: traderItem.name,
36
- });
37
- }
38
- };
39
- const onRightClick = () => {
40
- const newQuantity = itemQuantity + 1;
41
- setItemQuantity(newQuantity);
42
- updateChartTotals({
43
- key: traderItem.key,
44
- itemId: traderItem.itemId,
45
- qty: newQuantity,
46
- price: traderItem.price,
47
- texturePath: traderItem.texturePath,
48
- name: traderItem.name,
49
- });
50
- };
51
-
52
- return (
53
- <ItemWrapper>
54
- <IconContainer>
55
- <SpriteContainer>
56
- <SpriteFromAtlas
57
- atlasIMG={atlasIMG}
58
- atlasJSON={atlasJSON}
59
- spriteKey={traderItem.texturePath}
60
- imgScale={2.5}
61
- />
62
- </SpriteContainer>
63
- </IconContainer>
64
- <NameValue>
65
- <p>{traderItem.name}</p>
66
- <p>${traderItem.price}</p>
67
- </NameValue>
68
- <Container>
69
- <TextOverlay>
70
- <Item>{itemQuantity}</Item>
71
- </TextOverlay>
72
- <LeftArrow onClick={onLeftClick} onTouchStart={onLeftClick}></LeftArrow>
73
- <RightArrow
74
- onClick={onRightClick}
75
- onTouchStart={onRightClick}
76
- ></RightArrow>
77
- </Container>
78
- </ItemWrapper>
79
- );
80
- };
81
-
82
- const ItemWrapper = styled.div`
83
- width: 80%;
84
- margin: auto;
85
- display: flex;
86
- justify-content: space-between;
87
- `;
88
-
89
- const IconContainer = styled.div`
90
- display: flex;
91
- justify-content: center;
92
- align-items: center;
93
- `;
94
-
95
- const SpriteContainer = styled.div`
96
- position: relative;
97
- top: -3px;
98
- left: 0;
99
- `;
100
-
101
- const NameValue = styled.div``;
102
-
103
- const Item = styled.span`
104
- font-size: 1rem;
105
- color: white;
106
- text-align: center;
107
- z-index: 1;
108
- position: absolute;
109
- top: -12px;
110
- width: 100%;
111
- `;
112
-
113
- const TextOverlay = styled.div`
114
- width: 100%;
115
- position: relative;
116
- `;
117
-
118
- interface IContainerProps {
119
- percentageWidth?: number;
120
- minWidth?: number;
121
- style?: Record<string, any>;
122
- }
123
-
124
- const Container = styled.div<IContainerProps>`
125
- position: relative;
126
- display: flex;
127
- flex-direction: column;
128
- justify-content: space-around;
129
- align-items: flex-start;
130
- min-width: 100px;
131
- width: 40%;
132
- `;
133
-
134
- const LeftArrow = styled.div`
135
- background-image: url(${LeftArrowIcon});
136
- background-size: 100% 100%;
137
- left: 0;
138
- position: absolute;
139
- width: 40px;
140
- height: 42px;
141
- :active {
142
- background-image: url(${LeftArrowClickIcon});
143
- }
144
- z-index: 2;
145
- `;
146
-
147
- const RightArrow = styled.div`
148
- background-image: url(${RightArrowIcon});
149
- right: 0;
150
- position: absolute;
151
- width: 40px;
152
- background-size: 100% 100%;
153
- height: 42px;
154
- :active {
155
- background-image: url(${RightArrowClickIcon});
156
- }
157
- z-index: 2;
158
- `;