@rpg-engine/long-bow 0.1.29 → 0.1.35
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/Button.d.ts +4 -4
- package/dist/components/CheckButton.d.ts +14 -0
- package/dist/components/Dropdown.d.ts +12 -0
- package/dist/components/Input.d.ts +4 -0
- package/dist/components/ListMenu.d.ts +1 -0
- package/dist/components/ProgressBar.d.ts +7 -0
- package/dist/components/RadioButton.d.ts +11 -0
- package/dist/components/TextArea.d.ts +4 -0
- package/dist/components/Truncate.d.ts +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/long-bow.cjs.development.js +205 -26
- 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 +201 -28
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button.tsx +19 -14
- package/src/components/CheckButton.tsx +64 -0
- package/src/components/Dropdown.tsx +57 -0
- package/src/components/Input.tsx +11 -0
- package/src/components/ListMenu.tsx +21 -17
- package/src/components/NPCDialog/NPCDialog.tsx +43 -46
- package/src/components/ProgressBar.tsx +48 -0
- package/src/components/RadioButton.tsx +53 -0
- package/src/components/RangeSlider.tsx +18 -20
- package/src/components/TextArea.tsx +11 -0
- package/src/components/Truncate.tsx +25 -0
- package/src/index.tsx +6 -0
|
@@ -0,0 +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
|
+
};
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
import { useEventListener } from '../hooks/useEventListener';
|
|
5
|
-
import {
|
|
5
|
+
import { _RPGUI } from './RPGUIRoot';
|
|
6
6
|
|
|
7
7
|
export enum RangeSliderType {
|
|
8
8
|
Slider = 'rpgui-slider',
|
|
@@ -43,25 +43,23 @@ export const RangeSlider: React.FC<IRangeSliderProps> = ({
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</div>
|
|
64
|
-
</RPGUIRoot>
|
|
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>
|
|
65
63
|
);
|
|
66
64
|
};
|
|
67
65
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ITextArea
|
|
4
|
+
extends React.DetailedHTMLProps<
|
|
5
|
+
React.TextareaHTMLAttributes<HTMLTextAreaElement>,
|
|
6
|
+
HTMLTextAreaElement
|
|
7
|
+
> {}
|
|
8
|
+
|
|
9
|
+
export const TextArea: React.FC<ITextArea> = ({ ...props }) => {
|
|
10
|
+
return <textarea {...props} />;
|
|
11
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable react/require-default-props */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
|
|
5
|
+
interface IProps {
|
|
6
|
+
maxLines?: number;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Truncate: React.FC<IProps> = ({ maxLines = 1, children }) => {
|
|
11
|
+
return <Container maxLines={maxLines}>{children}</Container>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface IContainerProps {
|
|
15
|
+
maxLines: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Container = styled.div<IContainerProps>`
|
|
19
|
+
display: -webkit-box;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
max-height: 100%;
|
|
22
|
+
-webkit-line-clamp: ${(props) => props.maxLines};
|
|
23
|
+
-webkit-box-orient: vertical;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
`;
|
package/src/index.tsx
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
export * from './components/Button';
|
|
2
|
+
export * from './components/CheckButton';
|
|
3
|
+
export * from './components/Dropdown';
|
|
4
|
+
export * from './components/Input';
|
|
2
5
|
export * from './components/ListMenu';
|
|
3
6
|
export * from './components/NPCDialog/NPCDialog';
|
|
4
7
|
export * from './components/NPCDialog/QuestionDialog/QuestionDialog';
|
|
8
|
+
export * from './components/RadioButton';
|
|
5
9
|
export * from './components/RangeSlider';
|
|
6
10
|
export * from './components/RPGUIContainer';
|
|
7
11
|
export * from './components/RPGUIRoot';
|
|
12
|
+
export * from './components/TextArea';
|
|
13
|
+
export * from './components/Truncate';
|
|
8
14
|
export * from './components/typography/DynamicText';
|
|
9
15
|
export { useEventListener } from './hooks/useEventListener';
|