@raketa-builder/menu-builder 0.7.0 → 0.8.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 +6 -3
- package/.turbo/turbo-format.log +23 -0
- package/.turbo/turbo-lint.log +243 -13
- package/biome.json +3 -0
- package/dist/index.js +164 -50
- package/package.json +6 -5
- package/src/MenuBuilder/AdminWidget.js +30 -2
- package/src/MenuBuilder/ContentBuilder.js +15 -2
- package/src/MenuBuilder/MainNavigation.js +1 -1
- package/src/MenuBuilder/icons.js +3 -3
- package/src/styles.css +0 -1
- package/tsconfig.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
> @raketa-builder/menu-builder@0.8.0 build
|
|
3
|
+
> tsup src/index.js --format cjs --loader ".js=jsx"
|
|
4
|
+
|
|
2
5
|
CLI Building entry: src/index.js
|
|
3
6
|
CLI Using tsconfig: tsconfig.json
|
|
4
7
|
CLI tsup v6.5.0
|
|
5
8
|
CLI Target: es6
|
|
6
9
|
CJS Build start
|
|
7
|
-
CJS dist/index.js
|
|
8
|
-
CJS ⚡️ Build success in
|
|
10
|
+
CJS dist/index.js 63.14 KB
|
|
11
|
+
CJS ⚡️ Build success in 275ms
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
> @raketa-builder/menu-builder@0.7.0 format
|
|
3
|
+
> prettier --write .
|
|
4
|
+
|
|
5
|
+
biome.json 520ms (unchanged)
|
|
6
|
+
CHANGELOG.md 526ms (unchanged)
|
|
7
|
+
dist/index.js 5061ms
|
|
8
|
+
package.json 52ms (unchanged)
|
|
9
|
+
src/index.js 51ms (unchanged)
|
|
10
|
+
src/MenuBuilder/AddWidget.js 76ms (unchanged)
|
|
11
|
+
src/MenuBuilder/AdminWidget.js 83ms (unchanged)
|
|
12
|
+
src/MenuBuilder/ColumnBuilder.js 257ms (unchanged)
|
|
13
|
+
src/MenuBuilder/ContentBuilder.js 140ms
|
|
14
|
+
src/MenuBuilder/Factories.js 29ms (unchanged)
|
|
15
|
+
src/MenuBuilder/icons.js 54ms
|
|
16
|
+
src/MenuBuilder/index.js 50ms (unchanged)
|
|
17
|
+
src/MenuBuilder/ItemForm.js 88ms (unchanged)
|
|
18
|
+
src/MenuBuilder/MainNavigation.js 65ms
|
|
19
|
+
src/MenuBuilder/RowBuilder.js 48ms (unchanged)
|
|
20
|
+
src/MenuBuilder/utils.js 16ms (unchanged)
|
|
21
|
+
src/MenuBuilder/WidgetContext.js 3ms (unchanged)
|
|
22
|
+
src/styles.css 275ms
|
|
23
|
+
tsconfig.json 7ms
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,13 +1,243 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
|
|
2
|
+
> @raketa-builder/menu-builder@0.7.0 lint
|
|
3
|
+
> biome lint --max-diagnostics=5000 .
|
|
4
|
+
|
|
5
|
+
./src/MenuBuilder/icons.js:11:5 lint/a11y/noSvgWithoutTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
6
|
+
|
|
7
|
+
× Alternative text title element cannot be empty
|
|
8
|
+
|
|
9
|
+
9 │ export function Edit({ className, ...rest }) {
|
|
10
|
+
10 │ return (
|
|
11
|
+
> 11 │ <svg
|
|
12
|
+
│ ^^^^
|
|
13
|
+
> 12 │ className={cn(
|
|
14
|
+
...
|
|
15
|
+
> 29 │ {...rest}
|
|
16
|
+
> 30 │ >
|
|
17
|
+
│ ^
|
|
18
|
+
31 │ <path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path>
|
|
19
|
+
32 │ </svg>
|
|
20
|
+
|
|
21
|
+
i For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
./src/MenuBuilder/icons.js:31:7 lint/style/useSelfClosingElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
25
|
+
|
|
26
|
+
× JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
|
|
27
|
+
|
|
28
|
+
29 │ {...rest}
|
|
29
|
+
30 │ >
|
|
30
|
+
> 31 │ <path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path>
|
|
31
|
+
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
32
|
+
32 │ </svg>
|
|
33
|
+
33 │ );
|
|
34
|
+
|
|
35
|
+
i Unsafe fix: Use a SelfClosingElement instead
|
|
36
|
+
|
|
37
|
+
29 29 │ {...rest}
|
|
38
|
+
30 30 │ >
|
|
39
|
+
31 │ - ······<path·d="M17·3a2.828·2.828·0·1·1·4·4L7.5·20.5·2·22l1.5-5.5L17·3z"></path>
|
|
40
|
+
31 │ + ······<path·d="M17·3a2.828·2.828·0·1·1·4·4L7.5·20.5·2·22l1.5-5.5L17·3z"·/>
|
|
41
|
+
32 32 │ </svg>
|
|
42
|
+
33 33 │ );
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
./src/MenuBuilder/icons.js:38:5 lint/a11y/noSvgWithoutTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
46
|
+
|
|
47
|
+
× Alternative text title element cannot be empty
|
|
48
|
+
|
|
49
|
+
36 │ export function Delete({ className, ...rest }) {
|
|
50
|
+
37 │ return (
|
|
51
|
+
> 38 │ <svg
|
|
52
|
+
│ ^^^^
|
|
53
|
+
> 39 │ className={cn(
|
|
54
|
+
...
|
|
55
|
+
> 56 │ {...rest}
|
|
56
|
+
> 57 │ >
|
|
57
|
+
│ ^
|
|
58
|
+
58 │ <polyline points="3 6 5 6 21 6"></polyline>
|
|
59
|
+
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
|
+
|
|
61
|
+
i For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
./src/MenuBuilder/icons.js:58:7 lint/style/useSelfClosingElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
65
|
+
|
|
66
|
+
× JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
|
|
67
|
+
|
|
68
|
+
56 │ {...rest}
|
|
69
|
+
57 │ >
|
|
70
|
+
> 58 │ <polyline points="3 6 5 6 21 6"></polyline>
|
|
71
|
+
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
72
|
+
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>
|
|
73
|
+
60 │ </svg>
|
|
74
|
+
|
|
75
|
+
i Unsafe fix: Use a SelfClosingElement instead
|
|
76
|
+
|
|
77
|
+
56 56 │ {...rest}
|
|
78
|
+
57 57 │ >
|
|
79
|
+
58 │ - ······<polyline·points="3·6·5·6·21·6"></polyline>
|
|
80
|
+
58 │ + ······<polyline·points="3·6·5·6·21·6"·/>
|
|
81
|
+
59 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>
|
|
82
|
+
60 60 │ </svg>
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
./src/MenuBuilder/icons.js:59:7 lint/style/useSelfClosingElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
86
|
+
|
|
87
|
+
× JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
|
|
88
|
+
|
|
89
|
+
57 │ >
|
|
90
|
+
58 │ <polyline points="3 6 5 6 21 6"></polyline>
|
|
91
|
+
> 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>
|
|
92
|
+
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
93
|
+
60 │ </svg>
|
|
94
|
+
61 │ );
|
|
95
|
+
|
|
96
|
+
i Unsafe fix: Use a SelfClosingElement instead
|
|
97
|
+
|
|
98
|
+
57 57 │ >
|
|
99
|
+
58 58 │ <polyline points="3 6 5 6 21 6"></polyline>
|
|
100
|
+
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>
|
|
101
|
+
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"·/>
|
|
102
|
+
60 60 │ </svg>
|
|
103
|
+
61 61 │ );
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
./src/MenuBuilder/icons.js:66:5 lint/a11y/noSvgWithoutTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
107
|
+
|
|
108
|
+
× Alternative text title element cannot be empty
|
|
109
|
+
|
|
110
|
+
64 │ export function Plus({ className, ...rest }) {
|
|
111
|
+
65 │ return (
|
|
112
|
+
> 66 │ <svg
|
|
113
|
+
│ ^^^^
|
|
114
|
+
> 67 │ className={cn(
|
|
115
|
+
...
|
|
116
|
+
> 84 │ {...rest}
|
|
117
|
+
> 85 │ >
|
|
118
|
+
│ ^
|
|
119
|
+
86 │ <line x1="12" y1="5" x2="12" y2="19"></line>
|
|
120
|
+
87 │ <line x1="5" y1="12" x2="19" y2="12"></line>
|
|
121
|
+
|
|
122
|
+
i For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
./src/MenuBuilder/icons.js:86:7 lint/style/useSelfClosingElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
126
|
+
|
|
127
|
+
× JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
|
|
128
|
+
|
|
129
|
+
84 │ {...rest}
|
|
130
|
+
85 │ >
|
|
131
|
+
> 86 │ <line x1="12" y1="5" x2="12" y2="19"></line>
|
|
132
|
+
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
133
|
+
87 │ <line x1="5" y1="12" x2="19" y2="12"></line>
|
|
134
|
+
88 │ </svg>
|
|
135
|
+
|
|
136
|
+
i Unsafe fix: Use a SelfClosingElement instead
|
|
137
|
+
|
|
138
|
+
84 84 │ {...rest}
|
|
139
|
+
85 85 │ >
|
|
140
|
+
86 │ - ······<line·x1="12"·y1="5"·x2="12"·y2="19"></line>
|
|
141
|
+
86 │ + ······<line·x1="12"·y1="5"·x2="12"·y2="19"·/>
|
|
142
|
+
87 87 │ <line x1="5" y1="12" x2="19" y2="12"></line>
|
|
143
|
+
88 88 │ </svg>
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
./src/MenuBuilder/icons.js:87:7 lint/style/useSelfClosingElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
147
|
+
|
|
148
|
+
× JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
|
|
149
|
+
|
|
150
|
+
85 │ >
|
|
151
|
+
86 │ <line x1="12" y1="5" x2="12" y2="19"></line>
|
|
152
|
+
> 87 │ <line x1="5" y1="12" x2="19" y2="12"></line>
|
|
153
|
+
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
154
|
+
88 │ </svg>
|
|
155
|
+
89 │ );
|
|
156
|
+
|
|
157
|
+
i Unsafe fix: Use a SelfClosingElement instead
|
|
158
|
+
|
|
159
|
+
85 85 │ >
|
|
160
|
+
86 86 │ <line x1="12" y1="5" x2="12" y2="19"></line>
|
|
161
|
+
87 │ - ······<line·x1="5"·y1="12"·x2="19"·y2="12"></line>
|
|
162
|
+
87 │ + ······<line·x1="5"·y1="12"·x2="19"·y2="12"·/>
|
|
163
|
+
88 88 │ </svg>
|
|
164
|
+
89 89 │ );
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
./src/MenuBuilder/icons.js:94:5 lint/a11y/noSvgWithoutTitle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
168
|
+
|
|
169
|
+
× Alternative text title element cannot be empty
|
|
170
|
+
|
|
171
|
+
92 │ export function Copy({ className, ...rest }) {
|
|
172
|
+
93 │ return (
|
|
173
|
+
> 94 │ <svg
|
|
174
|
+
│ ^^^^
|
|
175
|
+
> 95 │ className={cn(
|
|
176
|
+
...
|
|
177
|
+
> 112 │ {...rest}
|
|
178
|
+
> 113 │ >
|
|
179
|
+
│ ^
|
|
180
|
+
114 │ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
181
|
+
115 │ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
182
|
+
|
|
183
|
+
i For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
./src/MenuBuilder/icons.js:114:7 lint/style/useSelfClosingElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━
|
|
187
|
+
|
|
188
|
+
× JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
|
|
189
|
+
|
|
190
|
+
112 │ {...rest}
|
|
191
|
+
113 │ >
|
|
192
|
+
> 114 │ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
193
|
+
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
194
|
+
115 │ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
195
|
+
116 │ </svg>
|
|
196
|
+
|
|
197
|
+
i Unsafe fix: Use a SelfClosingElement instead
|
|
198
|
+
|
|
199
|
+
112 112 │ {...rest}
|
|
200
|
+
113 113 │ >
|
|
201
|
+
114 │ - ······<rect·x="9"·y="9"·width="13"·height="13"·rx="2"·ry="2"></rect>
|
|
202
|
+
114 │ + ······<rect·x="9"·y="9"·width="13"·height="13"·rx="2"·ry="2"·/>
|
|
203
|
+
115 115 │ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
204
|
+
116 116 │ </svg>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
./src/MenuBuilder/icons.js:115:7 lint/style/useSelfClosingElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━
|
|
208
|
+
|
|
209
|
+
× JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
|
|
210
|
+
|
|
211
|
+
113 │ >
|
|
212
|
+
114 │ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
213
|
+
> 115 │ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
214
|
+
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
215
|
+
116 │ </svg>
|
|
216
|
+
117 │ );
|
|
217
|
+
|
|
218
|
+
i Unsafe fix: Use a SelfClosingElement instead
|
|
219
|
+
|
|
220
|
+
113 113 │ >
|
|
221
|
+
114 114 │ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
222
|
+
115 │ - ······<path·d="M5·15H4a2·2·0·0·1-2-2V4a2·2·0·0·1·2-2h9a2·2·0·0·1·2·2v1"></path>
|
|
223
|
+
115 │ + ······<path·d="M5·15H4a2·2·0·0·1-2-2V4a2·2·0·0·1·2-2h9a2·2·0·0·1·2·2v1"·/>
|
|
224
|
+
116 116 │ </svg>
|
|
225
|
+
117 117 │ );
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
./src/MenuBuilder/icons.js lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
229
|
+
|
|
230
|
+
× The file contains diagnostics that needs to be addressed.
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
Checked 14 file(s) in 115ms
|
|
234
|
+
Found 12 error(s)
|
|
235
|
+
lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
236
|
+
|
|
237
|
+
× Some errors were emitted while running checks.
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
npm ERR! Lifecycle script `lint` failed with error:
|
|
241
|
+
npm ERR! Error: command failed
|
|
242
|
+
npm ERR! in workspace: @raketa-builder/menu-builder@0.7.0
|
|
243
|
+
npm ERR! at location: /home/sve/dev/StudioRaketa/cloud/frontend/raketa-builder/packages/menu-builder
|
package/biome.json
ADDED
package/dist/index.js
CHANGED
|
@@ -114,6 +114,7 @@ var require_dist = __commonJS({
|
|
|
114
114
|
var src_exports2 = {};
|
|
115
115
|
__export2(src_exports2, {
|
|
116
116
|
Button: () => Button_default,
|
|
117
|
+
CategoriesMenu: () => CategoriesMenu_default,
|
|
117
118
|
Col: () => Col,
|
|
118
119
|
Container: () => Container_default,
|
|
119
120
|
DataGrid: () => DataGrid_default,
|
|
@@ -219,11 +220,23 @@ var require_dist = __commonJS({
|
|
|
219
220
|
var import_react32 = __toESM2(require("react"));
|
|
220
221
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
221
222
|
var Button7 = (_a) => {
|
|
222
|
-
var _b = _a, {
|
|
223
|
+
var _b = _a, {
|
|
224
|
+
as = "button",
|
|
225
|
+
size = "md",
|
|
226
|
+
variant = "primary",
|
|
227
|
+
className,
|
|
228
|
+
type = "button"
|
|
229
|
+
} = _b, rest = __objRest2(_b, [
|
|
230
|
+
"as",
|
|
231
|
+
"size",
|
|
232
|
+
"variant",
|
|
233
|
+
"className",
|
|
234
|
+
"type"
|
|
235
|
+
]);
|
|
236
|
+
const Component = as;
|
|
223
237
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
224
|
-
|
|
238
|
+
Component,
|
|
225
239
|
__spreadValues2({
|
|
226
|
-
type,
|
|
227
240
|
className: cn5(
|
|
228
241
|
"r-reset",
|
|
229
242
|
"r-reset-button",
|
|
@@ -232,14 +245,9 @@ var require_dist = __commonJS({
|
|
|
232
245
|
`r-button-${variant}`,
|
|
233
246
|
className
|
|
234
247
|
)
|
|
235
|
-
},
|
|
248
|
+
}, rest)
|
|
236
249
|
);
|
|
237
250
|
};
|
|
238
|
-
Button7.defaultProps = {
|
|
239
|
-
type: "button",
|
|
240
|
-
size: "md",
|
|
241
|
-
variant: "primary"
|
|
242
|
-
};
|
|
243
251
|
Button7.variants = ["primary", "secondary", "success", "danger"];
|
|
244
252
|
Button7.sizes = {
|
|
245
253
|
sm: "sm",
|
|
@@ -285,8 +293,8 @@ var require_dist = __commonJS({
|
|
|
285
293
|
var import_react52 = __toESM2(require("react"));
|
|
286
294
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
287
295
|
var Input2 = (_a) => {
|
|
288
|
-
var _b = _a, { className } = _b,
|
|
289
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("input", __spreadValues2({ className: cn5("r-reset", "r-input", className) },
|
|
296
|
+
var _b = _a, { className } = _b, rest = __objRest2(_b, ["className"]);
|
|
297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("input", __spreadValues2({ className: cn5("r-reset", "r-input", className) }, rest));
|
|
290
298
|
};
|
|
291
299
|
var Input_default = Input2;
|
|
292
300
|
var import_react62 = __toESM2(require("react"));
|
|
@@ -457,30 +465,59 @@ var require_dist = __commonJS({
|
|
|
457
465
|
}, props)
|
|
458
466
|
);
|
|
459
467
|
};
|
|
468
|
+
var FooterBar = (_a) => {
|
|
469
|
+
var _b = _a, { className } = _b, props = __objRest2(_b, ["className"]);
|
|
470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", __spreadValues2({ className: cn5("r-reset", "r-modal-footer-bar", className) }, props));
|
|
471
|
+
};
|
|
460
472
|
var Content = (_a) => {
|
|
461
473
|
var _b = _a, { className } = _b, props = __objRest2(_b, ["className"]);
|
|
462
474
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", __spreadValues2({ className: cn5("r-reset", "r-modal-content", className) }, props));
|
|
463
475
|
};
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
476
|
+
function checkForChanges2(hasChanges, onClose) {
|
|
477
|
+
if (!hasChanges) {
|
|
478
|
+
onClose();
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
if (!confirm(
|
|
482
|
+
"You\u2019ve made changes to the widget. Are you sure you want to cancel?"
|
|
483
|
+
))
|
|
484
|
+
return;
|
|
485
|
+
onClose();
|
|
486
|
+
}
|
|
487
|
+
var Modal3 = (_a) => {
|
|
488
|
+
var _b = _a, {
|
|
489
|
+
title,
|
|
490
|
+
children,
|
|
491
|
+
customWrapper,
|
|
492
|
+
FooterContent,
|
|
493
|
+
onClose,
|
|
494
|
+
areChanges
|
|
495
|
+
} = _b, rest = __objRest2(_b, [
|
|
496
|
+
"title",
|
|
497
|
+
"children",
|
|
498
|
+
"customWrapper",
|
|
499
|
+
"FooterContent",
|
|
500
|
+
"onClose",
|
|
501
|
+
"areChanges"
|
|
502
|
+
]);
|
|
503
|
+
const ModalWrapper = customWrapper ? customWrapper : Wrapper2;
|
|
475
504
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react17.default.Fragment, { children: [
|
|
476
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, {
|
|
477
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Overlay, {}),
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModalWrapper, __spreadProps2(__spreadValues2({}, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Inner, { children: [
|
|
478
507
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TitleBar, { children: [
|
|
479
508
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Title, { children: title }),
|
|
480
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
510
|
+
CloseButton,
|
|
511
|
+
{
|
|
512
|
+
type: "button",
|
|
513
|
+
onClick: () => checkForChanges2(areChanges, onClose),
|
|
514
|
+
children: "\xD7"
|
|
515
|
+
}
|
|
516
|
+
)
|
|
481
517
|
] }),
|
|
482
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Content, { children })
|
|
483
|
-
|
|
518
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Content, { children }),
|
|
519
|
+
FooterContent && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterBar, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FooterContent, {}) })
|
|
520
|
+
] }) }))
|
|
484
521
|
] });
|
|
485
522
|
};
|
|
486
523
|
var Modal_default = Modal3;
|
|
@@ -711,7 +748,7 @@ var require_dist = __commonJS({
|
|
|
711
748
|
var import_react24 = __toESM2(require("react"));
|
|
712
749
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
713
750
|
var ImageAvatar = (_a) => {
|
|
714
|
-
var _b = _a, { size, className } = _b, props = __objRest2(_b, ["size", "className"]);
|
|
751
|
+
var _b = _a, { size = "24px", className } = _b, props = __objRest2(_b, ["size", "className"]);
|
|
715
752
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
716
753
|
"img",
|
|
717
754
|
__spreadValues2({
|
|
@@ -724,9 +761,6 @@ var require_dist = __commonJS({
|
|
|
724
761
|
}, props)
|
|
725
762
|
);
|
|
726
763
|
};
|
|
727
|
-
ImageAvatar.defaultProps = {
|
|
728
|
-
size: "24px"
|
|
729
|
-
};
|
|
730
764
|
var ImageAvatar_default = ImageAvatar;
|
|
731
765
|
var import_react25 = __toESM2(require("react"));
|
|
732
766
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
@@ -767,14 +801,53 @@ var require_dist = __commonJS({
|
|
|
767
801
|
);
|
|
768
802
|
};
|
|
769
803
|
var DefaultAvatar = (_a) => {
|
|
770
|
-
var _b = _a, { initials } = _b, props = __objRest2(_b, ["initials"]);
|
|
771
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DefaultAvatarStyles, __spreadProps2(__spreadValues2({ initials }, props), { children: initials }));
|
|
772
|
-
};
|
|
773
|
-
DefaultAvatar.defaultProps = {
|
|
774
|
-
size: "24px",
|
|
775
|
-
initials: "AA"
|
|
804
|
+
var _b = _a, { initials = "AA", size = "24px" } = _b, props = __objRest2(_b, ["initials", "size"]);
|
|
805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DefaultAvatarStyles, __spreadProps2(__spreadValues2({ initials, size }, props), { children: initials }));
|
|
776
806
|
};
|
|
777
807
|
var DefaultAvatar_default = DefaultAvatar;
|
|
808
|
+
var import_react26 = __toESM2(require("react"));
|
|
809
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
810
|
+
var IconsWrapper = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "r-reset r-categories-icons-wrapper", children: [
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
812
|
+
"img",
|
|
813
|
+
{
|
|
814
|
+
style: {
|
|
815
|
+
color: "#fff",
|
|
816
|
+
width: "24px",
|
|
817
|
+
height: "24px",
|
|
818
|
+
filter: "invert(1)"
|
|
819
|
+
},
|
|
820
|
+
alt: "directions",
|
|
821
|
+
src: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItZ3JpZCI+PHJlY3QgeD0iMyIgeT0iMyIgd2lkdGg9IjciIGhlaWdodD0iNyI+PC9yZWN0PjxyZWN0IHg9IjE0IiB5PSIzIiB3aWR0aD0iNyIgaGVpZ2h0PSI3Ij48L3JlY3Q+PHJlY3QgeD0iMTQiIHk9IjE0IiB3aWR0aD0iNyIgaGVpZ2h0PSI3Ij48L3JlY3Q+PHJlY3QgeD0iMyIgeT0iMTQiIHdpZHRoPSI3IiBoZWlnaHQ9IjciPjwvcmVjdD48L3N2Zz4="
|
|
822
|
+
}
|
|
823
|
+
),
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
825
|
+
"img",
|
|
826
|
+
{
|
|
827
|
+
className: "r-reset r-category-chevron",
|
|
828
|
+
alt: "directions",
|
|
829
|
+
src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIiIGhlaWdodD0iMTMiIHZpZXdCb3g9IjAgMCAyMiAxMyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIxIDExLjVMMTEgMS41TDEgMTEuNSIgc3Ryb2tlPSIjMEMwQTA5IiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg=="
|
|
830
|
+
}
|
|
831
|
+
)
|
|
832
|
+
] });
|
|
833
|
+
var Title2 = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "r-categories-title", children: "Categories" });
|
|
834
|
+
var CategoriesInner = (_a) => {
|
|
835
|
+
var props = __objRest2(_a, []);
|
|
836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadProps2(__spreadValues2({}, props), { className: "r-reset r-categories-inner" }));
|
|
837
|
+
};
|
|
838
|
+
var CategoriesHiddenMenu = ({ paths }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "r-reset r-categories-hidden-menu", children: paths.map(({ title, link }, idx) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("a", { href: link, className: "r-reset r-category-link", children: title }, `${idx}-${link}`)) });
|
|
839
|
+
var CategoriesMenuWrapper = (_a) => {
|
|
840
|
+
var props = __objRest2(_a, []);
|
|
841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", __spreadValues2({ className: "r-reset r-categories-menu" }, props));
|
|
842
|
+
};
|
|
843
|
+
var CategoriesMenu = ({ paths }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CategoriesMenuWrapper, { children: [
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CategoriesInner, { children: [
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconsWrapper, {}),
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Title2, {})
|
|
847
|
+
] }),
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CategoriesHiddenMenu, { paths })
|
|
849
|
+
] });
|
|
850
|
+
var CategoriesMenu_default = CategoriesMenu;
|
|
778
851
|
}
|
|
779
852
|
});
|
|
780
853
|
|
|
@@ -863,7 +936,7 @@ var MainNavigation = ({ items, tab, onTab, onChange }) => /* @__PURE__ */ (0, im
|
|
|
863
936
|
TabButton,
|
|
864
937
|
{
|
|
865
938
|
type: "button",
|
|
866
|
-
active: idx === tab,
|
|
939
|
+
active: (idx === tab).toString(),
|
|
867
940
|
onClick: () => onTab(idx),
|
|
868
941
|
children: item.label
|
|
869
942
|
}
|
|
@@ -937,7 +1010,7 @@ function Delete(_a) {
|
|
|
937
1010
|
viewBox: "0 0 24 24",
|
|
938
1011
|
fill: "none",
|
|
939
1012
|
stroke: "#000",
|
|
940
|
-
|
|
1013
|
+
strokeWidth: "2",
|
|
941
1014
|
strokeLinecap: "round",
|
|
942
1015
|
strokeLinejoin: "round"
|
|
943
1016
|
}, rest), {
|
|
@@ -967,7 +1040,7 @@ function Copy(_a) {
|
|
|
967
1040
|
viewBox: "0 0 24 24",
|
|
968
1041
|
fill: "none",
|
|
969
1042
|
stroke: "#000",
|
|
970
|
-
|
|
1043
|
+
strokeWidth: "2",
|
|
971
1044
|
strokeLinecap: "round",
|
|
972
1045
|
strokeLinejoin: "round"
|
|
973
1046
|
}, rest), {
|
|
@@ -1084,9 +1157,27 @@ var import_react_sortablejs2 = require("react-sortablejs");
|
|
|
1084
1157
|
var import_react4 = __toESM(require("react"));
|
|
1085
1158
|
var import_ui4 = __toESM(require_dist());
|
|
1086
1159
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1087
|
-
|
|
1160
|
+
function checkForChanges(hasChanges, onClose) {
|
|
1161
|
+
if (!hasChanges) {
|
|
1162
|
+
onClose();
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
if (!confirm(
|
|
1166
|
+
"You\u2019ve made changes to the widget. Are you sure you want to cancel?"
|
|
1167
|
+
))
|
|
1168
|
+
return;
|
|
1169
|
+
onClose();
|
|
1170
|
+
}
|
|
1171
|
+
var AdminWidget = ({
|
|
1172
|
+
Component,
|
|
1173
|
+
settings,
|
|
1174
|
+
onChange,
|
|
1175
|
+
handleChanges,
|
|
1176
|
+
onCancel
|
|
1177
|
+
}) => {
|
|
1088
1178
|
const [state, setState] = import_react4.default.useState(settings);
|
|
1089
1179
|
const Form = Component.admin;
|
|
1180
|
+
const areChanges = JSON.stringify(state) !== JSON.stringify(settings);
|
|
1090
1181
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
1091
1182
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1092
1183
|
Form,
|
|
@@ -1094,6 +1185,7 @@ var AdminWidget = ({ Component, settings, onChange, onCancel }) => {
|
|
|
1094
1185
|
settings: state,
|
|
1095
1186
|
onChange: (key, value) => {
|
|
1096
1187
|
setState(__spreadValues(__spreadValues({}, state), { [key]: value }));
|
|
1188
|
+
handleChanges(__spreadValues(__spreadValues({}, state), { [key]: value }));
|
|
1097
1189
|
}
|
|
1098
1190
|
}
|
|
1099
1191
|
),
|
|
@@ -1106,7 +1198,14 @@ var AdminWidget = ({ Component, settings, onChange, onCancel }) => {
|
|
|
1106
1198
|
children: "Save"
|
|
1107
1199
|
}
|
|
1108
1200
|
),
|
|
1109
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1201
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1202
|
+
import_ui4.Button,
|
|
1203
|
+
{
|
|
1204
|
+
variant: "secondary",
|
|
1205
|
+
onClick: () => checkForChanges(areChanges, onCancel),
|
|
1206
|
+
children: "Cancel"
|
|
1207
|
+
}
|
|
1208
|
+
)
|
|
1110
1209
|
] });
|
|
1111
1210
|
};
|
|
1112
1211
|
var AdminWidget_default = AdminWidget;
|
|
@@ -1147,6 +1246,7 @@ var ContentBuilder = ({ value, onChange }) => {
|
|
|
1147
1246
|
});
|
|
1148
1247
|
const [open, setOpen] = import_react6.default.useState(false);
|
|
1149
1248
|
const [state, setState] = import_react6.default.useState(value);
|
|
1249
|
+
const [areChanges, setAreChanges] = import_react6.default.useState(false);
|
|
1150
1250
|
(0, import_react6.useEffect)(() => {
|
|
1151
1251
|
setState(value);
|
|
1152
1252
|
}, [value]);
|
|
@@ -1172,7 +1272,10 @@ var ContentBuilder = ({ value, onChange }) => {
|
|
|
1172
1272
|
setState(newState);
|
|
1173
1273
|
onChange(newState);
|
|
1174
1274
|
};
|
|
1175
|
-
const closeWidget = () =>
|
|
1275
|
+
const closeWidget = () => {
|
|
1276
|
+
setWidget({ open: false, current: null });
|
|
1277
|
+
setAreChanges(false);
|
|
1278
|
+
};
|
|
1176
1279
|
const updateWidget = (widget2, settings) => {
|
|
1177
1280
|
const newState = __spreadProps(__spreadValues({}, state), {
|
|
1178
1281
|
widgets: update(state.widgets, __spreadProps(__spreadValues({}, widget2), { settings }))
|
|
@@ -1181,6 +1284,7 @@ var ContentBuilder = ({ value, onChange }) => {
|
|
|
1181
1284
|
setState(newState);
|
|
1182
1285
|
onChange(newState);
|
|
1183
1286
|
};
|
|
1287
|
+
const handleChanges = (settings) => setAreChanges(widget.current.settings !== settings);
|
|
1184
1288
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(WidgetContext_default.Consumer, { children: (WIDGETS) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react6.default.Fragment, { children: [
|
|
1185
1289
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1186
1290
|
import_react_sortablejs2.ReactSortable,
|
|
@@ -1216,15 +1320,25 @@ var ContentBuilder = ({ value, onChange }) => {
|
|
|
1216
1320
|
}
|
|
1217
1321
|
),
|
|
1218
1322
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ui6.Button, { variant: "secondary", onClick: () => setOpen(true), children: "Add widget" }),
|
|
1219
|
-
widget.open && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1220
|
-
|
|
1323
|
+
widget.open && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1324
|
+
import_ui6.Modal,
|
|
1221
1325
|
{
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1326
|
+
title: "Settings",
|
|
1327
|
+
open: widget.open,
|
|
1328
|
+
areChanges,
|
|
1329
|
+
onClose: closeWidget,
|
|
1330
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1331
|
+
AdminWidget_default,
|
|
1332
|
+
{
|
|
1333
|
+
Component: getWidget(WIDGETS, widget.current.component),
|
|
1334
|
+
settings: widget.current.settings,
|
|
1335
|
+
onChange: (settings) => updateWidget(widget.current, settings),
|
|
1336
|
+
handleChanges,
|
|
1337
|
+
onCancel: closeWidget
|
|
1338
|
+
}
|
|
1339
|
+
)
|
|
1226
1340
|
}
|
|
1227
|
-
)
|
|
1341
|
+
),
|
|
1228
1342
|
open && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1229
1343
|
AddWidget_default,
|
|
1230
1344
|
{
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raketa-builder/menu-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"lint": "TIMING=1 eslint \"**/*.js\"",
|
|
9
8
|
"build": "tsup src/index.js --format cjs --loader \".js=jsx\"",
|
|
10
|
-
"dev": "tsup src/index.js --format cjs --loader \".js=jsx\" --watch"
|
|
9
|
+
"dev": "tsup src/index.js --format cjs --loader \".js=jsx\" --watch",
|
|
10
|
+
"format": "prettier --write .",
|
|
11
|
+
"lint": "biome lint --max-diagnostics=5000 ."
|
|
11
12
|
},
|
|
12
13
|
"peerDependencies": {
|
|
13
14
|
"react": "18.2.0",
|
|
@@ -18,10 +19,10 @@
|
|
|
18
19
|
"ui": "*"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
22
|
+
"@biomejs/biome": "1.5.2",
|
|
21
23
|
"@types/react": "17.0.37",
|
|
22
24
|
"@types/react-dom": "17.0.11",
|
|
23
|
-
"
|
|
24
|
-
"eslint-config-custom": "*",
|
|
25
|
+
"prettier": "3.2.4",
|
|
25
26
|
"react": "18.2.0",
|
|
26
27
|
"tsconfig": "*",
|
|
27
28
|
"tsup": "6.5.0",
|
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Button } from "@raketa-builder/ui";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function checkForChanges(hasChanges, onClose) {
|
|
5
|
+
if (!hasChanges) {
|
|
6
|
+
onClose();
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (
|
|
11
|
+
!confirm(
|
|
12
|
+
"You’ve made changes to the widget. Are you sure you want to cancel?"
|
|
13
|
+
)
|
|
14
|
+
)
|
|
15
|
+
return;
|
|
16
|
+
|
|
17
|
+
onClose();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const AdminWidget = ({
|
|
21
|
+
Component,
|
|
22
|
+
settings,
|
|
23
|
+
onChange,
|
|
24
|
+
handleChanges,
|
|
25
|
+
onCancel,
|
|
26
|
+
}) => {
|
|
5
27
|
const [state, setState] = React.useState(settings);
|
|
6
28
|
const Form = Component.admin;
|
|
7
29
|
|
|
30
|
+
const areChanges = JSON.stringify(state) !== JSON.stringify(settings);
|
|
31
|
+
|
|
8
32
|
return (
|
|
9
33
|
<div>
|
|
10
34
|
<Form
|
|
11
35
|
settings={state}
|
|
12
36
|
onChange={(key, value) => {
|
|
13
37
|
setState({ ...state, ...{ [key]: value } });
|
|
38
|
+
handleChanges({ ...state, ...{ [key]: value } });
|
|
14
39
|
}}
|
|
15
40
|
/>
|
|
16
41
|
|
|
@@ -21,7 +46,10 @@ const AdminWidget = ({ Component, settings, onChange, onCancel }) => {
|
|
|
21
46
|
>
|
|
22
47
|
Save
|
|
23
48
|
</Button>
|
|
24
|
-
<Button
|
|
49
|
+
<Button
|
|
50
|
+
variant="secondary"
|
|
51
|
+
onClick={() => checkForChanges(areChanges, onCancel)}
|
|
52
|
+
>
|
|
25
53
|
Cancel
|
|
26
54
|
</Button>
|
|
27
55
|
</div>
|
|
@@ -31,6 +31,7 @@ const ContentBuilder = ({ value, onChange }) => {
|
|
|
31
31
|
});
|
|
32
32
|
const [open, setOpen] = React.useState(false);
|
|
33
33
|
const [state, setState] = React.useState(value);
|
|
34
|
+
const [areChanges, setAreChanges] = React.useState(false);
|
|
34
35
|
|
|
35
36
|
useEffect(() => {
|
|
36
37
|
setState(value);
|
|
@@ -66,7 +67,10 @@ const ContentBuilder = ({ value, onChange }) => {
|
|
|
66
67
|
onChange(newState);
|
|
67
68
|
};
|
|
68
69
|
|
|
69
|
-
const closeWidget = () =>
|
|
70
|
+
const closeWidget = () => {
|
|
71
|
+
setWidget({ open: false, current: null });
|
|
72
|
+
setAreChanges(false);
|
|
73
|
+
};
|
|
70
74
|
|
|
71
75
|
const updateWidget = (widget, settings) => {
|
|
72
76
|
const newState = {
|
|
@@ -79,6 +83,9 @@ const ContentBuilder = ({ value, onChange }) => {
|
|
|
79
83
|
onChange(newState);
|
|
80
84
|
};
|
|
81
85
|
|
|
86
|
+
const handleChanges = (settings) =>
|
|
87
|
+
setAreChanges(widget.current.settings !== settings);
|
|
88
|
+
|
|
82
89
|
return (
|
|
83
90
|
<WidgetContext.Consumer>
|
|
84
91
|
{(WIDGETS) => (
|
|
@@ -121,11 +128,17 @@ const ContentBuilder = ({ value, onChange }) => {
|
|
|
121
128
|
</Button>
|
|
122
129
|
|
|
123
130
|
{widget.open && (
|
|
124
|
-
<Modal
|
|
131
|
+
<Modal
|
|
132
|
+
title="Settings"
|
|
133
|
+
open={widget.open}
|
|
134
|
+
areChanges={areChanges}
|
|
135
|
+
onClose={closeWidget}
|
|
136
|
+
>
|
|
125
137
|
<AdminWidget
|
|
126
138
|
Component={getWidget(WIDGETS, widget.current.component)}
|
|
127
139
|
settings={widget.current.settings}
|
|
128
140
|
onChange={(settings) => updateWidget(widget.current, settings)}
|
|
141
|
+
handleChanges={handleChanges}
|
|
129
142
|
onCancel={closeWidget}
|
|
130
143
|
/>
|
|
131
144
|
</Modal>
|
package/src/MenuBuilder/icons.js
CHANGED
|
@@ -50,7 +50,7 @@ export function Delete({ className, ...rest }) {
|
|
|
50
50
|
viewBox="0 0 24 24"
|
|
51
51
|
fill="none"
|
|
52
52
|
stroke="#000"
|
|
53
|
-
|
|
53
|
+
strokeWidth="2"
|
|
54
54
|
strokeLinecap="round"
|
|
55
55
|
strokeLinejoin="round"
|
|
56
56
|
{...rest}
|
|
@@ -78,7 +78,7 @@ export function Plus({ className, ...rest }) {
|
|
|
78
78
|
viewBox="0 0 24 24"
|
|
79
79
|
fill="none"
|
|
80
80
|
stroke="#000"
|
|
81
|
-
|
|
81
|
+
strokeWidth="2"
|
|
82
82
|
strokeLinecap="round"
|
|
83
83
|
strokeLinejoin="round"
|
|
84
84
|
{...rest}
|
|
@@ -106,7 +106,7 @@ export function Copy({ className, ...rest }) {
|
|
|
106
106
|
viewBox="0 0 24 24"
|
|
107
107
|
fill="none"
|
|
108
108
|
stroke="#000"
|
|
109
|
-
|
|
109
|
+
strokeWidth="2"
|
|
110
110
|
strokeLinecap="round"
|
|
111
111
|
strokeLinejoin="round"
|
|
112
112
|
{...rest}
|
package/src/styles.css
CHANGED
package/tsconfig.json
CHANGED