@raketa-builder/menu-builder 0.8.0 → 1.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/menu-builder",
3
- "version": "0.8.0",
3
+ "version": "1.0.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { Button } from "@raketa-builder/ui";
3
+ import { AdminForm } from "@raketa-builder/builder";
3
4
 
4
5
  function checkForChanges(hasChanges, onClose) {
5
6
  if (!hasChanges) {
@@ -18,24 +19,33 @@ function checkForChanges(hasChanges, onClose) {
18
19
  }
19
20
 
20
21
  const AdminWidget = ({
21
- Component,
22
+ widget,
22
23
  settings,
23
24
  onChange,
24
25
  handleChanges,
25
26
  onCancel,
26
27
  }) => {
27
28
  const [state, setState] = React.useState(settings);
28
- const Form = Component.admin;
29
29
 
30
30
  const areChanges = JSON.stringify(state) !== JSON.stringify(settings);
31
31
 
32
+ const schema = widget.admin;
33
+
34
+ if (typeof schema !== "object") {
35
+ console.warn(
36
+ `Legacy widget with React admin definition: "${widget.name}". Update to schema defined inputs!`
37
+ );
38
+ }
39
+
32
40
  return (
33
41
  <div>
34
- <Form
35
- settings={state}
36
- onChange={(key, value) => {
37
- setState({ ...state, ...{ [key]: value } });
38
- handleChanges({ ...state, ...{ [key]: value } });
42
+ <AdminForm
43
+ schema={schema}
44
+ value={state}
45
+ onChange={(newState) => {
46
+ console.log({ newState });
47
+ setState({ ...newState });
48
+ handleChanges({ ...newState });
39
49
  }}
40
50
  />
41
51
 
@@ -135,7 +135,7 @@ const ContentBuilder = ({ value, onChange }) => {
135
135
  onClose={closeWidget}
136
136
  >
137
137
  <AdminWidget
138
- Component={getWidget(WIDGETS, widget.current.component)}
138
+ widget={getWidget(WIDGETS, widget.current.component)}
139
139
  settings={widget.current.settings}
140
140
  onChange={(settings) => updateWidget(widget.current, settings)}
141
141
  handleChanges={handleChanges}
@@ -1,11 +0,0 @@
1
-
2
- > @raketa-builder/menu-builder@0.8.0 build
3
- > tsup src/index.js --format cjs --loader ".js=jsx"
4
-
5
- CLI Building entry: src/index.js
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v6.5.0
8
- CLI Target: es6
9
- CJS Build start
10
- CJS dist/index.js 63.14 KB
11
- CJS ⚡️ Build success in 275ms
@@ -1,23 +0,0 @@
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
@@ -1,243 +0,0 @@
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