@raketa-builder/builder 1.1.6 → 1.2.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/dist/index.js +86 -64
- package/package.json +13 -13
- package/src/AdminForm/index.js +11 -1
- package/src/PageBuilder.js +8 -0
- package/src/lib/AdminSidebar.js +2 -0
- package/src/lib/SideNav.js +39 -15
package/dist/index.js
CHANGED
|
@@ -47,6 +47,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
47
47
|
return to;
|
|
48
48
|
};
|
|
49
49
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
50
54
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
51
55
|
mod
|
|
52
56
|
));
|
|
@@ -73,8 +77,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
// src/index.js
|
|
76
|
-
var
|
|
77
|
-
__export(
|
|
80
|
+
var index_exports = {};
|
|
81
|
+
__export(index_exports, {
|
|
78
82
|
AdminForm: () => AdminForm_default,
|
|
79
83
|
BuilderContext: () => BuilderContext_default,
|
|
80
84
|
Button: () => Button_default,
|
|
@@ -93,7 +97,7 @@ __export(src_exports, {
|
|
|
93
97
|
TextArea: () => TextArea_default,
|
|
94
98
|
TextInput: () => TextInput_default
|
|
95
99
|
});
|
|
96
|
-
module.exports = __toCommonJS(
|
|
100
|
+
module.exports = __toCommonJS(index_exports);
|
|
97
101
|
var import_ui20 = require("@raketa-builder/ui");
|
|
98
102
|
|
|
99
103
|
// src/PageBuilder.js
|
|
@@ -278,8 +282,7 @@ var AdminWidget = ({
|
|
|
278
282
|
const isSelected = selectedWidgets.filter((w) => w === widget.widgetId).length > 0;
|
|
279
283
|
const handleSelectWidget = () => onSelectWidget(widget.widgetId);
|
|
280
284
|
const handleDeleteWidget = () => {
|
|
281
|
-
if (!confirm("Are you sure?"))
|
|
282
|
-
return;
|
|
285
|
+
if (!confirm("Are you sure?")) return;
|
|
283
286
|
onDelete(widget.widgetId);
|
|
284
287
|
};
|
|
285
288
|
const handleCopyWidget = () => {
|
|
@@ -370,8 +373,7 @@ var ErrorBoundary = class extends import_react5.Component {
|
|
|
370
373
|
console.error(error, info);
|
|
371
374
|
}
|
|
372
375
|
render() {
|
|
373
|
-
if (this.state.hasError)
|
|
374
|
-
return null;
|
|
376
|
+
if (this.state.hasError) return null;
|
|
375
377
|
return this.props.children;
|
|
376
378
|
}
|
|
377
379
|
};
|
|
@@ -484,24 +486,47 @@ var NavButtonStyle = (_a) => {
|
|
|
484
486
|
"hasChanges"
|
|
485
487
|
]);
|
|
486
488
|
const backgroundColor = active ? "var(--r-darker-gray)" : success ? "var(--r-success)" : "transparent";
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
489
|
+
const _a2 = props, { clipboardCopiesCount } = _a2, otherProps = __objRest(_a2, ["clipboardCopiesCount"]);
|
|
490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
492
|
+
"div",
|
|
493
|
+
__spreadValues({
|
|
494
|
+
className: (0, import_ui6.cn)(
|
|
495
|
+
"r-reset",
|
|
496
|
+
"r-reset-button",
|
|
497
|
+
"r-fs-medium",
|
|
498
|
+
"r-admin-sidenav-button",
|
|
499
|
+
className
|
|
500
|
+
),
|
|
501
|
+
style: {
|
|
502
|
+
backgroundColor,
|
|
503
|
+
backgroundImage: icon ? `url(${icon})` : "",
|
|
504
|
+
opacity: hasChanges ? "" : "0.5",
|
|
505
|
+
cursor: hasChanges ? "pointer" : "not-allowed"
|
|
506
|
+
}
|
|
507
|
+
}, otherProps)
|
|
508
|
+
),
|
|
509
|
+
clipboardCopiesCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
510
|
+
"div",
|
|
511
|
+
{
|
|
512
|
+
style: {
|
|
513
|
+
position: "absolute",
|
|
514
|
+
bottom: "8px",
|
|
515
|
+
right: "5px",
|
|
516
|
+
backgroundColor: "#efefef",
|
|
517
|
+
color: "black",
|
|
518
|
+
width: "16px",
|
|
519
|
+
height: "16px",
|
|
520
|
+
borderRadius: "50%",
|
|
521
|
+
fontSize: "10px",
|
|
522
|
+
display: "flex",
|
|
523
|
+
alignItems: "center",
|
|
524
|
+
justifyContent: "center"
|
|
525
|
+
},
|
|
526
|
+
children: clipboardCopiesCount
|
|
502
527
|
}
|
|
503
|
-
|
|
504
|
-
);
|
|
528
|
+
)
|
|
529
|
+
] });
|
|
505
530
|
};
|
|
506
531
|
var TooltipWrapper = (_a) => {
|
|
507
532
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -713,10 +738,8 @@ var ICONS = {
|
|
|
713
738
|
var sortByTitle = (a, b) => {
|
|
714
739
|
var nameA = a.widgetTitle.toUpperCase();
|
|
715
740
|
var nameB = b.widgetTitle.toUpperCase();
|
|
716
|
-
if (nameA < nameB)
|
|
717
|
-
|
|
718
|
-
if (nameA > nameB)
|
|
719
|
-
return 1;
|
|
741
|
+
if (nameA < nameB) return -1;
|
|
742
|
+
if (nameA > nameB) return 1;
|
|
720
743
|
return 0;
|
|
721
744
|
};
|
|
722
745
|
var WidgetsList = ({ library, onAddWidget }) => {
|
|
@@ -764,7 +787,8 @@ var AdminSidebar = ({
|
|
|
764
787
|
pageHistory,
|
|
765
788
|
undoChanges,
|
|
766
789
|
redoChanges,
|
|
767
|
-
historyIndex
|
|
790
|
+
historyIndex,
|
|
791
|
+
clipboardCopiesCount
|
|
768
792
|
}) => {
|
|
769
793
|
const { adminLibrary } = import_react10.default.useContext(LibraryContext_default);
|
|
770
794
|
const activeUndo = historyIndex > 0;
|
|
@@ -791,7 +815,8 @@ var AdminSidebar = ({
|
|
|
791
815
|
{
|
|
792
816
|
tooltip: "Paste widget",
|
|
793
817
|
icon: ICONS.paste,
|
|
794
|
-
onClick: onPasteWidget
|
|
818
|
+
onClick: onPasteWidget,
|
|
819
|
+
clipboardCopiesCount
|
|
795
820
|
}
|
|
796
821
|
) }),
|
|
797
822
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NavItem, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -957,8 +982,7 @@ var ReorderDialogItem = (_a) => {
|
|
|
957
982
|
};
|
|
958
983
|
var cleanup = (string) => string.replace(/<[^>]*>?/gm, "");
|
|
959
984
|
var truncate = (str, num) => {
|
|
960
|
-
if (str.length <= num)
|
|
961
|
-
return str;
|
|
985
|
+
if (str.length <= num) return str;
|
|
962
986
|
return str.slice(0, num) + "\u2026";
|
|
963
987
|
};
|
|
964
988
|
var getWidgetTitle = (library, widget) => {
|
|
@@ -994,8 +1018,7 @@ var ReorderDialog = ({
|
|
|
994
1018
|
const areAllSelected = selectedWidgets.length === widgets.length;
|
|
995
1019
|
const handleSelectWidget = (id) => onSelectWidgets(id);
|
|
996
1020
|
const handleSelectAll = () => {
|
|
997
|
-
if (areAllSelected)
|
|
998
|
-
return onSelectAll([]);
|
|
1021
|
+
if (areAllSelected) return onSelectAll([]);
|
|
999
1022
|
onSelectAll(widgets.map((w) => w.widgetId));
|
|
1000
1023
|
};
|
|
1001
1024
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
@@ -1086,8 +1109,7 @@ var ReorderDialog = ({
|
|
|
1086
1109
|
type: "button",
|
|
1087
1110
|
variant: "danger",
|
|
1088
1111
|
onClick: () => {
|
|
1089
|
-
if (!confirm("Are you sure?"))
|
|
1090
|
-
return;
|
|
1112
|
+
if (!confirm("Are you sure?")) return;
|
|
1091
1113
|
onDelete(widget.widgetId);
|
|
1092
1114
|
},
|
|
1093
1115
|
children: "\xD7"
|
|
@@ -1127,8 +1149,7 @@ var import_ui18 = require("@raketa-builder/ui");
|
|
|
1127
1149
|
var toUnderscore = (string) => string.replace(/([A-Z])/g, ($1) => `_${$1.toLowerCase()}`);
|
|
1128
1150
|
var humanize = (string) => toUnderscore(string).replace(/_/g, " ");
|
|
1129
1151
|
var capitalize = (s) => {
|
|
1130
|
-
if (typeof s !== "string")
|
|
1131
|
-
return "";
|
|
1152
|
+
if (typeof s !== "string") return "";
|
|
1132
1153
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
1133
1154
|
};
|
|
1134
1155
|
|
|
@@ -1301,8 +1322,7 @@ var List = ({
|
|
|
1301
1322
|
}) => {
|
|
1302
1323
|
const [items, setItems] = import_react15.default.useState(defaultItems);
|
|
1303
1324
|
const factory = (template2) => {
|
|
1304
|
-
if (!template2)
|
|
1305
|
-
throw new Error("Template not specified for this list");
|
|
1325
|
+
if (!template2) throw new Error("Template not specified for this list");
|
|
1306
1326
|
return Object.assign({}, template2, { id: randomId() });
|
|
1307
1327
|
};
|
|
1308
1328
|
const handleChangeField = (idx, field, value) => {
|
|
@@ -1333,16 +1353,13 @@ var List = ({
|
|
|
1333
1353
|
notifyChange(items2);
|
|
1334
1354
|
};
|
|
1335
1355
|
const handleRemove = (idx) => {
|
|
1336
|
-
if (!template && items.length === 1)
|
|
1337
|
-
return;
|
|
1356
|
+
if (!template && items.length === 1) return;
|
|
1338
1357
|
const newItems = removeByIndex(items, idx);
|
|
1339
1358
|
setItems(newItems);
|
|
1340
1359
|
notifyChange(newItems);
|
|
1341
1360
|
};
|
|
1342
|
-
if (!primaryField2)
|
|
1343
|
-
|
|
1344
|
-
if (!label)
|
|
1345
|
-
console.warn("No label provided for a list", items);
|
|
1361
|
+
if (!primaryField2) console.warn("No primaryField provided for a list", items);
|
|
1362
|
+
if (!label) console.warn("No label provided for a list", items);
|
|
1346
1363
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(ListWrapper, { children: [
|
|
1347
1364
|
label && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui13.H, { size: "base", style: { fontWeight: 700 }, children: label }),
|
|
1348
1365
|
items.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui13.P, { children: "There are no items yet." }),
|
|
@@ -1783,11 +1800,19 @@ var FormField = ({ field, value, path, opts, onChange }) => {
|
|
|
1783
1800
|
label: opts.label,
|
|
1784
1801
|
value,
|
|
1785
1802
|
path,
|
|
1786
|
-
opts,
|
|
1803
|
+
opts: sanitezeOpts(opts),
|
|
1787
1804
|
onChange
|
|
1788
1805
|
}
|
|
1789
1806
|
);
|
|
1790
1807
|
};
|
|
1808
|
+
function sanitezeOpts(opts) {
|
|
1809
|
+
Object.keys(opts).forEach((key) => {
|
|
1810
|
+
if (key.toString().startsWith("_")) {
|
|
1811
|
+
delete opts[key];
|
|
1812
|
+
}
|
|
1813
|
+
});
|
|
1814
|
+
return opts;
|
|
1815
|
+
}
|
|
1791
1816
|
var AdminForm = ({ schema = {}, value = {}, onChange }) => {
|
|
1792
1817
|
return Object.keys(schema).map((field) => {
|
|
1793
1818
|
const opts = Object.assign(
|
|
@@ -2037,17 +2062,16 @@ var PageBuilder = ({
|
|
|
2037
2062
|
const [selectedWidget, setSelectedWidget] = import_react25.default.useState(null);
|
|
2038
2063
|
const [reorderOpen, setReorderOpen] = import_react25.default.useState(false);
|
|
2039
2064
|
const [selectedWidgets, setSelectedWidgets] = import_react25.default.useState([]);
|
|
2065
|
+
const [numberOfCopies, setNumberOfCopies] = import_react25.default.useState(0);
|
|
2040
2066
|
const handleUndoChanges = () => {
|
|
2041
2067
|
const newPage = pageHistory[historyIndex - 1];
|
|
2042
|
-
if (historyIndex > 0)
|
|
2043
|
-
setHistoryIndex(historyIndex - 1);
|
|
2068
|
+
if (historyIndex > 0) setHistoryIndex(historyIndex - 1);
|
|
2044
2069
|
setPage(newPage);
|
|
2045
2070
|
onSave(sanitizeWidgets(newPage), "Changes undone. Revision saved");
|
|
2046
2071
|
};
|
|
2047
2072
|
const handleRedoChanges = () => {
|
|
2048
2073
|
const newPage = pageHistory[historyIndex + 1];
|
|
2049
|
-
if (historyIndex < pageHistory.length)
|
|
2050
|
-
setHistoryIndex(historyIndex + 1);
|
|
2074
|
+
if (historyIndex < pageHistory.length) setHistoryIndex(historyIndex + 1);
|
|
2051
2075
|
setPage(newPage);
|
|
2052
2076
|
onSave(sanitizeWidgets(newPage), "Changes restored. Revision saved");
|
|
2053
2077
|
};
|
|
@@ -2143,8 +2167,7 @@ var PageBuilder = ({
|
|
|
2143
2167
|
notifyChange(newPage);
|
|
2144
2168
|
};
|
|
2145
2169
|
const handleRemoveMultiple = () => {
|
|
2146
|
-
if (!confirm("Are you sure?"))
|
|
2147
|
-
return;
|
|
2170
|
+
if (!confirm("Are you sure?")) return;
|
|
2148
2171
|
const widgets2 = removeMultipleById(page.widgets, selectedWidgets);
|
|
2149
2172
|
const newPage = __spreadProps(__spreadValues({}, page), {
|
|
2150
2173
|
widgets: widgets2
|
|
@@ -2174,9 +2197,12 @@ var PageBuilder = ({
|
|
|
2174
2197
|
);
|
|
2175
2198
|
saveToLocalStorage(identifier, filterSelected);
|
|
2176
2199
|
setSelectedWidgets([]);
|
|
2200
|
+
setNumberOfCopies(filterSelected.length);
|
|
2177
2201
|
return;
|
|
2178
2202
|
}
|
|
2179
2203
|
saveToLocalStorage(identifier, widgets2);
|
|
2204
|
+
const widgetCount = Array.isArray(widgets2) ? widgets2.length : 1;
|
|
2205
|
+
setNumberOfCopies(widgetCount);
|
|
2180
2206
|
};
|
|
2181
2207
|
const handlePasteWidget = () => {
|
|
2182
2208
|
const clipboardWidgets = JSON.parse(
|
|
@@ -2263,7 +2289,8 @@ var PageBuilder = ({
|
|
|
2263
2289
|
setPage,
|
|
2264
2290
|
undoChanges: handleUndoChanges,
|
|
2265
2291
|
redoChanges: handleRedoChanges,
|
|
2266
|
-
historyIndex
|
|
2292
|
+
historyIndex,
|
|
2293
|
+
clipboardCopiesCount: numberOfCopies
|
|
2267
2294
|
}
|
|
2268
2295
|
),
|
|
2269
2296
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -2297,8 +2324,7 @@ var PageBuilder_default = PageBuilder;
|
|
|
2297
2324
|
var import_react26 = __toESM(require("react"));
|
|
2298
2325
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2299
2326
|
var getWebp = (url) => {
|
|
2300
|
-
if (!url)
|
|
2301
|
-
return null;
|
|
2327
|
+
if (!url) return null;
|
|
2302
2328
|
const segments = url.split(".");
|
|
2303
2329
|
segments[segments.length - 1] = "webp";
|
|
2304
2330
|
return segments.join(".");
|
|
@@ -2424,14 +2450,10 @@ var Button4 = ({ settings, className }) => {
|
|
|
2424
2450
|
follow_link
|
|
2425
2451
|
} = settings;
|
|
2426
2452
|
let buttonClass;
|
|
2427
|
-
if (button_type === "accented")
|
|
2428
|
-
|
|
2429
|
-
if (button_type === "
|
|
2430
|
-
|
|
2431
|
-
if (button_type === "link")
|
|
2432
|
-
buttonClass = "btn-text";
|
|
2433
|
-
if (className)
|
|
2434
|
-
buttonClass = `${buttonClass} ${className}`;
|
|
2453
|
+
if (button_type === "accented") buttonClass = "btn-active-dark";
|
|
2454
|
+
if (button_type === "regular") buttonClass = "btn-passive-light";
|
|
2455
|
+
if (button_type === "link") buttonClass = "btn-text";
|
|
2456
|
+
if (className) buttonClass = `${buttonClass} ${className}`;
|
|
2435
2457
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2436
2458
|
"a",
|
|
2437
2459
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raketa-builder/builder",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
"lint": "biome lint --max-diagnostics=5000 ."
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"react": "
|
|
15
|
-
"react-dom": "
|
|
14
|
+
"react": "19.0.0",
|
|
15
|
+
"react-dom": "19.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"react-sortablejs": "
|
|
19
|
-
"@raketa-builder/support": "1.1.
|
|
20
|
-
"@raketa-builder/ui": "1.1.
|
|
18
|
+
"react-sortablejs": "6.1.4",
|
|
19
|
+
"@raketa-builder/support": "1.1.7",
|
|
20
|
+
"@raketa-builder/ui": "1.1.7"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@biomejs/biome": "1.
|
|
24
|
-
"@types/react": "
|
|
25
|
-
"@types/react-dom": "
|
|
26
|
-
"prettier": "3.
|
|
27
|
-
"react": "
|
|
23
|
+
"@biomejs/biome": "1.9.4",
|
|
24
|
+
"@types/react": "19.0.12",
|
|
25
|
+
"@types/react-dom": "19.0.4",
|
|
26
|
+
"prettier": "3.5.3",
|
|
27
|
+
"react": "19.0.0",
|
|
28
28
|
"tsconfig": "*",
|
|
29
|
-
"tsup": "
|
|
30
|
-
"typescript": "
|
|
29
|
+
"tsup": "8.4.0",
|
|
30
|
+
"typescript": "5.8.2"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/AdminForm/index.js
CHANGED
|
@@ -102,12 +102,22 @@ const FormField = ({ field, value, path, opts, onChange }) => {
|
|
|
102
102
|
label={opts.label}
|
|
103
103
|
value={value}
|
|
104
104
|
path={path}
|
|
105
|
-
opts={opts}
|
|
105
|
+
opts={sanitezeOpts(opts)}
|
|
106
106
|
onChange={onChange}
|
|
107
107
|
/>
|
|
108
108
|
);
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
+
function sanitezeOpts(opts) {
|
|
112
|
+
Object.keys(opts).forEach((key) => {
|
|
113
|
+
if (key.toString().startsWith("_")) {
|
|
114
|
+
delete opts[key];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
return opts;
|
|
119
|
+
}
|
|
120
|
+
|
|
111
121
|
const AdminForm = ({ schema = {}, value = {}, onChange }) => {
|
|
112
122
|
return Object.keys(schema).map((field) => {
|
|
113
123
|
const opts = Object.assign(
|
package/src/PageBuilder.js
CHANGED
|
@@ -62,6 +62,8 @@ const PageBuilder = ({
|
|
|
62
62
|
const [reorderOpen, setReorderOpen] = React.useState(false);
|
|
63
63
|
const [selectedWidgets, setSelectedWidgets] = React.useState([]);
|
|
64
64
|
|
|
65
|
+
const [numberOfCopies, setNumberOfCopies] = React.useState(0);
|
|
66
|
+
|
|
65
67
|
const handleUndoChanges = () => {
|
|
66
68
|
const newPage = pageHistory[historyIndex - 1];
|
|
67
69
|
|
|
@@ -253,10 +255,15 @@ const PageBuilder = ({
|
|
|
253
255
|
saveToLocalStorage(identifier, filterSelected);
|
|
254
256
|
setSelectedWidgets([]);
|
|
255
257
|
|
|
258
|
+
setNumberOfCopies(filterSelected.length);
|
|
259
|
+
|
|
256
260
|
return;
|
|
257
261
|
}
|
|
258
262
|
|
|
259
263
|
saveToLocalStorage(identifier, widgets);
|
|
264
|
+
|
|
265
|
+
const widgetCount = Array.isArray(widgets) ? widgets.length : 1;
|
|
266
|
+
setNumberOfCopies(widgetCount);
|
|
260
267
|
};
|
|
261
268
|
|
|
262
269
|
const handlePasteWidget = () => {
|
|
@@ -369,6 +376,7 @@ const PageBuilder = ({
|
|
|
369
376
|
undoChanges={handleUndoChanges}
|
|
370
377
|
redoChanges={handleRedoChanges}
|
|
371
378
|
historyIndex={historyIndex}
|
|
379
|
+
clipboardCopiesCount={numberOfCopies}
|
|
372
380
|
/>
|
|
373
381
|
|
|
374
382
|
<Canvas
|
package/src/lib/AdminSidebar.js
CHANGED
|
@@ -116,6 +116,7 @@ const AdminSidebar = ({
|
|
|
116
116
|
undoChanges,
|
|
117
117
|
redoChanges,
|
|
118
118
|
historyIndex,
|
|
119
|
+
clipboardCopiesCount,
|
|
119
120
|
}) => {
|
|
120
121
|
const { adminLibrary } = React.useContext(LibraryContext);
|
|
121
122
|
|
|
@@ -149,6 +150,7 @@ const AdminSidebar = ({
|
|
|
149
150
|
tooltip="Paste widget"
|
|
150
151
|
icon={ICONS.paste}
|
|
151
152
|
onClick={onPasteWidget}
|
|
153
|
+
clipboardCopiesCount={clipboardCopiesCount}
|
|
152
154
|
/>
|
|
153
155
|
</NavItem>
|
|
154
156
|
|
package/src/lib/SideNav.js
CHANGED
|
@@ -33,23 +33,47 @@ const NavButtonStyle = ({
|
|
|
33
33
|
? "var(--r-success)"
|
|
34
34
|
: "transparent";
|
|
35
35
|
|
|
36
|
+
const { clipboardCopiesCount, ...otherProps } = props;
|
|
37
|
+
|
|
36
38
|
return (
|
|
37
|
-
<div
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
<div>
|
|
40
|
+
<div
|
|
41
|
+
className={cn(
|
|
42
|
+
"r-reset",
|
|
43
|
+
"r-reset-button",
|
|
44
|
+
"r-fs-medium",
|
|
45
|
+
"r-admin-sidenav-button",
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
style={{
|
|
49
|
+
backgroundColor: backgroundColor,
|
|
50
|
+
backgroundImage: icon ? `url(${icon})` : "",
|
|
51
|
+
opacity: hasChanges ? "" : "0.5",
|
|
52
|
+
cursor: hasChanges ? "pointer" : "not-allowed",
|
|
53
|
+
}}
|
|
54
|
+
{...otherProps}
|
|
55
|
+
/>
|
|
56
|
+
{clipboardCopiesCount > 0 && (
|
|
57
|
+
<div
|
|
58
|
+
style={{
|
|
59
|
+
position: "absolute",
|
|
60
|
+
bottom: "8px",
|
|
61
|
+
right: "5px",
|
|
62
|
+
backgroundColor: "#efefef",
|
|
63
|
+
color: "black",
|
|
64
|
+
width: "16px",
|
|
65
|
+
height: "16px",
|
|
66
|
+
borderRadius: "50%",
|
|
67
|
+
fontSize: "10px",
|
|
68
|
+
display: "flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
justifyContent: "center",
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{clipboardCopiesCount}
|
|
74
|
+
</div>
|
|
44
75
|
)}
|
|
45
|
-
|
|
46
|
-
backgroundColor: backgroundColor,
|
|
47
|
-
backgroundImage: icon ? `url(${icon})` : "",
|
|
48
|
-
opacity: hasChanges ? "" : "0.5",
|
|
49
|
-
cursor: hasChanges ? "pointer" : "not-allowed",
|
|
50
|
-
}}
|
|
51
|
-
{...props}
|
|
52
|
-
/>
|
|
76
|
+
</div>
|
|
53
77
|
);
|
|
54
78
|
};
|
|
55
79
|
|