@remvst/configurable-react 1.5.0 → 1.5.2
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/lib/boolean-configurable-component.d.ts +1 -1
- package/lib/button-configurable-component.d.ts +1 -1
- package/lib/color-configurable-component.d.ts +2 -2
- package/lib/composite-configurable-component.d.ts +1 -1
- package/lib/enum-configurable-component.d.ts +1 -1
- package/lib/group-configurable-component.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/number-configurable-component.d.ts +2 -2
- package/lib/string-configurable-component.d.ts +2 -2
- package/lib/textured-enum-component.d.ts +2 -2
- package/lib/textured-enum-component.js +1 -3
- package/package.json +2 -3
- package/src/textured-enum-component.tsx +1 -3
|
@@ -3,5 +3,5 @@ import { BooleanConfigurable } from '@remvst/configurable';
|
|
|
3
3
|
import { ComponentProps } from './component-props';
|
|
4
4
|
export default class BooleanConfigurableComponent extends React.Component<ComponentProps<BooleanConfigurable>> {
|
|
5
5
|
private onChange;
|
|
6
|
-
render(): JSX.Element;
|
|
6
|
+
render(): React.JSX.Element;
|
|
7
7
|
}
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { ButtonConfigurable } from '@remvst/configurable';
|
|
3
3
|
import { ComponentProps } from './component-props';
|
|
4
4
|
export default class ButtonConfigurableComponent extends React.Component<ComponentProps<ButtonConfigurable>> {
|
|
5
|
-
render(): JSX.Element;
|
|
5
|
+
render(): React.JSX.Element;
|
|
6
6
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { ColorConfigurable } from '@remvst/configurable';
|
|
3
3
|
import InputComponent from './input-component';
|
|
4
4
|
export default class ColorConfigurableComponent extends InputComponent<number, ColorConfigurable> {
|
|
5
5
|
protected mapValueToConfigurableFormat(value: string): number;
|
|
6
6
|
protected mapValueToInputFormat(value: number): string;
|
|
7
|
-
render(): JSX.Element;
|
|
7
|
+
render(): React.JSX.Element;
|
|
8
8
|
}
|
|
@@ -9,6 +9,6 @@ interface Props extends ComponentProps<CompositeConfigurable> {
|
|
|
9
9
|
}
|
|
10
10
|
export default class CompositeConfigurableComponent extends React.Component<Props> {
|
|
11
11
|
onClickLabel(event: React.MouseEvent): void;
|
|
12
|
-
render(): JSX.Element;
|
|
12
|
+
render(): React.JSX.Element;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -8,6 +8,6 @@ interface Props extends ComponentProps<GroupConfigurable> {
|
|
|
8
8
|
readonly getTexture?: (enumToken: any, item: any) => [string, TextureType] | null;
|
|
9
9
|
}
|
|
10
10
|
export default class CompositeConfigurableComponent extends React.Component<Props> {
|
|
11
|
-
render(): JSX.Element;
|
|
11
|
+
render(): React.JSX.Element;
|
|
12
12
|
}
|
|
13
13
|
export {};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
2
|
import { Configurable } from '@remvst/configurable';
|
|
3
3
|
import CompositeConfigurableComponent from './composite-configurable-component';
|
|
4
4
|
import { TextureType } from './textured-enum-component';
|
|
@@ -12,5 +12,5 @@ export declare function configurableToComponents(opts: {
|
|
|
12
12
|
configurable: () => Configurable;
|
|
13
13
|
mapper: ConfigurableToComponent;
|
|
14
14
|
getTexture?: (enumToken: any, item: any) => [string, TextureType] | null;
|
|
15
|
-
}): JSX.Element;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
16
|
export { CompositeConfigurableComponent, ConfigurableToComponent, TextureType, };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { NumberConfigurable } from '@remvst/configurable';
|
|
3
3
|
import InputComponent from './input-component';
|
|
4
4
|
export default class NumberConfigurableComponent extends InputComponent<number, NumberConfigurable> {
|
|
5
5
|
protected mapValueToConfigurableFormat(value: string): number;
|
|
6
6
|
protected mapValueToInputFormat(value: number): string;
|
|
7
|
-
render(): JSX.Element;
|
|
7
|
+
render(): React.JSX.Element;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { StringConfigurable } from '@remvst/configurable';
|
|
3
3
|
import InputComponent from './input-component';
|
|
4
4
|
export default class StringConfigurableComponent extends InputComponent<string, StringConfigurable> {
|
|
5
5
|
protected mapValueToConfigurableFormat(value: string): string;
|
|
6
6
|
protected mapValueToInputFormat(value: string): string;
|
|
7
|
-
render(): JSX.Element;
|
|
7
|
+
render(): React.JSX.Element;
|
|
8
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { EnumConfigurable } from '@remvst/configurable';
|
|
3
3
|
export declare enum TextureType {
|
|
4
4
|
TILED = 0,
|
|
@@ -7,4 +7,4 @@ export declare enum TextureType {
|
|
|
7
7
|
export default function TexturedEnumComponent<T>(props: {
|
|
8
8
|
configurable: EnumConfigurable<T>;
|
|
9
9
|
getTexture?: (enumToken: any, item: T) => [string, TextureType] | null;
|
|
10
|
-
}): JSX.Element;
|
|
10
|
+
}): React.JSX.Element;
|
|
@@ -43,7 +43,6 @@ exports.default = TexturedEnumComponent;
|
|
|
43
43
|
function CategoryComponent(props) {
|
|
44
44
|
const items = props.category.items.map(item => {
|
|
45
45
|
const texture = props.getTexture ? props.getTexture(props.enumToken, item.value) : null;
|
|
46
|
-
console.log(texture);
|
|
47
46
|
return react_1.default.createElement(TextureItemComponent, { key: item.key, title: item.key, src: texture ? texture[0] : null, textureType: texture ? texture[1] : null, enumToken: props.enumToken, selected: item.value === props.currentValue, onClick: () => props.onSelectValue(item.value) });
|
|
48
47
|
});
|
|
49
48
|
return (react_1.default.createElement("div", { className: 'group-configurable' }, items));
|
|
@@ -51,7 +50,6 @@ function CategoryComponent(props) {
|
|
|
51
50
|
function TextureItemComponent(props) {
|
|
52
51
|
const [size, setSize] = (0, react_1.useState)({ 'width': 0, 'height': 0 });
|
|
53
52
|
(0, react_1.useEffect)(() => {
|
|
54
|
-
console.log('load', props.src);
|
|
55
53
|
if (size.width !== 0 || !props.src) {
|
|
56
54
|
return;
|
|
57
55
|
}
|
|
@@ -60,7 +58,7 @@ function TextureItemComponent(props) {
|
|
|
60
58
|
img.src = props.src;
|
|
61
59
|
});
|
|
62
60
|
let backgroundSize = 'contain';
|
|
63
|
-
switch (props.
|
|
61
|
+
switch (props.textureType) {
|
|
64
62
|
case TextureType.SINGLE:
|
|
65
63
|
backgroundSize = 'contain';
|
|
66
64
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remvst/configurable-react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@remvst/configurable": "^1.5.0",
|
|
17
|
+
"@types/react": "^18.2.45",
|
|
17
18
|
"react": "^18.2.0",
|
|
18
|
-
"react-dom": "^18.2.0",
|
|
19
|
-
"@types/react-dom": "^18.0.6",
|
|
20
19
|
"typescript": "^4.1.3"
|
|
21
20
|
}
|
|
22
21
|
}
|
|
@@ -39,7 +39,6 @@ function CategoryComponent<T>(props: {
|
|
|
39
39
|
}) {
|
|
40
40
|
const items = props.category.items.map(item => {
|
|
41
41
|
const texture = props.getTexture ? props.getTexture(props.enumToken, item.value) : null;
|
|
42
|
-
console.log(texture);
|
|
43
42
|
|
|
44
43
|
return <TextureItemComponent
|
|
45
44
|
key={item.key}
|
|
@@ -67,7 +66,6 @@ function TextureItemComponent(props: {
|
|
|
67
66
|
const [size, setSize] = useState({'width': 0, 'height': 0});
|
|
68
67
|
|
|
69
68
|
useEffect(() => {
|
|
70
|
-
console.log('load', props.src);
|
|
71
69
|
if (size.width !== 0 || !props.src) {
|
|
72
70
|
return;
|
|
73
71
|
}
|
|
@@ -78,7 +76,7 @@ function TextureItemComponent(props: {
|
|
|
78
76
|
});
|
|
79
77
|
|
|
80
78
|
let backgroundSize: string = 'contain';
|
|
81
|
-
switch (props.
|
|
79
|
+
switch (props.textureType) {
|
|
82
80
|
case TextureType.SINGLE:
|
|
83
81
|
backgroundSize = 'contain';
|
|
84
82
|
break;
|