@rpg-engine/long-bow 0.2.63 → 0.2.65

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.
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { IDropdownSelectorContainer } from '../components/DropdownSelectorContainer';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IDropdownSelectorContainer>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.2.63",
3
+ "version": "0.2.65",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -18,6 +18,8 @@ export interface IChatProps {
18
18
  chatMessages: IChatMessage[];
19
19
  onSendChatMessage: (message: string) => void;
20
20
  onCloseButton: () => void;
21
+ onFocus?: () => void;
22
+ onBlur?: () => void;
21
23
  opacity?: number;
22
24
  width?: string;
23
25
  height?: string;
@@ -30,6 +32,8 @@ export const Chat: React.FC<IChatProps> = ({
30
32
  width = '100%',
31
33
  height = '250px',
32
34
  onCloseButton,
35
+ onFocus,
36
+ onBlur,
33
37
  }) => {
34
38
  const [message, setMessage] = useState('');
35
39
 
@@ -113,6 +117,8 @@ export const Chat: React.FC<IChatProps> = ({
113
117
  className="chat-input dark-background"
114
118
  type="text"
115
119
  autoComplete="off"
120
+ onFocus={onFocus}
121
+ onBlur={onBlur}
116
122
  />
117
123
  </Column>
118
124
  <Column justifyContent="flex-end">
@@ -3,29 +3,31 @@ import styled from 'styled-components';
3
3
  import { uiFonts } from '../constants/uiFonts';
4
4
  import { Dropdown } from './Dropdown';
5
5
 
6
- interface IServer {
6
+ interface IDropdownSelectorOption {
7
7
  id: string;
8
8
  name: string;
9
9
  }
10
10
 
11
- export interface IServerSelectionProps {
12
- onChange: (serverId: string) => void;
13
- servers: IServer[];
11
+ export interface IDropdownSelectorContainer {
12
+ onChange: (id: string) => void;
13
+ options: IDropdownSelectorOption[];
14
14
  details?: string;
15
+ title: string;
15
16
  }
16
17
 
17
- export const ServerSelection: React.FC<IServerSelectionProps> = ({
18
+ export const DropdownSelectorContainer: React.FC<IDropdownSelectorContainer> = ({
19
+ title,
18
20
  onChange,
19
- servers,
21
+ options,
20
22
  details,
21
23
  }) => {
22
24
  return (
23
25
  <div>
24
- <p>Select server</p>
26
+ <p>{title}</p>
25
27
  <Dropdown
26
- options={servers.map((server, index) => ({
27
- option: server.name,
28
- value: server.id,
28
+ options={options.map((option, index) => ({
29
+ option: option.name,
30
+ value: option.id,
29
31
  id: index,
30
32
  }))}
31
33
  onChange={onChange}
package/src/index.tsx CHANGED
@@ -4,12 +4,12 @@ export * from './components/Chat/Chat';
4
4
  export * from './components/CheckButton';
5
5
  export * from './components/DraggableContainer';
6
6
  export * from './components/Dropdown';
7
+ export * from './components/DropdownSelectorContainer';
7
8
  export * from './components/Equipment/EquipmentSet';
8
9
  export * from './components/HistoryDialog';
9
10
  export * from './components/Input';
10
11
  export * from './components/Item/Inventory/ItemContainer';
11
12
  export * from './components/Item/Inventory/ItemSlot';
12
- export * from './components/itemSelector/ItemSelector';
13
13
  export * from './components/ListMenu';
14
14
  export * from './components/NPCDialog/NPCDialog';
15
15
  export * from './components/NPCDialog/NPCMultiDialog';
@@ -18,17 +18,17 @@ export * from './components/ProgressBar';
18
18
  export * from './components/PropertySelect/PropertySelect';
19
19
  export * from './components/QuestInfo/QuestInfo';
20
20
  export * from './components/QuestList';
21
- export * from './components/RadioButton';
22
- export * from './components/RangeSlider';
23
21
  export * from './components/RPGUIContainer';
24
22
  export * from './components/RPGUIRoot';
25
- export * from './components/ServerSelection';
26
- export * from './components/shared/SpriteFromAtlas';
23
+ export * from './components/RadioButton';
24
+ export * from './components/RangeSlider';
27
25
  export * from './components/SkillProgressBar';
28
26
  export * from './components/SkillsContainer';
29
27
  export * from './components/TextArea';
30
28
  export * from './components/TimeWidget/TimeWidget';
31
29
  export * from './components/TradingMenu/TradingMenu';
32
30
  export * from './components/Truncate';
31
+ export * from './components/itemSelector/ItemSelector';
32
+ export * from './components/shared/SpriteFromAtlas';
33
33
  export * from './components/typography/DynamicText';
34
34
  export { useEventListener } from './hooks/useEventListener';
@@ -0,0 +1,41 @@
1
+ import { Meta, Story } from '@storybook/react';
2
+ import React from 'react';
3
+ import { RPGUIRoot } from '..';
4
+ import {
5
+ DropdownSelectorContainer,
6
+ IDropdownSelectorContainer,
7
+ } from '../components/DropdownSelectorContainer';
8
+
9
+ const meta: Meta = {
10
+ title: 'DropdownSelectorContainer',
11
+ component: DropdownSelectorContainer,
12
+ };
13
+
14
+ export default meta;
15
+
16
+ const Template: Story<IDropdownSelectorContainer> = args => (
17
+ <RPGUIRoot>
18
+ <DropdownSelectorContainer {...args} details="There are server details" />
19
+ </RPGUIRoot>
20
+ );
21
+
22
+ export const Default = Template.bind({});
23
+
24
+ Default.args = {
25
+ title: 'Choose a server',
26
+ onChange: () => {},
27
+ options: [
28
+ {
29
+ id: 'europe-germany',
30
+ name: 'Europe (Germany)',
31
+ },
32
+ {
33
+ id: 'europe-uk',
34
+ name: 'Europe (UK)',
35
+ },
36
+ {
37
+ id: 'america-us',
38
+ name: 'America',
39
+ },
40
+ ],
41
+ };
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- interface IServer {
3
- id: string;
4
- name: string;
5
- }
6
- export interface IServerSelectionProps {
7
- onChange: (serverId: string) => void;
8
- servers: IServer[];
9
- details?: string;
10
- }
11
- export declare const ServerSelection: React.FC<IServerSelectionProps>;
12
- export {};
@@ -1,5 +0,0 @@
1
- import { Meta } from '@storybook/react';
2
- import { IServerSelectionProps } from '../components/ServerSelection';
3
- declare const meta: Meta;
4
- export default meta;
5
- export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IServerSelectionProps>;
@@ -1,40 +0,0 @@
1
- import { Meta, Story } from '@storybook/react';
2
- import React from 'react';
3
- import { RPGUIRoot } from '..';
4
- import {
5
- IServerSelectionProps,
6
- ServerSelection,
7
- } from '../components/ServerSelection';
8
-
9
- const meta: Meta = {
10
- title: 'ServerSelection',
11
- component: ServerSelection,
12
- };
13
-
14
- export default meta;
15
-
16
- const Template: Story<IServerSelectionProps> = args => (
17
- <RPGUIRoot>
18
- <ServerSelection {...args} details="There are server details" />
19
- </RPGUIRoot>
20
- );
21
-
22
- export const Default = Template.bind({});
23
-
24
- Default.args = {
25
- onChange: () => {},
26
- servers: [
27
- {
28
- id: 'europe-germany',
29
- name: 'Europe',
30
- },
31
- {
32
- id: 'europe-uk',
33
- name: 'Europe',
34
- },
35
- {
36
- id: 'america-us',
37
- name: 'America',
38
- },
39
- ],
40
- };