@raketa-builder/builder 1.6.9 → 1.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/dist/PageBuilder.js +15 -4
- package/dist/dialogs/ReorderDialog.js +9 -3
- package/dist/lib/ModalSelectedWidgetsToolbar.js +22 -14
- package/package.json +4 -4
- package/dist/icons/IconCopy.js +0 -41
- package/dist/icons/IconDelete.js +0 -48
- package/dist/icons/index.js +0 -3
- package/dist/lib/SelectedWidgetsToolbar.js +0 -36
package/dist/PageBuilder.js
CHANGED
|
@@ -9,7 +9,7 @@ import AdminSidebar from './lib/AdminSidebar';
|
|
|
9
9
|
import ReorderDialog from './dialogs/ReorderDialog';
|
|
10
10
|
import SettingsDialog from './dialogs/SettingsDialog';
|
|
11
11
|
import widgetData from './helpers/widgetData';
|
|
12
|
-
import SelectedWidgetsToolbar from '
|
|
12
|
+
import { validateButtons, SelectedWidgetsToolbar } from '@raketa-builder/support';
|
|
13
13
|
import Notification from './AutoSaveNotification';
|
|
14
14
|
|
|
15
15
|
const usePreventWindowUnload = (preventDefault) => {
|
|
@@ -57,6 +57,7 @@ const PageBuilder = ({
|
|
|
57
57
|
languageSwitcherSettings,
|
|
58
58
|
identifier,
|
|
59
59
|
sidebarButtons,
|
|
60
|
+
selectedWidgetsButtons = [],
|
|
60
61
|
host,
|
|
61
62
|
wrapWidget = true,
|
|
62
63
|
onChange,
|
|
@@ -68,6 +69,10 @@ const PageBuilder = ({
|
|
|
68
69
|
}) => {
|
|
69
70
|
const [page, setPage] = React.useState(initialPage);
|
|
70
71
|
const [preloadedData, setPreloadedData] = React.useState(preloaded);
|
|
72
|
+
React.useMemo(
|
|
73
|
+
() => validateButtons(selectedWidgetsButtons),
|
|
74
|
+
[selectedWidgetsButtons]
|
|
75
|
+
);
|
|
71
76
|
const [pageHistory, setPageHistory] = React.useState([initialPage]);
|
|
72
77
|
const [historyIndex, setHistoryIndex] = React.useState(0);
|
|
73
78
|
const [selectedWidget, setSelectedWidget] = React.useState(null);
|
|
@@ -308,15 +313,19 @@ const PageBuilder = ({
|
|
|
308
313
|
!reorderOpen && selectedWidgets.length > 0 && /* @__PURE__ */ jsx(
|
|
309
314
|
SelectedWidgetsToolbar,
|
|
310
315
|
{
|
|
311
|
-
|
|
316
|
+
selectedWidgets,
|
|
317
|
+
widgets,
|
|
318
|
+
buttons: selectedWidgetsButtons,
|
|
312
319
|
onCopy: () => handleCopyWidgets(selectedWidgets, "multiple"),
|
|
313
|
-
onRemove: handleRemoveMultiple
|
|
320
|
+
onRemove: handleRemoveMultiple,
|
|
321
|
+
onDeselect: () => setSelectedWidgets([])
|
|
314
322
|
}
|
|
315
323
|
),
|
|
316
324
|
reorderOpen && /* @__PURE__ */ jsx(
|
|
317
325
|
ReorderDialog,
|
|
318
326
|
{
|
|
319
327
|
widgets: sortableWidgets,
|
|
328
|
+
rawWidgets: widgets,
|
|
320
329
|
onChange: handleReorder,
|
|
321
330
|
onDelete: handleRemove,
|
|
322
331
|
onSelectWidget: setSelectedWidget,
|
|
@@ -325,7 +334,9 @@ const PageBuilder = ({
|
|
|
325
334
|
onSelectWidgets: handleSelectWidget,
|
|
326
335
|
onCopy: () => handleCopyWidgets(selectedWidgets, "multiple"),
|
|
327
336
|
onRemove: handleRemoveMultiple,
|
|
328
|
-
onSelectAll: handleSelectAll
|
|
337
|
+
onSelectAll: handleSelectAll,
|
|
338
|
+
buttons: selectedWidgetsButtons,
|
|
339
|
+
onDeselect: () => setSelectedWidgets([])
|
|
329
340
|
}
|
|
330
341
|
),
|
|
331
342
|
/* @__PURE__ */ jsx(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __objRest, __spreadValues } from '../chunk-BBZEL7EG.js';
|
|
2
|
-
import { jsxs,
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ReactSortable } from 'react-sortablejs';
|
|
5
5
|
import { P, H, Button, cn } from '@raketa-builder/ui';
|
|
@@ -35,6 +35,7 @@ const getWidgetTitle = (library, widget) => {
|
|
|
35
35
|
};
|
|
36
36
|
const ReorderDialog = ({
|
|
37
37
|
widgets = [],
|
|
38
|
+
rawWidgets = [],
|
|
38
39
|
onClose,
|
|
39
40
|
onChange,
|
|
40
41
|
onDelete,
|
|
@@ -43,7 +44,9 @@ const ReorderDialog = ({
|
|
|
43
44
|
onSelectWidgets,
|
|
44
45
|
onCopy,
|
|
45
46
|
onRemove,
|
|
46
|
-
onSelectAll
|
|
47
|
+
onSelectAll,
|
|
48
|
+
buttons = [],
|
|
49
|
+
onDeselect
|
|
47
50
|
}) => {
|
|
48
51
|
const { adminLibrary } = React.useContext(LibraryContext);
|
|
49
52
|
const isSelected = (id) => selectedWidgets.filter((w) => w === id).length > 0;
|
|
@@ -68,10 +71,13 @@ const ReorderDialog = ({
|
|
|
68
71
|
ModalSelectedWidgetsToolbar,
|
|
69
72
|
{
|
|
70
73
|
selectedWidgets,
|
|
74
|
+
widgets: rawWidgets,
|
|
71
75
|
onSelectAll: handleSelectAll,
|
|
72
76
|
areAllSelected,
|
|
73
77
|
onCopy,
|
|
74
|
-
onRemove
|
|
78
|
+
onRemove,
|
|
79
|
+
buttons,
|
|
80
|
+
onDeselect
|
|
75
81
|
}
|
|
76
82
|
)
|
|
77
83
|
] }) : /* @__PURE__ */ jsx(P, { children: "It's always good to start with a clean slate. Use the sidebar to add content." }),
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import '../chunk-BBZEL7EG.js';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
4
|
+
import { SelectedWidgetsButtons } from '@raketa-builder/support';
|
|
4
5
|
|
|
6
|
+
const BUTTON_CLASS_NAME = "r-button-reset r-reset r-heading r-fs-base r-button-toolbar-reorder";
|
|
5
7
|
const ModalSelectedWidgetsToolbar = ({
|
|
6
|
-
selectedWidgets,
|
|
8
|
+
selectedWidgets = [],
|
|
9
|
+
widgets = [],
|
|
10
|
+
buttons = [],
|
|
7
11
|
onSelectAll,
|
|
8
12
|
areAllSelected,
|
|
9
13
|
onCopy,
|
|
10
|
-
onRemove
|
|
14
|
+
onRemove,
|
|
15
|
+
onDeselect
|
|
11
16
|
}) => /* @__PURE__ */ jsxs("div", { className: "r-selected-widget-toolbar-reorder", children: [
|
|
12
17
|
/* @__PURE__ */ jsxs(
|
|
13
18
|
"label",
|
|
@@ -34,24 +39,27 @@ const ModalSelectedWidgetsToolbar = ({
|
|
|
34
39
|
}
|
|
35
40
|
),
|
|
36
41
|
selectedWidgets.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
|
-
/* @__PURE__ */ jsxs(
|
|
38
|
-
"
|
|
42
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: BUTTON_CLASS_NAME, onClick: onCopy, children: [
|
|
43
|
+
"Copy selected (",
|
|
44
|
+
selectedWidgets.length,
|
|
45
|
+
")"
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
|
+
SelectedWidgetsButtons,
|
|
39
49
|
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
")"
|
|
47
|
-
]
|
|
50
|
+
buttons,
|
|
51
|
+
selectedWidgets,
|
|
52
|
+
widgets,
|
|
53
|
+
buttonClassName: BUTTON_CLASS_NAME,
|
|
54
|
+
showIcons: false,
|
|
55
|
+
onDeselect
|
|
48
56
|
}
|
|
49
57
|
),
|
|
50
|
-
/* @__PURE__ */ jsx(
|
|
58
|
+
onRemove && /* @__PURE__ */ jsx(
|
|
51
59
|
"button",
|
|
52
60
|
{
|
|
53
61
|
type: "button",
|
|
54
|
-
className:
|
|
62
|
+
className: BUTTON_CLASS_NAME,
|
|
55
63
|
onClick: onRemove,
|
|
56
64
|
children: "Delete selected"
|
|
57
65
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raketa-builder/builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"import": {
|
|
12
|
-
"types": "./dist/index.d.
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
13
|
"default": "./dist/index.js"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"react-sortablejs": "6.1.4",
|
|
39
|
-
"@raketa-builder/support": "1.
|
|
40
|
-
"@raketa-builder/ui": "1.
|
|
39
|
+
"@raketa-builder/support": "1.8.0",
|
|
40
|
+
"@raketa-builder/ui": "1.8.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@biomejs/biome": "2.1.2",
|
package/dist/icons/IconCopy.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import '../chunk-BBZEL7EG.js';
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
const IconCopy = () => /* @__PURE__ */ jsxs(
|
|
5
|
-
"svg",
|
|
6
|
-
{
|
|
7
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
-
width: "16",
|
|
9
|
-
height: "16",
|
|
10
|
-
viewBox: "0 0 16 16",
|
|
11
|
-
fill: "none",
|
|
12
|
-
children: [
|
|
13
|
-
/* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_2312_498)", children: [
|
|
14
|
-
/* @__PURE__ */ jsx(
|
|
15
|
-
"path",
|
|
16
|
-
{
|
|
17
|
-
d: "M13.3334 5.33331H6.66671C5.93033 5.33331 5.33337 5.93027 5.33337 6.66665V13.3333C5.33337 14.0697 5.93033 14.6666 6.66671 14.6666H13.3334C14.0698 14.6666 14.6667 14.0697 14.6667 13.3333V6.66665C14.6667 5.93027 14.0698 5.33331 13.3334 5.33331Z",
|
|
18
|
-
stroke: "white",
|
|
19
|
-
strokeWidth: "2",
|
|
20
|
-
strokeLinecap: "round",
|
|
21
|
-
strokeLinejoin: "round"
|
|
22
|
-
}
|
|
23
|
-
),
|
|
24
|
-
/* @__PURE__ */ jsx(
|
|
25
|
-
"path",
|
|
26
|
-
{
|
|
27
|
-
d: "M2.66671 10.6666C1.93337 10.6666 1.33337 10.0666 1.33337 9.33331V2.66665C1.33337 1.93331 1.93337 1.33331 2.66671 1.33331H9.33337C10.0667 1.33331 10.6667 1.93331 10.6667 2.66665",
|
|
28
|
-
stroke: "white",
|
|
29
|
-
strokeWidth: "2",
|
|
30
|
-
strokeLinecap: "round",
|
|
31
|
-
strokeLinejoin: "round"
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
] }),
|
|
35
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_2312_498", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
var IconCopy_default = IconCopy;
|
|
40
|
-
|
|
41
|
-
export { IconCopy_default as default };
|
package/dist/icons/IconDelete.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import '../chunk-BBZEL7EG.js';
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
const IconDelete = () => /* @__PURE__ */ jsxs(
|
|
5
|
-
"svg",
|
|
6
|
-
{
|
|
7
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
-
width: "16",
|
|
9
|
-
height: "16",
|
|
10
|
-
viewBox: "0 0 16 16",
|
|
11
|
-
fill: "none",
|
|
12
|
-
children: [
|
|
13
|
-
/* @__PURE__ */ jsx(
|
|
14
|
-
"path",
|
|
15
|
-
{
|
|
16
|
-
d: "M2 4H14",
|
|
17
|
-
stroke: "white",
|
|
18
|
-
strokeWidth: "2",
|
|
19
|
-
strokeLinecap: "round",
|
|
20
|
-
strokeLinejoin: "round"
|
|
21
|
-
}
|
|
22
|
-
),
|
|
23
|
-
/* @__PURE__ */ jsx(
|
|
24
|
-
"path",
|
|
25
|
-
{
|
|
26
|
-
d: "M12.6667 4V13.3333C12.6667 14 12 14.6667 11.3334 14.6667H4.66671C4.00004 14.6667 3.33337 14 3.33337 13.3333V4",
|
|
27
|
-
stroke: "white",
|
|
28
|
-
strokeWidth: "2",
|
|
29
|
-
strokeLinecap: "round",
|
|
30
|
-
strokeLinejoin: "round"
|
|
31
|
-
}
|
|
32
|
-
),
|
|
33
|
-
/* @__PURE__ */ jsx(
|
|
34
|
-
"path",
|
|
35
|
-
{
|
|
36
|
-
d: "M5.33337 3.99998V2.66665C5.33337 1.99998 6.00004 1.33331 6.66671 1.33331H9.33337C10 1.33331 10.6667 1.99998 10.6667 2.66665V3.99998",
|
|
37
|
-
stroke: "white",
|
|
38
|
-
strokeWidth: "2",
|
|
39
|
-
strokeLinecap: "round",
|
|
40
|
-
strokeLinejoin: "round"
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
var IconDelete_default = IconDelete;
|
|
47
|
-
|
|
48
|
-
export { IconDelete_default as default };
|
package/dist/icons/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import '../chunk-BBZEL7EG.js';
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import 'react';
|
|
4
|
-
import { IconCopy, IconDelete } from '../icons';
|
|
5
|
-
|
|
6
|
-
const SelectedWidgetsToolbar = ({ length, onRemove, onCopy }) => /* @__PURE__ */ jsx("div", { className: "r-selected-widgets-toolbar", children: /* @__PURE__ */ jsxs("div", { className: "r-toolbar-inner", children: [
|
|
7
|
-
/* @__PURE__ */ jsxs(
|
|
8
|
-
"button",
|
|
9
|
-
{
|
|
10
|
-
type: "button",
|
|
11
|
-
className: "r-button-reset r-toolbar-button r-toolbar-button-copy",
|
|
12
|
-
onClick: onCopy,
|
|
13
|
-
children: [
|
|
14
|
-
/* @__PURE__ */ jsx(IconCopy, {}),
|
|
15
|
-
"Copy selected (",
|
|
16
|
-
length,
|
|
17
|
-
")"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
),
|
|
21
|
-
/* @__PURE__ */ jsxs(
|
|
22
|
-
"button",
|
|
23
|
-
{
|
|
24
|
-
type: "button",
|
|
25
|
-
className: "r-button-reset r-toolbar-button r-toolbar-button-delete",
|
|
26
|
-
onClick: onRemove,
|
|
27
|
-
children: [
|
|
28
|
-
/* @__PURE__ */ jsx(IconDelete, {}),
|
|
29
|
-
"Delete selected"
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
)
|
|
33
|
-
] }) });
|
|
34
|
-
var SelectedWidgetsToolbar_default = SelectedWidgetsToolbar;
|
|
35
|
-
|
|
36
|
-
export { SelectedWidgetsToolbar_default as default };
|