@raketa-builder/menu-builder 0.5.0 → 0.6.0
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/.turbo/turbo-build.log +2 -2
- package/dist/index.js +631 -871
- package/package.json +1 -2
- package/src/MenuBuilder/AddWidget.js +4 -18
- package/src/MenuBuilder/ColumnBuilder.js +4 -6
- package/src/MenuBuilder/MainNavigation.js +18 -34
- package/src/MenuBuilder/icons.js +118 -0
- package/src/styles.css +67 -0
- package/src/MenuBuilder/icons/index.js +0 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raketa-builder/menu-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"dev": "tsup src/index.js --format cjs --loader \".js=jsx\" --watch"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"styled-components": "^5.1.0",
|
|
14
13
|
"react": "18.2.0",
|
|
15
14
|
"react-dom": "18.2.0"
|
|
16
15
|
},
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import { Modal, buttonReset } from "@raketa-builder/ui";
|
|
2
|
+
import { Modal, cn } from "@raketa-builder/ui";
|
|
4
3
|
import WidgetContext from "./WidgetContext";
|
|
5
4
|
|
|
6
|
-
const WidgetButton =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
margin-bottom: 0.5em;
|
|
10
|
-
padding: 1em;
|
|
11
|
-
border: 1px solid ${(props) => props.theme.colors.gray};
|
|
12
|
-
border-radius: 3px;
|
|
13
|
-
font-weight: 500;
|
|
14
|
-
text-align: left;
|
|
15
|
-
|
|
16
|
-
&:hover {
|
|
17
|
-
background-color: ${(props) => props.theme.colors.primaryLight};
|
|
18
|
-
border-color: ${(props) => props.theme.colors.primary};
|
|
19
|
-
color: ${(props) => props.theme.colors.primary};
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
5
|
+
const WidgetButton = ({ className, ...props }) => (
|
|
6
|
+
<div className={cn("r-reset-button r-widget-button", className)} {...props} />
|
|
7
|
+
);
|
|
22
8
|
|
|
23
9
|
const AddWidget = ({ onAdd, onClose }) => {
|
|
24
10
|
return (
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
2
|
import { ReactSortable } from "react-sortablejs";
|
|
4
3
|
import Factories from "./Factories";
|
|
5
4
|
import { append, remove, update, rand } from "./utils";
|
|
@@ -12,14 +11,13 @@ import {
|
|
|
12
11
|
Panel,
|
|
13
12
|
PanelTitle,
|
|
14
13
|
PanelContent,
|
|
14
|
+
cn,
|
|
15
15
|
} from "@raketa-builder/ui";
|
|
16
16
|
import ContentBuilder from "./ContentBuilder";
|
|
17
17
|
|
|
18
|
-
const Wrapper =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
18
|
+
const Wrapper = ({ className, ...props }) => (
|
|
19
|
+
<div className={cn("r-reset", className)} {...props} />
|
|
20
|
+
);
|
|
23
21
|
|
|
24
22
|
const ColumnBuilder = ({ value, onChange }) => {
|
|
25
23
|
const [state, setState] = React.useState(value);
|
|
@@ -1,43 +1,27 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
2
|
import { ReactSortable } from "react-sortablejs";
|
|
4
3
|
import { append } from "./utils";
|
|
5
4
|
import Factories from "./Factories";
|
|
6
|
-
import {
|
|
7
|
-
reset,
|
|
8
|
-
Button,
|
|
9
|
-
Stack,
|
|
10
|
-
Container,
|
|
11
|
-
buttonReset,
|
|
12
|
-
} from "@raketa-builder/ui";
|
|
5
|
+
import { Button, Stack, Container, cn } from "@raketa-builder/ui";
|
|
13
6
|
|
|
14
|
-
const Item =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
props.active ? props.theme.colors.primary : props.theme.colors.white};
|
|
26
|
-
font-weight: 700;
|
|
27
|
-
transition: 0.1s ease-in-out all;
|
|
28
|
-
|
|
29
|
-
&:hover {
|
|
30
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
7
|
+
const Item = ({ className, ...props }) => (
|
|
8
|
+
<div
|
|
9
|
+
className={cn(
|
|
10
|
+
"r-reset",
|
|
11
|
+
"r-main-nav-item",
|
|
12
|
+
props.active ? "active" : "",
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
33
18
|
|
|
34
|
-
const TabButton =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
`;
|
|
19
|
+
const TabButton = ({ className, ...props }) => (
|
|
20
|
+
<div
|
|
21
|
+
className={cn("r-reset-button r-main-nav-tab-button", className)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
41
25
|
|
|
42
26
|
const MainNavigation = ({ items, tab, onTab, onChange }) => (
|
|
43
27
|
<Container bottom>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { cn } from "@raketa-builder/ui";
|
|
2
|
+
|
|
3
|
+
function filterStyle(props) {
|
|
4
|
+
const value = props.invert ? 1 : 0;
|
|
5
|
+
|
|
6
|
+
return { filter: `invert(${value})` };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function Edit({ className, ...rest }) {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
className={cn(
|
|
13
|
+
"r-reset",
|
|
14
|
+
"r-menu-icon",
|
|
15
|
+
"feather",
|
|
16
|
+
"feather-edit-2",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
style={filterStyle(rest)}
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
width="24"
|
|
22
|
+
height="24"
|
|
23
|
+
viewBox="0 0 24 24"
|
|
24
|
+
fill="none"
|
|
25
|
+
stroke="#000"
|
|
26
|
+
strokeWidth="2"
|
|
27
|
+
strokeLinecap="round"
|
|
28
|
+
strokeLinejoin="round"
|
|
29
|
+
{...rest}
|
|
30
|
+
>
|
|
31
|
+
<path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path>
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function Delete({ className, ...rest }) {
|
|
37
|
+
return (
|
|
38
|
+
<svg
|
|
39
|
+
className={cn(
|
|
40
|
+
"r-reset",
|
|
41
|
+
"r-menu-icon",
|
|
42
|
+
"feather",
|
|
43
|
+
"feather-trash",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
style={filterStyle(rest)}
|
|
47
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
48
|
+
width="24"
|
|
49
|
+
height="24"
|
|
50
|
+
viewBox="0 0 24 24"
|
|
51
|
+
fill="none"
|
|
52
|
+
stroke="#000"
|
|
53
|
+
stroke-width="2"
|
|
54
|
+
strokeLinecap="round"
|
|
55
|
+
strokeLinejoin="round"
|
|
56
|
+
{...rest}
|
|
57
|
+
>
|
|
58
|
+
<polyline points="3 6 5 6 21 6"></polyline>
|
|
59
|
+
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
|
|
60
|
+
</svg>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function Plus({ className, ...rest }) {
|
|
65
|
+
return (
|
|
66
|
+
<svg
|
|
67
|
+
className={cn(
|
|
68
|
+
"r-reset",
|
|
69
|
+
"r-menu-icon",
|
|
70
|
+
"feather",
|
|
71
|
+
"feather-plus",
|
|
72
|
+
className
|
|
73
|
+
)}
|
|
74
|
+
style={filterStyle(rest)}
|
|
75
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
76
|
+
width="24"
|
|
77
|
+
height="24"
|
|
78
|
+
viewBox="0 0 24 24"
|
|
79
|
+
fill="none"
|
|
80
|
+
stroke="#000"
|
|
81
|
+
stroke-width="2"
|
|
82
|
+
strokeLinecap="round"
|
|
83
|
+
strokeLinejoin="round"
|
|
84
|
+
{...rest}
|
|
85
|
+
>
|
|
86
|
+
<line x1="12" y1="5" x2="12" y2="19"></line>
|
|
87
|
+
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
88
|
+
</svg>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function Copy({ className, ...rest }) {
|
|
93
|
+
return (
|
|
94
|
+
<svg
|
|
95
|
+
className={cn(
|
|
96
|
+
"r-reset",
|
|
97
|
+
"r-menu-icon",
|
|
98
|
+
"feather",
|
|
99
|
+
"feather-copy",
|
|
100
|
+
className
|
|
101
|
+
)}
|
|
102
|
+
style={filterStyle(rest)}
|
|
103
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
104
|
+
width="24"
|
|
105
|
+
height="24"
|
|
106
|
+
viewBox="0 0 24 24"
|
|
107
|
+
fill="none"
|
|
108
|
+
stroke="#000"
|
|
109
|
+
stroke-width="2"
|
|
110
|
+
strokeLinecap="round"
|
|
111
|
+
strokeLinejoin="round"
|
|
112
|
+
{...rest}
|
|
113
|
+
>
|
|
114
|
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
115
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
116
|
+
</svg>
|
|
117
|
+
);
|
|
118
|
+
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
@layer raketa-builder {
|
|
2
|
+
|
|
3
|
+
/* Add widget */
|
|
4
|
+
.r-widget-button {
|
|
5
|
+
width: 100%;
|
|
6
|
+
margin-bottom: 0.5em;
|
|
7
|
+
padding: 1em;
|
|
8
|
+
border: 1px solid var(--r-gray);
|
|
9
|
+
border-radius: 3px;
|
|
10
|
+
font-weight: 500;
|
|
11
|
+
text-align: left;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.r-widget-button:hover {
|
|
15
|
+
border-color: var(--r-primary);
|
|
16
|
+
background-color: var(--r-primary-light);
|
|
17
|
+
color: var(--r-white);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Column Builder */
|
|
21
|
+
.r-list {
|
|
22
|
+
display: flex;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Main Navigation */
|
|
26
|
+
.r-main-nav-item {
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
margin-right: 0.5em;
|
|
30
|
+
padding: 0;
|
|
31
|
+
border: 2px solid var(--r-gray);
|
|
32
|
+
border-radius: 48px;
|
|
33
|
+
background-color: var(--r-white);
|
|
34
|
+
font-weight: 700;
|
|
35
|
+
transition: 0.1s ease-in-out all;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.r-main-nav-item:hover {
|
|
39
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.r-main-nav-item.active {
|
|
43
|
+
border: 2px solid var(--r-primary);
|
|
44
|
+
background-color: var(--r-primary);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.r-main-nav-tab-button {
|
|
48
|
+
padding: 0.5em 1em;
|
|
49
|
+
color: var(--r-black);
|
|
50
|
+
font-weight: 700;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.r-main-nav-item.active .r-main-nav-tab-button {
|
|
54
|
+
color: var(--r-white);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.r-menu-icon {
|
|
58
|
+
display: inline-block;
|
|
59
|
+
width: 16px;
|
|
60
|
+
height: 16px;
|
|
61
|
+
background-repeat: no-repeat;
|
|
62
|
+
background-position: center;
|
|
63
|
+
background-size: 100%;
|
|
64
|
+
line-height: 1;
|
|
65
|
+
filter: invert(0);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
export const Icon = styled.span`
|
|
4
|
-
display: inline-block;
|
|
5
|
-
width: 16px;
|
|
6
|
-
height: 16px;
|
|
7
|
-
background-repeat: no-repeat;
|
|
8
|
-
background-position: center;
|
|
9
|
-
background-size: 100%;
|
|
10
|
-
line-height: 1;
|
|
11
|
-
filter: invert(${(props) => (props.invert ? 1 : 0)});
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
export const Edit = styled(Icon)`
|
|
15
|
-
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iZmVhdGhlciBmZWF0aGVyLWVkaXQtMiI+PHBhdGggZD0iTTE3IDNhMi44MjggMi44MjggMCAxIDEgNCA0TDcuNSAyMC41IDIgMjJsMS41LTUuNUwxNyAzeiI+PC9wYXRoPjwvc3ZnPg==);
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
export const Delete = styled(Icon)`
|
|
19
|
-
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iZmVhdGhlciBmZWF0aGVyLXRyYXNoIj48cG9seWxpbmUgcG9pbnRzPSIzIDYgNSA2IDIxIDYiPjwvcG9seWxpbmU+PHBhdGggZD0iTTE5IDZ2MTRhMiAyIDAgMCAxLTIgMkg3YTIgMiAwIDAgMS0yLTJWNm0zIDBWNGEyIDIgMCAwIDEgMi0yaDRhMiAyIDAgMCAxIDIgMnYyIj48L3BhdGg+PC9zdmc+);
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
export const Plus = styled(Icon)`
|
|
23
|
-
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iZmVhdGhlciBmZWF0aGVyLXBsdXMiPjxsaW5lIHgxPSIxMiIgeTE9IjUiIHgyPSIxMiIgeTI9IjE5Ij48L2xpbmU+PGxpbmUgeDE9IjUiIHkxPSIxMiIgeDI9IjE5IiB5Mj0iMTIiPjwvbGluZT48L3N2Zz4=);
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
export const Copy = styled(Icon)`
|
|
27
|
-
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iZmVhdGhlciBmZWF0aGVyLWNvcHkiPjxyZWN0IHg9IjkiIHk9IjkiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxMyIgcng9IjIiIHJ5PSIyIj48L3JlY3Q+PHBhdGggZD0iTTUgMTVINGEyIDIgMCAwIDEtMi0yVjRhMiAyIDAgMCAxIDItMmg5YTIgMiAwIDAgMSAyIDJ2MSI+PC9wYXRoPjwvc3ZnPg==);
|
|
28
|
-
`;
|