heroes-of-chess-components 0.5.80 → 0.5.82
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.
|
@@ -3,7 +3,28 @@ import { HBoxStyledProps } from "./type";
|
|
|
3
3
|
|
|
4
4
|
export const HBoxContainer = styled.div.withConfig({
|
|
5
5
|
shouldForwardProp: (prop) =>
|
|
6
|
-
![
|
|
6
|
+
![
|
|
7
|
+
"direction",
|
|
8
|
+
"gap",
|
|
9
|
+
"align",
|
|
10
|
+
"justify",
|
|
11
|
+
"wrap",
|
|
12
|
+
"width",
|
|
13
|
+
"height",
|
|
14
|
+
"padding",
|
|
15
|
+
"margin",
|
|
16
|
+
"border",
|
|
17
|
+
"borderRadius",
|
|
18
|
+
"background",
|
|
19
|
+
"overflowX",
|
|
20
|
+
"overflowY",
|
|
21
|
+
"boxShadow",
|
|
22
|
+
"position",
|
|
23
|
+
"top",
|
|
24
|
+
"bottom",
|
|
25
|
+
"left",
|
|
26
|
+
"right"
|
|
27
|
+
].includes(prop),
|
|
7
28
|
})<HBoxStyledProps>`
|
|
8
29
|
display: flex;
|
|
9
30
|
flex-direction: ${(props) => props.direction}; /* Dirección (row o column) */
|
|
@@ -24,31 +24,48 @@ const HBox: React.FC<HBoxProps> = ({
|
|
|
24
24
|
bottom = "auto", // Posición inferior
|
|
25
25
|
left = "auto", // Posición izquierda
|
|
26
26
|
right = "auto", // Posición derecha
|
|
27
|
-
...props
|
|
27
|
+
...restProps // Resto de props que no son de estilo
|
|
28
28
|
}) => {
|
|
29
|
+
// Separar props de estilo que van al styled component
|
|
30
|
+
const styledProps = {
|
|
31
|
+
background,
|
|
32
|
+
direction,
|
|
33
|
+
gap,
|
|
34
|
+
align,
|
|
35
|
+
justify,
|
|
36
|
+
wrap,
|
|
37
|
+
width,
|
|
38
|
+
height,
|
|
39
|
+
padding,
|
|
40
|
+
margin,
|
|
41
|
+
border,
|
|
42
|
+
borderRadius,
|
|
43
|
+
overflowX,
|
|
44
|
+
overflowY,
|
|
45
|
+
boxShadow,
|
|
46
|
+
position,
|
|
47
|
+
top,
|
|
48
|
+
bottom,
|
|
49
|
+
left,
|
|
50
|
+
right,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Props que sí queremos pasar al DOM (como onClick, onMouseOver, etc.)
|
|
54
|
+
const domProps = Object.fromEntries(
|
|
55
|
+
Object.entries(restProps).filter(([key]) =>
|
|
56
|
+
key.startsWith('on') ||
|
|
57
|
+
key === 'className' ||
|
|
58
|
+
key === 'id' ||
|
|
59
|
+
key === 'style' ||
|
|
60
|
+
key === 'aria-' ||
|
|
61
|
+
key === 'data-'
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
|
|
29
65
|
return (
|
|
30
66
|
<HBoxContainer
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
gap={gap}
|
|
34
|
-
align={align}
|
|
35
|
-
justify={justify}
|
|
36
|
-
wrap={wrap}
|
|
37
|
-
width={width}
|
|
38
|
-
height={height}
|
|
39
|
-
padding={padding}
|
|
40
|
-
margin={margin}
|
|
41
|
-
border={border}
|
|
42
|
-
borderRadius={borderRadius}
|
|
43
|
-
overflowX={overflowX}
|
|
44
|
-
overflowY={overflowY}
|
|
45
|
-
boxShadow={boxShadow}
|
|
46
|
-
position={position}
|
|
47
|
-
top={top}
|
|
48
|
-
bottom={bottom}
|
|
49
|
-
left={left}
|
|
50
|
-
right={right}
|
|
51
|
-
{...props}
|
|
67
|
+
{...styledProps}
|
|
68
|
+
{...domProps}
|
|
52
69
|
>
|
|
53
70
|
{children}
|
|
54
71
|
</HBoxContainer>
|