@measured/puck 0.17.1 → 0.17.2-canary.66b30db
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/{chunk-7IH6SUIT.mjs → chunk-LNGCTWA7.mjs} +2 -4
- package/dist/index.css +12 -14
- package/dist/index.js +648 -513
- package/dist/index.mjs +512 -374
- package/dist/rsc.js +2 -4
- package/dist/rsc.mjs +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
@@ -13,7 +13,7 @@ import {
|
|
13
13
|
resolveRootData,
|
14
14
|
rootDroppableId,
|
15
15
|
setupZone
|
16
|
-
} from "./chunk-
|
16
|
+
} from "./chunk-LNGCTWA7.mjs";
|
17
17
|
|
18
18
|
// ../../node_modules/classnames/index.js
|
19
19
|
var require_classnames = __commonJS({
|
@@ -193,8 +193,9 @@ var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input":
|
|
193
193
|
// components/AutoField/index.tsx
|
194
194
|
import {
|
195
195
|
useCallback as useCallback5,
|
196
|
+
useContext as useContext3,
|
196
197
|
useEffect as useEffect9,
|
197
|
-
useMemo as
|
198
|
+
useMemo as useMemo5,
|
198
199
|
useState as useState10
|
199
200
|
} from "react";
|
200
201
|
|
@@ -1176,21 +1177,66 @@ import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1176
1177
|
var getClassName4 = get_class_name_factory_default("DragIcon", styles_module_default5);
|
1177
1178
|
var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ jsx7("div", { className: getClassName4({ disabled: isDragDisabled }), children: /* @__PURE__ */ jsx7("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ jsx7("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
|
1178
1179
|
|
1180
|
+
// components/AutoField/context.tsx
|
1181
|
+
init_react_import();
|
1182
|
+
import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
|
1183
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
1184
|
+
var NestedFieldContext = createContext2({});
|
1185
|
+
var useNestedFieldContext = () => {
|
1186
|
+
const context = useContext2(NestedFieldContext);
|
1187
|
+
return __spreadProps(__spreadValues({}, context), {
|
1188
|
+
readOnlyFields: context.readOnlyFields || {}
|
1189
|
+
});
|
1190
|
+
};
|
1191
|
+
var NestedFieldProvider = ({
|
1192
|
+
children,
|
1193
|
+
name,
|
1194
|
+
subName,
|
1195
|
+
wildcardName = name,
|
1196
|
+
readOnlyFields
|
1197
|
+
}) => {
|
1198
|
+
const subPath = `${name}.${subName}`;
|
1199
|
+
const wildcardSubPath = `${wildcardName}.${subName}`;
|
1200
|
+
const subReadOnlyFields = useMemo(
|
1201
|
+
() => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
|
1202
|
+
const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
|
1203
|
+
if (isLocal) {
|
1204
|
+
const subPathPattern = new RegExp(
|
1205
|
+
`^(${name}|${wildcardName}).`.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\./g, "\\.").replace(/\*/g, "\\*")
|
1206
|
+
);
|
1207
|
+
const localName = readOnlyKey.replace(subPathPattern, "");
|
1208
|
+
return __spreadProps(__spreadValues({}, acc), {
|
1209
|
+
[localName]: readOnlyFields[readOnlyKey]
|
1210
|
+
});
|
1211
|
+
}
|
1212
|
+
return acc;
|
1213
|
+
}, {}),
|
1214
|
+
[name, subName, wildcardName, readOnlyFields]
|
1215
|
+
);
|
1216
|
+
return /* @__PURE__ */ jsx8(
|
1217
|
+
NestedFieldContext.Provider,
|
1218
|
+
{
|
1219
|
+
value: { readOnlyFields: subReadOnlyFields, localName: subName },
|
1220
|
+
children
|
1221
|
+
}
|
1222
|
+
);
|
1223
|
+
};
|
1224
|
+
|
1179
1225
|
// components/DragDropContext/index.tsx
|
1180
1226
|
init_react_import();
|
1181
1227
|
import {
|
1182
1228
|
DragDropContext as DndDragDropContext
|
1183
1229
|
} from "@measured/dnd";
|
1184
|
-
import { Fragment as Fragment4, jsx as
|
1185
|
-
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */
|
1230
|
+
import { Fragment as Fragment4, jsx as jsx9 } from "react/jsx-runtime";
|
1231
|
+
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ jsx9(Fragment4, { children });
|
1186
1232
|
var DragDropContext = (props) => {
|
1187
1233
|
const { status } = useAppContext();
|
1188
1234
|
const El = status !== "LOADING" ? DndDragDropContext : DefaultDragDropContext;
|
1189
|
-
return /* @__PURE__ */
|
1235
|
+
return /* @__PURE__ */ jsx9(El, __spreadValues({}, props));
|
1190
1236
|
};
|
1191
1237
|
|
1192
1238
|
// components/AutoField/fields/ArrayField/index.tsx
|
1193
|
-
import { Fragment as Fragment5, jsx as
|
1239
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
1194
1240
|
var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
|
1195
1241
|
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
|
1196
1242
|
var ArrayField = ({
|
@@ -1201,10 +1247,10 @@ var ArrayField = ({
|
|
1201
1247
|
label,
|
1202
1248
|
readOnly,
|
1203
1249
|
id,
|
1204
|
-
Label = (props) => /* @__PURE__ */
|
1250
|
+
Label = (props) => /* @__PURE__ */ jsx10("div", __spreadValues({}, props))
|
1205
1251
|
}) => {
|
1206
1252
|
const { state, setUi, selectedItem, getPermissions } = useAppContext();
|
1207
|
-
const readOnlyFields =
|
1253
|
+
const { readOnlyFields, localName = name } = useNestedFieldContext();
|
1208
1254
|
const value = _value;
|
1209
1255
|
const arrayState = state.ui.arrayState[id] || {
|
1210
1256
|
items: Array.from(value || []).map((item, idx) => {
|
@@ -1265,14 +1311,14 @@ var ArrayField = ({
|
|
1265
1311
|
return null;
|
1266
1312
|
}
|
1267
1313
|
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
1268
|
-
return /* @__PURE__ */
|
1314
|
+
return /* @__PURE__ */ jsx10(
|
1269
1315
|
Label,
|
1270
1316
|
{
|
1271
1317
|
label: label || name,
|
1272
|
-
icon: /* @__PURE__ */
|
1318
|
+
icon: /* @__PURE__ */ jsx10(List, { size: 16 }),
|
1273
1319
|
el: "div",
|
1274
1320
|
readOnly,
|
1275
|
-
children: /* @__PURE__ */
|
1321
|
+
children: /* @__PURE__ */ jsx10(
|
1276
1322
|
DragDropContext,
|
1277
1323
|
{
|
1278
1324
|
onDragEnd: (event) => {
|
@@ -1301,7 +1347,7 @@ var ArrayField = ({
|
|
1301
1347
|
});
|
1302
1348
|
}
|
1303
1349
|
},
|
1304
|
-
children: /* @__PURE__ */
|
1350
|
+
children: /* @__PURE__ */ jsx10(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
1305
1351
|
return /* @__PURE__ */ jsxs4(
|
1306
1352
|
"div",
|
1307
1353
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
@@ -1326,7 +1372,7 @@ var ArrayField = ({
|
|
1326
1372
|
localState.arrayState.items.map((item, i) => {
|
1327
1373
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
1328
1374
|
const data = Array.from(localState.value || [])[i] || {};
|
1329
|
-
return /* @__PURE__ */
|
1375
|
+
return /* @__PURE__ */ jsx10(
|
1330
1376
|
Draggable,
|
1331
1377
|
{
|
1332
1378
|
id: _arrayId,
|
@@ -1361,7 +1407,7 @@ var ArrayField = ({
|
|
1361
1407
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
1362
1408
|
/* @__PURE__ */ jsxs4("div", { className: getClassNameItem("rhs"), children: [
|
1363
1409
|
!readOnly && /* @__PURE__ */ jsxs4("div", { className: getClassNameItem("actions"), children: [
|
1364
|
-
/* @__PURE__ */
|
1410
|
+
/* @__PURE__ */ jsx10("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx10(
|
1365
1411
|
IconButton,
|
1366
1412
|
{
|
1367
1413
|
type: "button",
|
@@ -1384,10 +1430,10 @@ var ArrayField = ({
|
|
1384
1430
|
);
|
1385
1431
|
},
|
1386
1432
|
title: "Duplicate",
|
1387
|
-
children: /* @__PURE__ */
|
1433
|
+
children: /* @__PURE__ */ jsx10(Copy, { size: 16 })
|
1388
1434
|
}
|
1389
1435
|
) }),
|
1390
|
-
/* @__PURE__ */
|
1436
|
+
/* @__PURE__ */ jsx10("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx10(
|
1391
1437
|
IconButton,
|
1392
1438
|
{
|
1393
1439
|
type: "button",
|
@@ -1410,40 +1456,57 @@ var ArrayField = ({
|
|
1410
1456
|
);
|
1411
1457
|
},
|
1412
1458
|
title: "Delete",
|
1413
|
-
children: /* @__PURE__ */
|
1459
|
+
children: /* @__PURE__ */ jsx10(Trash, { size: 16 })
|
1414
1460
|
}
|
1415
1461
|
) })
|
1416
1462
|
] }),
|
1417
|
-
/* @__PURE__ */
|
1463
|
+
/* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10(DragIcon, {}) })
|
1418
1464
|
] })
|
1419
1465
|
]
|
1420
1466
|
}
|
1421
1467
|
),
|
1422
|
-
/* @__PURE__ */
|
1423
|
-
(
|
1424
|
-
const subField = field.arrayFields[
|
1425
|
-
const
|
1426
|
-
const
|
1427
|
-
const
|
1428
|
-
|
1429
|
-
|
1468
|
+
/* @__PURE__ */ jsx10("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx10("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
|
1469
|
+
(subName) => {
|
1470
|
+
const subField = field.arrayFields[subName];
|
1471
|
+
const indexName = `${name}[${i}]`;
|
1472
|
+
const subPath = `${indexName}.${subName}`;
|
1473
|
+
const localIndexName = `${localName}[${i}]`;
|
1474
|
+
const localWildcardName = `${localName}[*]`;
|
1475
|
+
const localSubPath = `${localIndexName}.${subName}`;
|
1476
|
+
const localWildcardSubPath = `${localWildcardName}.${subName}`;
|
1477
|
+
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
|
1478
|
+
const label2 = subField.label || subName;
|
1479
|
+
return /* @__PURE__ */ jsx10(
|
1480
|
+
NestedFieldProvider,
|
1430
1481
|
{
|
1431
|
-
name:
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1482
|
+
name: localIndexName,
|
1483
|
+
wildcardName: localWildcardName,
|
1484
|
+
subName,
|
1485
|
+
readOnlyFields,
|
1486
|
+
children: /* @__PURE__ */ jsx10(
|
1487
|
+
AutoFieldPrivate,
|
1488
|
+
{
|
1489
|
+
name: subPath,
|
1490
|
+
label: label2,
|
1491
|
+
id: `${_arrayId}_${subName}`,
|
1492
|
+
readOnly: subReadOnly,
|
1493
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
1494
|
+
label: label2
|
1495
|
+
// May be used by custom fields
|
1496
|
+
}),
|
1497
|
+
value: data[subName],
|
1498
|
+
onChange: (val, ui) => {
|
1499
|
+
onChange(
|
1500
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
1501
|
+
[subName]: val
|
1502
|
+
})),
|
1503
|
+
ui
|
1504
|
+
);
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
)
|
1445
1508
|
},
|
1446
|
-
|
1509
|
+
subPath
|
1447
1510
|
);
|
1448
1511
|
}
|
1449
1512
|
) }) })
|
@@ -1453,7 +1516,7 @@ var ArrayField = ({
|
|
1453
1516
|
);
|
1454
1517
|
}),
|
1455
1518
|
provided.placeholder,
|
1456
|
-
!addDisabled && /* @__PURE__ */
|
1519
|
+
!addDisabled && /* @__PURE__ */ jsx10(
|
1457
1520
|
"button",
|
1458
1521
|
{
|
1459
1522
|
type: "button",
|
@@ -1467,7 +1530,7 @@ var ArrayField = ({
|
|
1467
1530
|
const newArrayState = regenerateArrayState(newValue);
|
1468
1531
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
1469
1532
|
},
|
1470
|
-
children: /* @__PURE__ */
|
1533
|
+
children: /* @__PURE__ */ jsx10(Plus, { size: 21 })
|
1471
1534
|
}
|
1472
1535
|
)
|
1473
1536
|
]
|
@@ -1482,7 +1545,7 @@ var ArrayField = ({
|
|
1482
1545
|
|
1483
1546
|
// components/AutoField/fields/DefaultField/index.tsx
|
1484
1547
|
init_react_import();
|
1485
|
-
import { Fragment as Fragment6, jsx as
|
1548
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
1486
1549
|
var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
|
1487
1550
|
var DefaultField = ({
|
1488
1551
|
field,
|
@@ -1494,16 +1557,16 @@ var DefaultField = ({
|
|
1494
1557
|
Label,
|
1495
1558
|
id
|
1496
1559
|
}) => {
|
1497
|
-
return /* @__PURE__ */
|
1560
|
+
return /* @__PURE__ */ jsx11(
|
1498
1561
|
Label,
|
1499
1562
|
{
|
1500
1563
|
label: label || name,
|
1501
1564
|
icon: /* @__PURE__ */ jsxs5(Fragment6, { children: [
|
1502
|
-
field.type === "text" && /* @__PURE__ */
|
1503
|
-
field.type === "number" && /* @__PURE__ */
|
1565
|
+
field.type === "text" && /* @__PURE__ */ jsx11(Type, { size: 16 }),
|
1566
|
+
field.type === "number" && /* @__PURE__ */ jsx11(Hash, { size: 16 })
|
1504
1567
|
] }),
|
1505
1568
|
readOnly,
|
1506
|
-
children: /* @__PURE__ */
|
1569
|
+
children: /* @__PURE__ */ jsx11(
|
1507
1570
|
"input",
|
1508
1571
|
{
|
1509
1572
|
className: getClassName6("input"),
|
@@ -1514,7 +1577,14 @@ var DefaultField = ({
|
|
1514
1577
|
value: typeof value === "undefined" ? "" : value.toString(),
|
1515
1578
|
onChange: (e) => {
|
1516
1579
|
if (field.type === "number") {
|
1517
|
-
|
1580
|
+
const numberValue = Number(e.currentTarget.value);
|
1581
|
+
if (typeof field.min !== "undefined" && numberValue < field.min) {
|
1582
|
+
return;
|
1583
|
+
}
|
1584
|
+
if (typeof field.max !== "undefined" && numberValue > field.max) {
|
1585
|
+
return;
|
1586
|
+
}
|
1587
|
+
onChange(numberValue);
|
1518
1588
|
} else {
|
1519
1589
|
onChange(e.currentTarget.value);
|
1520
1590
|
}
|
@@ -1537,7 +1607,7 @@ import { useEffect as useEffect8 } from "react";
|
|
1537
1607
|
// components/ExternalInput/index.tsx
|
1538
1608
|
init_react_import();
|
1539
1609
|
import {
|
1540
|
-
useMemo,
|
1610
|
+
useMemo as useMemo2,
|
1541
1611
|
useEffect as useEffect7,
|
1542
1612
|
useState as useState8,
|
1543
1613
|
useCallback as useCallback4,
|
@@ -1558,7 +1628,7 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
|
|
1558
1628
|
|
1559
1629
|
// components/Modal/index.tsx
|
1560
1630
|
import { createPortal } from "react-dom";
|
1561
|
-
import { jsx as
|
1631
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
1562
1632
|
var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
|
1563
1633
|
var Modal = ({
|
1564
1634
|
children,
|
@@ -1570,10 +1640,10 @@ var Modal = ({
|
|
1570
1640
|
setRootEl(document.getElementById("puck-portal-root"));
|
1571
1641
|
}, []);
|
1572
1642
|
if (!rootEl) {
|
1573
|
-
return /* @__PURE__ */
|
1643
|
+
return /* @__PURE__ */ jsx12("div", {});
|
1574
1644
|
}
|
1575
1645
|
return createPortal(
|
1576
|
-
/* @__PURE__ */
|
1646
|
+
/* @__PURE__ */ jsx12("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ jsx12(
|
1577
1647
|
"div",
|
1578
1648
|
{
|
1579
1649
|
className: getClassName7("inner"),
|
@@ -1593,11 +1663,11 @@ init_react_import();
|
|
1593
1663
|
var styles_module_default8 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
1594
1664
|
|
1595
1665
|
// components/Heading/index.tsx
|
1596
|
-
import { jsx as
|
1666
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
1597
1667
|
var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
|
1598
1668
|
var Heading = ({ children, rank, size = "m" }) => {
|
1599
1669
|
const Tag = rank ? `h${rank}` : "span";
|
1600
|
-
return /* @__PURE__ */
|
1670
|
+
return /* @__PURE__ */ jsx13(
|
1601
1671
|
Tag,
|
1602
1672
|
{
|
1603
1673
|
className: getClassName8({
|
@@ -1620,7 +1690,7 @@ init_react_import();
|
|
1620
1690
|
var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
|
1621
1691
|
|
1622
1692
|
// components/Button/Button.tsx
|
1623
|
-
import { jsx as
|
1693
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
1624
1694
|
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
1625
1695
|
var Button = ({
|
1626
1696
|
children,
|
@@ -1663,9 +1733,9 @@ var Button = ({
|
|
1663
1733
|
rel: newTab ? "noreferrer" : void 0,
|
1664
1734
|
href,
|
1665
1735
|
children: [
|
1666
|
-
icon && /* @__PURE__ */
|
1736
|
+
icon && /* @__PURE__ */ jsx14("div", { className: getClassName9("icon"), children: icon }),
|
1667
1737
|
children,
|
1668
|
-
loading && /* @__PURE__ */
|
1738
|
+
loading && /* @__PURE__ */ jsx14("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ jsx14(Loader, { size: 14 }) })
|
1669
1739
|
]
|
1670
1740
|
}
|
1671
1741
|
);
|
@@ -1673,7 +1743,7 @@ var Button = ({
|
|
1673
1743
|
};
|
1674
1744
|
|
1675
1745
|
// components/ExternalInput/index.tsx
|
1676
|
-
import { Fragment as Fragment7, jsx as
|
1746
|
+
import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
1677
1747
|
var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
|
1678
1748
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
|
1679
1749
|
var dataCache = {};
|
@@ -1696,10 +1766,10 @@ var ExternalInput = ({
|
|
1696
1766
|
const hasFilterFields = !!filterFields;
|
1697
1767
|
const [filters, setFilters] = useState8(field.initialFilters || {});
|
1698
1768
|
const [filtersToggled, setFiltersToggled] = useState8(hasFilterFields);
|
1699
|
-
const mappedData =
|
1769
|
+
const mappedData = useMemo2(() => {
|
1700
1770
|
return data.map(mapRow);
|
1701
1771
|
}, [data]);
|
1702
|
-
const keys =
|
1772
|
+
const keys = useMemo2(() => {
|
1703
1773
|
const validKeys = /* @__PURE__ */ new Set();
|
1704
1774
|
for (const item of mappedData) {
|
1705
1775
|
for (const key of Object.keys(item)) {
|
@@ -1746,7 +1816,7 @@ var ExternalInput = ({
|
|
1746
1816
|
id,
|
1747
1817
|
children: [
|
1748
1818
|
/* @__PURE__ */ jsxs7("div", { className: getClassName10("actions"), children: [
|
1749
|
-
/* @__PURE__ */
|
1819
|
+
/* @__PURE__ */ jsx15(
|
1750
1820
|
"button",
|
1751
1821
|
{
|
1752
1822
|
type: "button",
|
@@ -1754,12 +1824,12 @@ var ExternalInput = ({
|
|
1754
1824
|
className: getClassName10("button"),
|
1755
1825
|
disabled: readOnly,
|
1756
1826
|
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ jsxs7(Fragment7, { children: [
|
1757
|
-
/* @__PURE__ */
|
1758
|
-
/* @__PURE__ */
|
1827
|
+
/* @__PURE__ */ jsx15(Link, { size: "16" }),
|
1828
|
+
/* @__PURE__ */ jsx15("span", { children: field.placeholder })
|
1759
1829
|
] })
|
1760
1830
|
}
|
1761
1831
|
),
|
1762
|
-
value && /* @__PURE__ */
|
1832
|
+
value && /* @__PURE__ */ jsx15(
|
1763
1833
|
"button",
|
1764
1834
|
{
|
1765
1835
|
type: "button",
|
@@ -1768,11 +1838,11 @@ var ExternalInput = ({
|
|
1768
1838
|
onChange(null);
|
1769
1839
|
},
|
1770
1840
|
disabled: readOnly,
|
1771
|
-
children: /* @__PURE__ */
|
1841
|
+
children: /* @__PURE__ */ jsx15(LockOpen, { size: 16 })
|
1772
1842
|
}
|
1773
1843
|
)
|
1774
1844
|
] }),
|
1775
|
-
/* @__PURE__ */
|
1845
|
+
/* @__PURE__ */ jsx15(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ jsxs7(
|
1776
1846
|
"form",
|
1777
1847
|
{
|
1778
1848
|
className: getClassNameModal({
|
@@ -1786,11 +1856,11 @@ var ExternalInput = ({
|
|
1786
1856
|
search(searchQuery, filters);
|
1787
1857
|
},
|
1788
1858
|
children: [
|
1789
|
-
/* @__PURE__ */
|
1859
|
+
/* @__PURE__ */ jsx15("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ jsxs7("div", { className: getClassNameModal("searchForm"), children: [
|
1790
1860
|
/* @__PURE__ */ jsxs7("label", { className: getClassNameModal("search"), children: [
|
1791
|
-
/* @__PURE__ */
|
1792
|
-
/* @__PURE__ */
|
1793
|
-
/* @__PURE__ */
|
1861
|
+
/* @__PURE__ */ jsx15("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
1862
|
+
/* @__PURE__ */ jsx15("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ jsx15(Search, { size: "18" }) }),
|
1863
|
+
/* @__PURE__ */ jsx15(
|
1794
1864
|
"input",
|
1795
1865
|
{
|
1796
1866
|
className: getClassNameModal("searchInput"),
|
@@ -1806,8 +1876,8 @@ var ExternalInput = ({
|
|
1806
1876
|
)
|
1807
1877
|
] }),
|
1808
1878
|
/* @__PURE__ */ jsxs7("div", { className: getClassNameModal("searchActions"), children: [
|
1809
|
-
/* @__PURE__ */
|
1810
|
-
hasFilterFields && /* @__PURE__ */
|
1879
|
+
/* @__PURE__ */ jsx15(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
1880
|
+
hasFilterFields && /* @__PURE__ */ jsx15("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ jsx15(
|
1811
1881
|
IconButton,
|
1812
1882
|
{
|
1813
1883
|
title: "Toggle filters",
|
@@ -1816,15 +1886,15 @@ var ExternalInput = ({
|
|
1816
1886
|
e.stopPropagation();
|
1817
1887
|
setFiltersToggled(!filtersToggled);
|
1818
1888
|
},
|
1819
|
-
children: /* @__PURE__ */
|
1889
|
+
children: /* @__PURE__ */ jsx15(SlidersHorizontal, { size: 20 })
|
1820
1890
|
}
|
1821
1891
|
) })
|
1822
1892
|
] })
|
1823
|
-
] }) : /* @__PURE__ */
|
1893
|
+
] }) : /* @__PURE__ */ jsx15(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
|
1824
1894
|
/* @__PURE__ */ jsxs7("div", { className: getClassNameModal("grid"), children: [
|
1825
|
-
hasFilterFields && /* @__PURE__ */
|
1895
|
+
hasFilterFields && /* @__PURE__ */ jsx15("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
1826
1896
|
const filterField = filterFields[fieldName];
|
1827
|
-
return /* @__PURE__ */
|
1897
|
+
return /* @__PURE__ */ jsx15(
|
1828
1898
|
AutoFieldPrivate,
|
1829
1899
|
{
|
1830
1900
|
field: filterField,
|
@@ -1843,7 +1913,7 @@ var ExternalInput = ({
|
|
1843
1913
|
}) }),
|
1844
1914
|
/* @__PURE__ */ jsxs7("div", { className: getClassNameModal("tableWrapper"), children: [
|
1845
1915
|
/* @__PURE__ */ jsxs7("table", { className: getClassNameModal("table"), children: [
|
1846
|
-
/* @__PURE__ */
|
1916
|
+
/* @__PURE__ */ jsx15("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ jsx15("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ jsx15(
|
1847
1917
|
"th",
|
1848
1918
|
{
|
1849
1919
|
className: getClassNameModal("th"),
|
@@ -1852,8 +1922,8 @@ var ExternalInput = ({
|
|
1852
1922
|
},
|
1853
1923
|
key
|
1854
1924
|
)) }) }),
|
1855
|
-
/* @__PURE__ */
|
1856
|
-
return /* @__PURE__ */
|
1925
|
+
/* @__PURE__ */ jsx15("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
1926
|
+
return /* @__PURE__ */ jsx15(
|
1857
1927
|
"tr",
|
1858
1928
|
{
|
1859
1929
|
style: { whiteSpace: "nowrap" },
|
@@ -1862,16 +1932,16 @@ var ExternalInput = ({
|
|
1862
1932
|
onChange(mapProp(data[i]));
|
1863
1933
|
setOpen(false);
|
1864
1934
|
},
|
1865
|
-
children: keys.map((key) => /* @__PURE__ */
|
1935
|
+
children: keys.map((key) => /* @__PURE__ */ jsx15("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
1866
1936
|
},
|
1867
1937
|
i
|
1868
1938
|
);
|
1869
1939
|
}) })
|
1870
1940
|
] }),
|
1871
|
-
/* @__PURE__ */
|
1941
|
+
/* @__PURE__ */ jsx15("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx15(Loader, { size: 24 }) })
|
1872
1942
|
] })
|
1873
1943
|
] }),
|
1874
|
-
/* @__PURE__ */
|
1944
|
+
/* @__PURE__ */ jsx15("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx15(Footer, { items: mappedData }) })
|
1875
1945
|
]
|
1876
1946
|
}
|
1877
1947
|
) })
|
@@ -1881,7 +1951,7 @@ var ExternalInput = ({
|
|
1881
1951
|
};
|
1882
1952
|
|
1883
1953
|
// components/AutoField/fields/ExternalField/index.tsx
|
1884
|
-
import { jsx as
|
1954
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
1885
1955
|
var ExternalField = ({
|
1886
1956
|
field,
|
1887
1957
|
onChange,
|
@@ -1905,7 +1975,7 @@ var ExternalField = ({
|
|
1905
1975
|
if (field.type !== "external") {
|
1906
1976
|
return null;
|
1907
1977
|
}
|
1908
|
-
return /* @__PURE__ */
|
1978
|
+
return /* @__PURE__ */ jsx16(Label, { label: label || name, icon: /* @__PURE__ */ jsx16(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx16(
|
1909
1979
|
ExternalInput,
|
1910
1980
|
{
|
1911
1981
|
name,
|
@@ -1930,7 +2000,7 @@ var ExternalField = ({
|
|
1930
2000
|
|
1931
2001
|
// components/AutoField/fields/RadioField/index.tsx
|
1932
2002
|
init_react_import();
|
1933
|
-
import { useMemo as
|
2003
|
+
import { useMemo as useMemo3 } from "react";
|
1934
2004
|
|
1935
2005
|
// lib/safe-json-parse.ts
|
1936
2006
|
init_react_import();
|
@@ -1944,7 +2014,7 @@ var safeJsonParse = (str) => {
|
|
1944
2014
|
};
|
1945
2015
|
|
1946
2016
|
// components/AutoField/fields/RadioField/index.tsx
|
1947
|
-
import { jsx as
|
2017
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
1948
2018
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
1949
2019
|
var RadioField = ({
|
1950
2020
|
field,
|
@@ -1956,26 +2026,26 @@ var RadioField = ({
|
|
1956
2026
|
label,
|
1957
2027
|
Label
|
1958
2028
|
}) => {
|
1959
|
-
const flatOptions =
|
2029
|
+
const flatOptions = useMemo3(
|
1960
2030
|
() => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
|
1961
2031
|
[field]
|
1962
2032
|
);
|
1963
2033
|
if (field.type !== "radio" || !field.options) {
|
1964
2034
|
return null;
|
1965
2035
|
}
|
1966
|
-
return /* @__PURE__ */
|
2036
|
+
return /* @__PURE__ */ jsx17(
|
1967
2037
|
Label,
|
1968
2038
|
{
|
1969
|
-
icon: /* @__PURE__ */
|
2039
|
+
icon: /* @__PURE__ */ jsx17(CircleCheckBig, { size: 16 }),
|
1970
2040
|
label: label || name,
|
1971
2041
|
readOnly,
|
1972
2042
|
el: "div",
|
1973
|
-
children: /* @__PURE__ */
|
2043
|
+
children: /* @__PURE__ */ jsx17("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ jsxs8(
|
1974
2044
|
"label",
|
1975
2045
|
{
|
1976
2046
|
className: getClassName11("radio"),
|
1977
2047
|
children: [
|
1978
|
-
/* @__PURE__ */
|
2048
|
+
/* @__PURE__ */ jsx17(
|
1979
2049
|
"input",
|
1980
2050
|
{
|
1981
2051
|
type: "radio",
|
@@ -1995,7 +2065,7 @@ var RadioField = ({
|
|
1995
2065
|
checked: value === option.value
|
1996
2066
|
}
|
1997
2067
|
),
|
1998
|
-
/* @__PURE__ */
|
2068
|
+
/* @__PURE__ */ jsx17("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
1999
2069
|
]
|
2000
2070
|
},
|
2001
2071
|
option.label + option.value
|
@@ -2006,8 +2076,8 @@ var RadioField = ({
|
|
2006
2076
|
|
2007
2077
|
// components/AutoField/fields/SelectField/index.tsx
|
2008
2078
|
init_react_import();
|
2009
|
-
import { useMemo as
|
2010
|
-
import { jsx as
|
2079
|
+
import { useMemo as useMemo4 } from "react";
|
2080
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
2011
2081
|
var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
|
2012
2082
|
var SelectField = ({
|
2013
2083
|
field,
|
@@ -2019,20 +2089,20 @@ var SelectField = ({
|
|
2019
2089
|
readOnly,
|
2020
2090
|
id
|
2021
2091
|
}) => {
|
2022
|
-
const flatOptions =
|
2092
|
+
const flatOptions = useMemo4(
|
2023
2093
|
() => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
|
2024
2094
|
[field]
|
2025
2095
|
);
|
2026
2096
|
if (field.type !== "select" || !field.options) {
|
2027
2097
|
return null;
|
2028
2098
|
}
|
2029
|
-
return /* @__PURE__ */
|
2099
|
+
return /* @__PURE__ */ jsx18(
|
2030
2100
|
Label,
|
2031
2101
|
{
|
2032
2102
|
label: label || name,
|
2033
|
-
icon: /* @__PURE__ */
|
2103
|
+
icon: /* @__PURE__ */ jsx18(ChevronDown, { size: 16 }),
|
2034
2104
|
readOnly,
|
2035
|
-
children: /* @__PURE__ */
|
2105
|
+
children: /* @__PURE__ */ jsx18(
|
2036
2106
|
"select",
|
2037
2107
|
{
|
2038
2108
|
id,
|
@@ -2049,7 +2119,7 @@ var SelectField = ({
|
|
2049
2119
|
}
|
2050
2120
|
},
|
2051
2121
|
value,
|
2052
|
-
children: field.options.map((option) => /* @__PURE__ */
|
2122
|
+
children: field.options.map((option) => /* @__PURE__ */ jsx18(
|
2053
2123
|
"option",
|
2054
2124
|
{
|
2055
2125
|
label: option.label,
|
@@ -2065,7 +2135,7 @@ var SelectField = ({
|
|
2065
2135
|
|
2066
2136
|
// components/AutoField/fields/TextareaField/index.tsx
|
2067
2137
|
init_react_import();
|
2068
|
-
import { jsx as
|
2138
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
2069
2139
|
var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
|
2070
2140
|
var TextareaField = ({
|
2071
2141
|
onChange,
|
@@ -2076,7 +2146,7 @@ var TextareaField = ({
|
|
2076
2146
|
Label,
|
2077
2147
|
id
|
2078
2148
|
}) => {
|
2079
|
-
return /* @__PURE__ */
|
2149
|
+
return /* @__PURE__ */ jsx19(Label, { label: label || name, icon: /* @__PURE__ */ jsx19(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx19(
|
2080
2150
|
"textarea",
|
2081
2151
|
{
|
2082
2152
|
id,
|
@@ -2103,7 +2173,7 @@ init_react_import();
|
|
2103
2173
|
var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
|
2104
2174
|
|
2105
2175
|
// components/AutoField/fields/ObjectField/index.tsx
|
2106
|
-
import { jsx as
|
2176
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
2107
2177
|
var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
|
2108
2178
|
var ObjectField = ({
|
2109
2179
|
field,
|
@@ -2115,43 +2185,54 @@ var ObjectField = ({
|
|
2115
2185
|
readOnly,
|
2116
2186
|
id
|
2117
2187
|
}) => {
|
2118
|
-
const {
|
2188
|
+
const { readOnlyFields, localName = name } = useNestedFieldContext();
|
2119
2189
|
if (field.type !== "object" || !field.objectFields) {
|
2120
2190
|
return null;
|
2121
2191
|
}
|
2122
|
-
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
2123
2192
|
const data = value || {};
|
2124
|
-
return /* @__PURE__ */
|
2193
|
+
return /* @__PURE__ */ jsx20(
|
2125
2194
|
Label,
|
2126
2195
|
{
|
2127
2196
|
label: label || name,
|
2128
|
-
icon: /* @__PURE__ */
|
2197
|
+
icon: /* @__PURE__ */ jsx20(EllipsisVertical, { size: 16 }),
|
2129
2198
|
el: "div",
|
2130
2199
|
readOnly,
|
2131
|
-
children: /* @__PURE__ */
|
2132
|
-
const subField = field.objectFields[
|
2133
|
-
const
|
2134
|
-
const
|
2135
|
-
const subReadOnly = readOnly ? readOnly :
|
2136
|
-
|
2137
|
-
|
2200
|
+
children: /* @__PURE__ */ jsx20("div", { className: getClassName14(), children: /* @__PURE__ */ jsx20("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
2201
|
+
const subField = field.objectFields[subName];
|
2202
|
+
const subPath = `${name}.${subName}`;
|
2203
|
+
const localSubPath = `${localName || name}.${subName}`;
|
2204
|
+
const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
|
2205
|
+
const label2 = subField.label || subName;
|
2206
|
+
return /* @__PURE__ */ jsx20(
|
2207
|
+
NestedFieldProvider,
|
2138
2208
|
{
|
2139
|
-
name:
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2209
|
+
name: localName || id,
|
2210
|
+
subName,
|
2211
|
+
readOnlyFields,
|
2212
|
+
children: /* @__PURE__ */ jsx20(
|
2213
|
+
AutoFieldPrivate,
|
2214
|
+
{
|
2215
|
+
name: subPath,
|
2216
|
+
label: subPath,
|
2217
|
+
id: `${id}_${subName}`,
|
2218
|
+
readOnly: subReadOnly,
|
2219
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
2220
|
+
label: label2
|
2221
|
+
// May be used by custom fields
|
2149
2222
|
}),
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2223
|
+
value: data[subName],
|
2224
|
+
onChange: (val, ui) => {
|
2225
|
+
onChange(
|
2226
|
+
__spreadProps(__spreadValues({}, data), {
|
2227
|
+
[subName]: val
|
2228
|
+
}),
|
2229
|
+
ui
|
2230
|
+
);
|
2231
|
+
}
|
2232
|
+
}
|
2233
|
+
)
|
2153
2234
|
},
|
2154
|
-
|
2235
|
+
subPath
|
2155
2236
|
);
|
2156
2237
|
}) }) })
|
2157
2238
|
}
|
@@ -2177,7 +2258,7 @@ var useSafeId = () => {
|
|
2177
2258
|
};
|
2178
2259
|
|
2179
2260
|
// components/AutoField/index.tsx
|
2180
|
-
import { Fragment as Fragment8, jsx as
|
2261
|
+
import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
2181
2262
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
|
2182
2263
|
var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
|
2183
2264
|
var FieldLabel = ({
|
@@ -2191,14 +2272,14 @@ var FieldLabel = ({
|
|
2191
2272
|
const El = el;
|
2192
2273
|
return /* @__PURE__ */ jsxs9(El, { className, children: [
|
2193
2274
|
/* @__PURE__ */ jsxs9("div", { className: getClassName15("label"), children: [
|
2194
|
-
icon ? /* @__PURE__ */
|
2275
|
+
icon ? /* @__PURE__ */ jsx21("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ jsx21(Fragment8, {}),
|
2195
2276
|
label,
|
2196
|
-
readOnly && /* @__PURE__ */
|
2277
|
+
readOnly && /* @__PURE__ */ jsx21("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ jsx21(Lock, { size: "12" }) })
|
2197
2278
|
] }),
|
2198
2279
|
children
|
2199
2280
|
] });
|
2200
2281
|
};
|
2201
|
-
var
|
2282
|
+
var FieldLabelInternal = ({
|
2202
2283
|
children,
|
2203
2284
|
icon,
|
2204
2285
|
label,
|
@@ -2206,14 +2287,14 @@ var FieldLabelInternal2 = ({
|
|
2206
2287
|
readOnly
|
2207
2288
|
}) => {
|
2208
2289
|
const { overrides } = useAppContext();
|
2209
|
-
const Wrapper =
|
2290
|
+
const Wrapper = useMemo5(
|
2210
2291
|
() => overrides.fieldLabel || FieldLabel,
|
2211
2292
|
[overrides]
|
2212
2293
|
);
|
2213
2294
|
if (!label) {
|
2214
|
-
return /* @__PURE__ */
|
2295
|
+
return /* @__PURE__ */ jsx21(Fragment8, { children });
|
2215
2296
|
}
|
2216
|
-
return /* @__PURE__ */
|
2297
|
+
return /* @__PURE__ */ jsx21(
|
2217
2298
|
Wrapper,
|
2218
2299
|
{
|
2219
2300
|
label,
|
@@ -2227,8 +2308,9 @@ var FieldLabelInternal2 = ({
|
|
2227
2308
|
};
|
2228
2309
|
function AutoFieldInternal(props) {
|
2229
2310
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2230
|
-
const { dispatch, overrides } = useAppContext();
|
2231
|
-
const
|
2311
|
+
const { dispatch, overrides, selectedItem } = useAppContext();
|
2312
|
+
const nestedFieldContext = useContext3(NestedFieldContext);
|
2313
|
+
const { id, Label = FieldLabelInternal } = props;
|
2232
2314
|
const field = props.field;
|
2233
2315
|
const label = field.label;
|
2234
2316
|
const defaultId = useSafeId();
|
@@ -2288,20 +2370,29 @@ function AutoFieldInternal(props) {
|
|
2288
2370
|
return null;
|
2289
2371
|
}
|
2290
2372
|
const CustomField = field.render;
|
2291
|
-
return /* @__PURE__ */
|
2373
|
+
return /* @__PURE__ */ jsx21("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx21("div", { className: getClassName15(), children: /* @__PURE__ */ jsx21(CustomField, __spreadValues({}, mergedProps)) }) });
|
2292
2374
|
}
|
2293
2375
|
const children = defaultFields[field.type](mergedProps);
|
2294
2376
|
const Render2 = render[field.type];
|
2295
|
-
return /* @__PURE__ */
|
2296
|
-
|
2377
|
+
return /* @__PURE__ */ jsx21(
|
2378
|
+
NestedFieldContext.Provider,
|
2297
2379
|
{
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
onClick: (e) => {
|
2302
|
-
e.stopPropagation();
|
2380
|
+
value: {
|
2381
|
+
readOnlyFields: nestedFieldContext.readOnlyFields || (selectedItem == null ? void 0 : selectedItem.readOnly) || {},
|
2382
|
+
localName: nestedFieldContext.localName
|
2303
2383
|
},
|
2304
|
-
children: /* @__PURE__ */
|
2384
|
+
children: /* @__PURE__ */ jsx21(
|
2385
|
+
"div",
|
2386
|
+
{
|
2387
|
+
className: getClassNameWrapper(),
|
2388
|
+
onFocus,
|
2389
|
+
onBlur,
|
2390
|
+
onClick: (e) => {
|
2391
|
+
e.stopPropagation();
|
2392
|
+
},
|
2393
|
+
children: /* @__PURE__ */ jsx21(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
|
2394
|
+
}
|
2395
|
+
)
|
2305
2396
|
}
|
2306
2397
|
);
|
2307
2398
|
}
|
@@ -2329,11 +2420,11 @@ function AutoFieldPrivate(props) {
|
|
2329
2420
|
value: localValue,
|
2330
2421
|
onChange: onChangeLocal
|
2331
2422
|
};
|
2332
|
-
return /* @__PURE__ */
|
2423
|
+
return /* @__PURE__ */ jsx21(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
|
2333
2424
|
}
|
2334
2425
|
function AutoField(props) {
|
2335
|
-
const DefaultLabel =
|
2336
|
-
const DefaultLabel2 = (labelProps) => /* @__PURE__ */
|
2426
|
+
const DefaultLabel = useMemo5(() => {
|
2427
|
+
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ jsx21(
|
2337
2428
|
"div",
|
2338
2429
|
__spreadProps(__spreadValues({}, labelProps), {
|
2339
2430
|
className: getClassName15({ readOnly: props.readOnly })
|
@@ -2341,7 +2432,7 @@ function AutoField(props) {
|
|
2341
2432
|
);
|
2342
2433
|
return DefaultLabel2;
|
2343
2434
|
}, [props.readOnly]);
|
2344
|
-
return /* @__PURE__ */
|
2435
|
+
return /* @__PURE__ */ jsx21(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
|
2345
2436
|
}
|
2346
2437
|
|
2347
2438
|
// components/Drawer/index.tsx
|
@@ -2353,14 +2444,14 @@ var styles_module_default10 = { "Drawer": "_Drawer_1oa7v_1", "DrawerItem--disabl
|
|
2353
2444
|
|
2354
2445
|
// components/Drawer/index.tsx
|
2355
2446
|
import {
|
2356
|
-
createContext as
|
2357
|
-
useContext as
|
2358
|
-
useMemo as
|
2447
|
+
createContext as createContext3,
|
2448
|
+
useContext as useContext4,
|
2449
|
+
useMemo as useMemo6
|
2359
2450
|
} from "react";
|
2360
|
-
import { jsx as
|
2451
|
+
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
2361
2452
|
var getClassName16 = get_class_name_factory_default("Drawer", styles_module_default10);
|
2362
2453
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
|
2363
|
-
var drawerContext =
|
2454
|
+
var drawerContext = createContext3({
|
2364
2455
|
droppableId: ""
|
2365
2456
|
});
|
2366
2457
|
var DrawerDraggable = ({
|
@@ -2369,7 +2460,7 @@ var DrawerDraggable = ({
|
|
2369
2460
|
index,
|
2370
2461
|
isDragDisabled
|
2371
2462
|
}) => {
|
2372
|
-
return /* @__PURE__ */
|
2463
|
+
return /* @__PURE__ */ jsx22(
|
2373
2464
|
Draggable,
|
2374
2465
|
{
|
2375
2466
|
id,
|
@@ -2391,21 +2482,21 @@ var DrawerItem = ({
|
|
2391
2482
|
index,
|
2392
2483
|
isDragDisabled
|
2393
2484
|
}) => {
|
2394
|
-
const ctx =
|
2485
|
+
const ctx = useContext4(drawerContext);
|
2395
2486
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
2396
|
-
const CustomInner =
|
2397
|
-
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */
|
2487
|
+
const CustomInner = useMemo6(
|
2488
|
+
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ jsx22("div", { className: getClassNameItem2("default"), children: children2 })),
|
2398
2489
|
[children]
|
2399
2490
|
);
|
2400
|
-
return /* @__PURE__ */
|
2491
|
+
return /* @__PURE__ */ jsx22(
|
2401
2492
|
DrawerDraggable,
|
2402
2493
|
{
|
2403
2494
|
id: resolvedId,
|
2404
2495
|
index,
|
2405
2496
|
isDragDisabled,
|
2406
|
-
children: /* @__PURE__ */
|
2407
|
-
/* @__PURE__ */
|
2408
|
-
/* @__PURE__ */
|
2497
|
+
children: /* @__PURE__ */ jsx22(CustomInner, { name, children: /* @__PURE__ */ jsx22("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs10("div", { className: getClassNameItem2("draggable"), children: [
|
2498
|
+
/* @__PURE__ */ jsx22("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
2499
|
+
/* @__PURE__ */ jsx22("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx22(DragIcon, { isDragDisabled }) })
|
2409
2500
|
] }) }) })
|
2410
2501
|
}
|
2411
2502
|
);
|
@@ -2416,7 +2507,7 @@ var Drawer = ({
|
|
2416
2507
|
direction = "vertical"
|
2417
2508
|
}) => {
|
2418
2509
|
const droppableId = `component-list:${_droppableId}`;
|
2419
|
-
return /* @__PURE__ */
|
2510
|
+
return /* @__PURE__ */ jsx22(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ jsx22(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ jsxs10(
|
2420
2511
|
"div",
|
2421
2512
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
2422
2513
|
ref: provided.innerRef,
|
@@ -2425,7 +2516,7 @@ var Drawer = ({
|
|
2425
2516
|
}),
|
2426
2517
|
children: [
|
2427
2518
|
children,
|
2428
|
-
/* @__PURE__ */
|
2519
|
+
/* @__PURE__ */ jsx22("span", { style: { display: "none" }, children: provided.placeholder })
|
2429
2520
|
]
|
2430
2521
|
})
|
2431
2522
|
) }) });
|
@@ -2434,13 +2525,13 @@ Drawer.Item = DrawerItem;
|
|
2434
2525
|
|
2435
2526
|
// components/DropZone/index.tsx
|
2436
2527
|
init_react_import();
|
2437
|
-
import { useContext as
|
2528
|
+
import { useContext as useContext5, useEffect as useEffect12 } from "react";
|
2438
2529
|
|
2439
2530
|
// components/DraggableComponent/index.tsx
|
2440
2531
|
init_react_import();
|
2441
2532
|
import {
|
2442
2533
|
useEffect as useEffect11,
|
2443
|
-
useMemo as
|
2534
|
+
useMemo as useMemo7,
|
2444
2535
|
useState as useState12
|
2445
2536
|
} from "react";
|
2446
2537
|
import { Draggable as Draggable2 } from "@measured/dnd";
|
@@ -2488,7 +2579,7 @@ var isIos = () => [
|
|
2488
2579
|
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
2489
2580
|
|
2490
2581
|
// components/DraggableComponent/index.tsx
|
2491
|
-
import { jsx as
|
2582
|
+
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
2492
2583
|
var getClassName17 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
2493
2584
|
var space = 8;
|
2494
2585
|
var actionsOverlayTop = space * 6.5;
|
@@ -2497,7 +2588,7 @@ var actionsRight = space;
|
|
2497
2588
|
var DefaultActionBar = ({
|
2498
2589
|
label,
|
2499
2590
|
children
|
2500
|
-
}) => /* @__PURE__ */
|
2591
|
+
}) => /* @__PURE__ */ jsx23(ActionBar, { label, children: /* @__PURE__ */ jsx23(ActionBar.Group, { children }) });
|
2501
2592
|
var DraggableComponent = ({
|
2502
2593
|
children,
|
2503
2594
|
id,
|
@@ -2530,14 +2621,14 @@ var DraggableComponent = ({
|
|
2530
2621
|
setDisableSecondaryAnimation(true);
|
2531
2622
|
}
|
2532
2623
|
}, []);
|
2533
|
-
const CustomActionBar =
|
2624
|
+
const CustomActionBar = useMemo7(
|
2534
2625
|
() => overrides.actionBar || DefaultActionBar,
|
2535
2626
|
[overrides.actionBar]
|
2536
2627
|
);
|
2537
2628
|
const permissions = getPermissions({
|
2538
2629
|
item: selectedItem
|
2539
2630
|
});
|
2540
|
-
return /* @__PURE__ */
|
2631
|
+
return /* @__PURE__ */ jsx23(
|
2541
2632
|
El,
|
2542
2633
|
{
|
2543
2634
|
draggableId: id,
|
@@ -2567,15 +2658,15 @@ var DraggableComponent = ({
|
|
2567
2658
|
onClick,
|
2568
2659
|
children: [
|
2569
2660
|
debug,
|
2570
|
-
isLoading && /* @__PURE__ */
|
2571
|
-
isSelected && /* @__PURE__ */
|
2661
|
+
isLoading && /* @__PURE__ */ jsx23("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ jsx23(Loader, {}) }),
|
2662
|
+
isSelected && /* @__PURE__ */ jsx23(
|
2572
2663
|
"div",
|
2573
2664
|
{
|
2574
2665
|
className: getClassName17("actionsOverlay"),
|
2575
2666
|
style: {
|
2576
2667
|
top: actionsOverlayTop / zoomConfig.zoom
|
2577
2668
|
},
|
2578
|
-
children: /* @__PURE__ */
|
2669
|
+
children: /* @__PURE__ */ jsx23(
|
2579
2670
|
"div",
|
2580
2671
|
{
|
2581
2672
|
className: getClassName17("actions"),
|
@@ -2585,15 +2676,15 @@ var DraggableComponent = ({
|
|
2585
2676
|
right: actionsRight / zoomConfig.zoom
|
2586
2677
|
},
|
2587
2678
|
children: /* @__PURE__ */ jsxs11(CustomActionBar, { label, children: [
|
2588
|
-
permissions.duplicate && /* @__PURE__ */
|
2589
|
-
permissions.delete && /* @__PURE__ */
|
2679
|
+
permissions.duplicate && /* @__PURE__ */ jsx23(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx23(Copy, { size: 16 }) }),
|
2680
|
+
permissions.delete && /* @__PURE__ */ jsx23(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx23(Trash, { size: 16 }) })
|
2590
2681
|
] })
|
2591
2682
|
}
|
2592
2683
|
)
|
2593
2684
|
}
|
2594
2685
|
),
|
2595
|
-
/* @__PURE__ */
|
2596
|
-
/* @__PURE__ */
|
2686
|
+
/* @__PURE__ */ jsx23("div", { className: getClassName17("overlay") }),
|
2687
|
+
/* @__PURE__ */ jsx23("div", { className: getClassName17("contents"), children })
|
2597
2688
|
]
|
2598
2689
|
})
|
2599
2690
|
)
|
@@ -2609,7 +2700,7 @@ var styles_module_default12 = { "DropZone": "_DropZone_djoti_1", "DropZone-conte
|
|
2609
2700
|
// components/DropZone/context.tsx
|
2610
2701
|
init_react_import();
|
2611
2702
|
import {
|
2612
|
-
createContext as
|
2703
|
+
createContext as createContext4,
|
2613
2704
|
useCallback as useCallback6,
|
2614
2705
|
useState as useState13
|
2615
2706
|
} from "react";
|
@@ -2628,8 +2719,8 @@ var getZoneId = (zoneCompound) => {
|
|
2628
2719
|
};
|
2629
2720
|
|
2630
2721
|
// components/DropZone/context.tsx
|
2631
|
-
import { Fragment as Fragment9, jsx as
|
2632
|
-
var dropZoneContext =
|
2722
|
+
import { Fragment as Fragment9, jsx as jsx24 } from "react/jsx-runtime";
|
2723
|
+
var dropZoneContext = createContext4(null);
|
2633
2724
|
var DropZoneProvider = ({
|
2634
2725
|
children,
|
2635
2726
|
value
|
@@ -2706,7 +2797,7 @@ var DropZoneProvider = ({
|
|
2706
2797
|
[value, setPathData]
|
2707
2798
|
);
|
2708
2799
|
const [zoneWillDrag, setZoneWillDrag] = useState13("");
|
2709
|
-
return /* @__PURE__ */
|
2800
|
+
return /* @__PURE__ */ jsx24(Fragment9, { children: value && /* @__PURE__ */ jsx24(
|
2710
2801
|
dropZoneContext.Provider,
|
2711
2802
|
{
|
2712
2803
|
value: __spreadValues({
|
@@ -2732,12 +2823,12 @@ var DropZoneProvider = ({
|
|
2732
2823
|
};
|
2733
2824
|
|
2734
2825
|
// components/DropZone/index.tsx
|
2735
|
-
import { Fragment as Fragment10, jsx as
|
2826
|
+
import { Fragment as Fragment10, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
2736
2827
|
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
|
2737
2828
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
2738
2829
|
var _a;
|
2739
2830
|
const appContext2 = useAppContext();
|
2740
|
-
const ctx =
|
2831
|
+
const ctx = useContext5(dropZoneContext);
|
2741
2832
|
const {
|
2742
2833
|
// These all need setting via context
|
2743
2834
|
data,
|
@@ -2787,7 +2878,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2787
2878
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
2788
2879
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
2789
2880
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
2790
|
-
return /* @__PURE__ */
|
2881
|
+
return /* @__PURE__ */ jsx25("div", { children: "DropZone requires context to work." });
|
2791
2882
|
}
|
2792
2883
|
const {
|
2793
2884
|
hoveringArea = "root",
|
@@ -2828,7 +2919,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2828
2919
|
}
|
2829
2920
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
2830
2921
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
2831
|
-
return /* @__PURE__ */
|
2922
|
+
return /* @__PURE__ */ jsx25(
|
2832
2923
|
"div",
|
2833
2924
|
{
|
2834
2925
|
className: getClassName18({
|
@@ -2845,7 +2936,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2845
2936
|
onMouseUp: () => {
|
2846
2937
|
setZoneWillDrag("");
|
2847
2938
|
},
|
2848
|
-
children: /* @__PURE__ */
|
2939
|
+
children: /* @__PURE__ */ jsx25(
|
2849
2940
|
Droppable,
|
2850
2941
|
{
|
2851
2942
|
droppableId: zoneCompound,
|
@@ -2900,13 +2991,13 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2900
2991
|
className: getClassName18("item"),
|
2901
2992
|
style: { zIndex: isDragging ? 1 : void 0 },
|
2902
2993
|
children: [
|
2903
|
-
/* @__PURE__ */
|
2994
|
+
/* @__PURE__ */ jsx25(
|
2904
2995
|
DropZoneProvider,
|
2905
2996
|
{
|
2906
2997
|
value: __spreadProps(__spreadValues({}, ctx), {
|
2907
2998
|
areaId: componentId
|
2908
2999
|
}),
|
2909
|
-
children: /* @__PURE__ */
|
3000
|
+
children: /* @__PURE__ */ jsx25(
|
2910
3001
|
DraggableComponent,
|
2911
3002
|
{
|
2912
3003
|
label,
|
@@ -2974,12 +3065,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2974
3065
|
style: {
|
2975
3066
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
2976
3067
|
},
|
2977
|
-
children: /* @__PURE__ */
|
3068
|
+
children: /* @__PURE__ */ jsx25("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ jsx25(Render2, __spreadValues({}, defaultedProps)) })
|
2978
3069
|
}
|
2979
3070
|
)
|
2980
3071
|
}
|
2981
3072
|
),
|
2982
|
-
userIsDragging && /* @__PURE__ */
|
3073
|
+
userIsDragging && /* @__PURE__ */ jsx25(
|
2983
3074
|
"div",
|
2984
3075
|
{
|
2985
3076
|
className: getClassName18("hitbox"),
|
@@ -2996,7 +3087,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2996
3087
|
);
|
2997
3088
|
}),
|
2998
3089
|
provided == null ? void 0 : provided.placeholder,
|
2999
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */
|
3090
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ jsx25(
|
3000
3091
|
"div",
|
3001
3092
|
{
|
3002
3093
|
"data-puck-placeholder": true,
|
@@ -3017,7 +3108,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
3017
3108
|
);
|
3018
3109
|
}
|
3019
3110
|
function DropZoneRender({ zone }) {
|
3020
|
-
const ctx =
|
3111
|
+
const ctx = useContext5(dropZoneContext);
|
3021
3112
|
const { data, areaId = "root", config } = ctx || {};
|
3022
3113
|
let zoneCompound = rootDroppableId;
|
3023
3114
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -3028,14 +3119,14 @@ function DropZoneRender({ zone }) {
|
|
3028
3119
|
zoneCompound = `${areaId}:${zone}`;
|
3029
3120
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
3030
3121
|
}
|
3031
|
-
return /* @__PURE__ */
|
3122
|
+
return /* @__PURE__ */ jsx25(Fragment10, { children: content.map((item) => {
|
3032
3123
|
const Component = config.components[item.type];
|
3033
3124
|
if (Component) {
|
3034
|
-
return /* @__PURE__ */
|
3125
|
+
return /* @__PURE__ */ jsx25(
|
3035
3126
|
DropZoneProvider,
|
3036
3127
|
{
|
3037
3128
|
value: { data, config, areaId: item.props.id },
|
3038
|
-
children: /* @__PURE__ */
|
3129
|
+
children: /* @__PURE__ */ jsx25(
|
3039
3130
|
Component.render,
|
3040
3131
|
__spreadProps(__spreadValues({}, item.props), {
|
3041
3132
|
puck: { renderDropZone: DropZone }
|
@@ -3049,11 +3140,11 @@ function DropZoneRender({ zone }) {
|
|
3049
3140
|
}) });
|
3050
3141
|
}
|
3051
3142
|
function DropZone(props) {
|
3052
|
-
const ctx =
|
3143
|
+
const ctx = useContext5(dropZoneContext);
|
3053
3144
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
3054
|
-
return /* @__PURE__ */
|
3145
|
+
return /* @__PURE__ */ jsx25(DropZoneEdit, __spreadValues({}, props));
|
3055
3146
|
}
|
3056
|
-
return /* @__PURE__ */
|
3147
|
+
return /* @__PURE__ */ jsx25(DropZoneRender, __spreadValues({}, props));
|
3057
3148
|
}
|
3058
3149
|
|
3059
3150
|
// components/Puck/index.tsx
|
@@ -3061,7 +3152,7 @@ init_react_import();
|
|
3061
3152
|
import {
|
3062
3153
|
useCallback as useCallback11,
|
3063
3154
|
useEffect as useEffect18,
|
3064
|
-
useMemo as
|
3155
|
+
useMemo as useMemo16,
|
3065
3156
|
useReducer,
|
3066
3157
|
useState as useState21
|
3067
3158
|
} from "react";
|
@@ -3073,11 +3164,11 @@ import { useState as useState14 } from "react";
|
|
3073
3164
|
// lib/get-frame.ts
|
3074
3165
|
init_react_import();
|
3075
3166
|
var getFrame = () => {
|
3076
|
-
let
|
3077
|
-
if ((
|
3078
|
-
|
3167
|
+
let frameEl = document.querySelector("#preview-frame");
|
3168
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
3169
|
+
return frameEl.contentDocument || document;
|
3079
3170
|
}
|
3080
|
-
return
|
3171
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
3081
3172
|
};
|
3082
3173
|
|
3083
3174
|
// lib/use-placeholder-style.ts
|
@@ -3136,7 +3227,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
|
|
3136
3227
|
|
3137
3228
|
// lib/use-breadcrumbs.ts
|
3138
3229
|
init_react_import();
|
3139
|
-
import { useContext as
|
3230
|
+
import { useContext as useContext6, useMemo as useMemo8 } from "react";
|
3140
3231
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
3141
3232
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
3142
3233
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -3186,8 +3277,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
3186
3277
|
state: { data },
|
3187
3278
|
selectedItem
|
3188
3279
|
} = useAppContext();
|
3189
|
-
const dzContext =
|
3190
|
-
return
|
3280
|
+
const dzContext = useContext6(dropZoneContext);
|
3281
|
+
return useMemo8(() => {
|
3191
3282
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
3192
3283
|
selectedItem,
|
3193
3284
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -3201,7 +3292,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
3201
3292
|
};
|
3202
3293
|
|
3203
3294
|
// components/SidebarSection/index.tsx
|
3204
|
-
import { jsx as
|
3295
|
+
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
3205
3296
|
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
3206
3297
|
var SidebarSection = ({
|
3207
3298
|
children,
|
@@ -3220,9 +3311,9 @@ var SidebarSection = ({
|
|
3220
3311
|
className: getClassName19({ noBorderTop, noPadding }),
|
3221
3312
|
style: { background },
|
3222
3313
|
children: [
|
3223
|
-
/* @__PURE__ */
|
3314
|
+
/* @__PURE__ */ jsx26("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumbs"), children: [
|
3224
3315
|
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumb"), children: [
|
3225
|
-
/* @__PURE__ */
|
3316
|
+
/* @__PURE__ */ jsx26(
|
3226
3317
|
"button",
|
3227
3318
|
{
|
3228
3319
|
type: "button",
|
@@ -3231,12 +3322,12 @@ var SidebarSection = ({
|
|
3231
3322
|
children: breadcrumb.label
|
3232
3323
|
}
|
3233
3324
|
),
|
3234
|
-
/* @__PURE__ */
|
3325
|
+
/* @__PURE__ */ jsx26(ChevronRight, { size: 16 })
|
3235
3326
|
] }, i)) : null,
|
3236
|
-
/* @__PURE__ */
|
3327
|
+
/* @__PURE__ */ jsx26("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx26(Heading, { rank: "2", size: "xs", children: title }) })
|
3237
3328
|
] }) }),
|
3238
|
-
/* @__PURE__ */
|
3239
|
-
isLoading && /* @__PURE__ */
|
3329
|
+
/* @__PURE__ */ jsx26("div", { className: getClassName19("content"), children }),
|
3330
|
+
isLoading && /* @__PURE__ */ jsx26("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx26(Loader, { size: 32 }) })
|
3240
3331
|
]
|
3241
3332
|
}
|
3242
3333
|
);
|
@@ -3439,6 +3530,9 @@ function reduceData(data, action, config) {
|
|
3439
3530
|
});
|
3440
3531
|
}
|
3441
3532
|
if (action.type === "move") {
|
3533
|
+
if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
|
3534
|
+
return data;
|
3535
|
+
}
|
3442
3536
|
const newData = setupZone(
|
3443
3537
|
setupZone(data, action.sourceZone),
|
3444
3538
|
action.destinationZone
|
@@ -3617,7 +3711,7 @@ init_react_import();
|
|
3617
3711
|
var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
3618
3712
|
|
3619
3713
|
// components/MenuBar/index.tsx
|
3620
|
-
import { Fragment as Fragment11, jsx as
|
3714
|
+
import { Fragment as Fragment11, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
3621
3715
|
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
3622
3716
|
function MenuBar({
|
3623
3717
|
appState,
|
@@ -3631,7 +3725,7 @@ function MenuBar({
|
|
3631
3725
|
history: { back, forward, historyStore }
|
3632
3726
|
} = useAppContext();
|
3633
3727
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
3634
|
-
return /* @__PURE__ */
|
3728
|
+
return /* @__PURE__ */ jsx27(
|
3635
3729
|
"div",
|
3636
3730
|
{
|
3637
3731
|
className: getClassName20({ menuOpen }),
|
@@ -3647,10 +3741,10 @@ function MenuBar({
|
|
3647
3741
|
},
|
3648
3742
|
children: /* @__PURE__ */ jsxs14("div", { className: getClassName20("inner"), children: [
|
3649
3743
|
/* @__PURE__ */ jsxs14("div", { className: getClassName20("history"), children: [
|
3650
|
-
/* @__PURE__ */
|
3651
|
-
/* @__PURE__ */
|
3744
|
+
/* @__PURE__ */ jsx27(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ jsx27(Undo2, { size: 21 }) }),
|
3745
|
+
/* @__PURE__ */ jsx27(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ jsx27(Redo2, { size: 21 }) })
|
3652
3746
|
] }),
|
3653
|
-
/* @__PURE__ */
|
3747
|
+
/* @__PURE__ */ jsx27(Fragment11, { children: renderHeaderActions && renderHeaderActions({
|
3654
3748
|
state: appState,
|
3655
3749
|
dispatch
|
3656
3750
|
}) })
|
@@ -3671,15 +3765,15 @@ init_react_import();
|
|
3671
3765
|
var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
|
3672
3766
|
|
3673
3767
|
// components/Puck/components/Fields/index.tsx
|
3674
|
-
import { useCallback as useCallback7, useEffect as useEffect13, useMemo as
|
3768
|
+
import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo9, useState as useState15 } from "react";
|
3675
3769
|
|
3676
3770
|
// lib/use-parent.ts
|
3677
3771
|
init_react_import();
|
3678
|
-
import { useContext as
|
3772
|
+
import { useContext as useContext7 } from "react";
|
3679
3773
|
var useParent = (itemSelector) => {
|
3680
3774
|
var _a;
|
3681
3775
|
const { selectedItem, state } = useAppContext();
|
3682
|
-
const { pathData } =
|
3776
|
+
const { pathData } = useContext7(dropZoneContext) || {};
|
3683
3777
|
const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
|
3684
3778
|
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
3685
3779
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
@@ -3688,7 +3782,7 @@ var useParent = (itemSelector) => {
|
|
3688
3782
|
};
|
3689
3783
|
|
3690
3784
|
// components/Puck/components/Fields/index.tsx
|
3691
|
-
import { Fragment as Fragment12, jsx as
|
3785
|
+
import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
3692
3786
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
3693
3787
|
var defaultPageFields = {
|
3694
3788
|
title: { type: "text" }
|
@@ -3696,7 +3790,7 @@ var defaultPageFields = {
|
|
3696
3790
|
var DefaultFields = ({
|
3697
3791
|
children
|
3698
3792
|
}) => {
|
3699
|
-
return /* @__PURE__ */
|
3793
|
+
return /* @__PURE__ */ jsx28(Fragment12, { children });
|
3700
3794
|
};
|
3701
3795
|
var useResolvedFields = () => {
|
3702
3796
|
var _a, _b;
|
@@ -3705,7 +3799,7 @@ var useResolvedFields = () => {
|
|
3705
3799
|
const { data } = state;
|
3706
3800
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
3707
3801
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
3708
|
-
const defaultFields =
|
3802
|
+
const defaultFields = useMemo9(
|
3709
3803
|
() => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
|
3710
3804
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
3711
3805
|
);
|
@@ -3754,19 +3848,33 @@ var useResolvedFields = () => {
|
|
3754
3848
|
lastData
|
3755
3849
|
});
|
3756
3850
|
}),
|
3757
|
-
[data, config, componentData, selectedItem, resolvedFields, state]
|
3851
|
+
[data, config, componentData, selectedItem, resolvedFields, state, parent]
|
3758
3852
|
);
|
3853
|
+
const [hasParent, setHasParent] = useState15(false);
|
3759
3854
|
useEffect13(() => {
|
3760
|
-
|
3761
|
-
|
3762
|
-
|
3763
|
-
|
3764
|
-
|
3765
|
-
|
3766
|
-
|
3767
|
-
|
3855
|
+
setHasParent(!!parent);
|
3856
|
+
}, [parent]);
|
3857
|
+
useEffect13(() => {
|
3858
|
+
var _a2;
|
3859
|
+
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || hasParent) {
|
3860
|
+
if (hasResolver) {
|
3861
|
+
setFieldsLoading(true);
|
3862
|
+
resolveFields(defaultFields).then((fields) => {
|
3863
|
+
setResolvedFields(fields || {});
|
3864
|
+
setFieldsLoading(false);
|
3865
|
+
});
|
3866
|
+
} else {
|
3867
|
+
setResolvedFields(defaultFields);
|
3868
|
+
}
|
3768
3869
|
}
|
3769
|
-
}, [
|
3870
|
+
}, [
|
3871
|
+
data,
|
3872
|
+
defaultFields,
|
3873
|
+
state.ui.itemSelector,
|
3874
|
+
selectedItem,
|
3875
|
+
hasResolver,
|
3876
|
+
hasParent
|
3877
|
+
]);
|
3770
3878
|
return [resolvedFields, fieldsLoading];
|
3771
3879
|
};
|
3772
3880
|
var Fields = () => {
|
@@ -3787,7 +3895,7 @@ var Fields = () => {
|
|
3787
3895
|
const componentResolving = selectedItem ? ((_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loadingCount) > 0 : ((_b = componentState["puck-root"]) == null ? void 0 : _b.loadingCount) > 0;
|
3788
3896
|
const isLoading = fieldsResolving || componentResolving;
|
3789
3897
|
const rootProps = data.root.props || data.root;
|
3790
|
-
const Wrapper =
|
3898
|
+
const Wrapper = useMemo9(() => overrides.fields || DefaultFields, [overrides]);
|
3791
3899
|
return /* @__PURE__ */ jsxs15(
|
3792
3900
|
"form",
|
3793
3901
|
{
|
@@ -3796,7 +3904,7 @@ var Fields = () => {
|
|
3796
3904
|
e.preventDefault();
|
3797
3905
|
},
|
3798
3906
|
children: [
|
3799
|
-
/* @__PURE__ */
|
3907
|
+
/* @__PURE__ */ jsx28(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
3800
3908
|
const field = fields[fieldName];
|
3801
3909
|
if (!(field == null ? void 0 : field.type)) return null;
|
3802
3910
|
const onChange = (value, updatedUi) => {
|
@@ -3867,7 +3975,7 @@ var Fields = () => {
|
|
3867
3975
|
item: selectedItem
|
3868
3976
|
});
|
3869
3977
|
const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
|
3870
|
-
return /* @__PURE__ */
|
3978
|
+
return /* @__PURE__ */ jsx28(
|
3871
3979
|
AutoFieldPrivate,
|
3872
3980
|
{
|
3873
3981
|
field,
|
@@ -3885,7 +3993,7 @@ var Fields = () => {
|
|
3885
3993
|
root: true
|
3886
3994
|
});
|
3887
3995
|
const id = `root_${field.type}_${fieldName}`;
|
3888
|
-
return /* @__PURE__ */
|
3996
|
+
return /* @__PURE__ */ jsx28(
|
3889
3997
|
AutoFieldPrivate,
|
3890
3998
|
{
|
3891
3999
|
field,
|
@@ -3899,7 +4007,7 @@ var Fields = () => {
|
|
3899
4007
|
);
|
3900
4008
|
}
|
3901
4009
|
}) }),
|
3902
|
-
isLoading && /* @__PURE__ */
|
4010
|
+
isLoading && /* @__PURE__ */ jsx28("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx28("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx28(Loader, { size: 16 }) }) })
|
3903
4011
|
]
|
3904
4012
|
}
|
3905
4013
|
);
|
@@ -3920,7 +4028,7 @@ init_react_import();
|
|
3920
4028
|
var styles_module_default17 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
|
3921
4029
|
|
3922
4030
|
// components/ComponentList/index.tsx
|
3923
|
-
import { jsx as
|
4031
|
+
import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
3924
4032
|
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
3925
4033
|
var ComponentListItem = ({
|
3926
4034
|
name,
|
@@ -3931,7 +4039,7 @@ var ComponentListItem = ({
|
|
3931
4039
|
const canInsert = getPermissions({
|
3932
4040
|
type: name
|
3933
4041
|
}).insert;
|
3934
|
-
return /* @__PURE__ */
|
4042
|
+
return /* @__PURE__ */ jsx29(
|
3935
4043
|
Drawer.Item,
|
3936
4044
|
{
|
3937
4045
|
label,
|
@@ -3964,14 +4072,14 @@ var ComponentList = ({
|
|
3964
4072
|
}),
|
3965
4073
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
3966
4074
|
children: [
|
3967
|
-
/* @__PURE__ */
|
3968
|
-
/* @__PURE__ */
|
4075
|
+
/* @__PURE__ */ jsx29("div", { children: title }),
|
4076
|
+
/* @__PURE__ */ jsx29("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx29(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx29(ChevronDown, { size: 12 }) })
|
3969
4077
|
]
|
3970
4078
|
}
|
3971
4079
|
),
|
3972
|
-
/* @__PURE__ */
|
4080
|
+
/* @__PURE__ */ jsx29("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx29(Drawer, { droppableId: title, children: children || Object.keys(config.components).map((componentKey, i) => {
|
3973
4081
|
var _a;
|
3974
|
-
return /* @__PURE__ */
|
4082
|
+
return /* @__PURE__ */ jsx29(
|
3975
4083
|
ComponentListItem,
|
3976
4084
|
{
|
3977
4085
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -3986,7 +4094,7 @@ var ComponentList = ({
|
|
3986
4094
|
ComponentList.Item = ComponentListItem;
|
3987
4095
|
|
3988
4096
|
// lib/use-component-list.tsx
|
3989
|
-
import { jsx as
|
4097
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
3990
4098
|
var useComponentList = (config, ui) => {
|
3991
4099
|
const [componentList, setComponentList] = useState16();
|
3992
4100
|
useEffect14(() => {
|
@@ -3999,7 +4107,7 @@ var useComponentList = (config, ui) => {
|
|
3999
4107
|
if (category.visible === false || !category.components) {
|
4000
4108
|
return null;
|
4001
4109
|
}
|
4002
|
-
return /* @__PURE__ */
|
4110
|
+
return /* @__PURE__ */ jsx30(
|
4003
4111
|
ComponentList,
|
4004
4112
|
{
|
4005
4113
|
id: categoryKey,
|
@@ -4008,7 +4116,7 @@ var useComponentList = (config, ui) => {
|
|
4008
4116
|
var _a2;
|
4009
4117
|
matchedComponents.push(componentName);
|
4010
4118
|
const componentConf = config.components[componentName] || {};
|
4011
|
-
return /* @__PURE__ */
|
4119
|
+
return /* @__PURE__ */ jsx30(
|
4012
4120
|
ComponentList.Item,
|
4013
4121
|
{
|
4014
4122
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
@@ -4028,7 +4136,7 @@ var useComponentList = (config, ui) => {
|
|
4028
4136
|
);
|
4029
4137
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
4030
4138
|
_componentList.push(
|
4031
|
-
/* @__PURE__ */
|
4139
|
+
/* @__PURE__ */ jsx30(
|
4032
4140
|
ComponentList,
|
4033
4141
|
{
|
4034
4142
|
id: "other",
|
@@ -4036,7 +4144,7 @@ var useComponentList = (config, ui) => {
|
|
4036
4144
|
children: remainingComponents.map((componentName, i) => {
|
4037
4145
|
var _a2;
|
4038
4146
|
const componentConf = config.components[componentName] || {};
|
4039
|
-
return /* @__PURE__ */
|
4147
|
+
return /* @__PURE__ */ jsx30(
|
4040
4148
|
ComponentList.Item,
|
4041
4149
|
{
|
4042
4150
|
name: componentName,
|
@@ -4058,31 +4166,31 @@ var useComponentList = (config, ui) => {
|
|
4058
4166
|
};
|
4059
4167
|
|
4060
4168
|
// components/Puck/components/Components/index.tsx
|
4061
|
-
import { useMemo as
|
4062
|
-
import { jsx as
|
4169
|
+
import { useMemo as useMemo10 } from "react";
|
4170
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
4063
4171
|
var Components = () => {
|
4064
4172
|
const { config, state, overrides } = useAppContext();
|
4065
4173
|
const componentList = useComponentList(config, state.ui);
|
4066
|
-
const Wrapper =
|
4067
|
-
return /* @__PURE__ */
|
4174
|
+
const Wrapper = useMemo10(() => overrides.components || "div", [overrides]);
|
4175
|
+
return /* @__PURE__ */ jsx31(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx31(ComponentList, { id: "all" }) });
|
4068
4176
|
};
|
4069
4177
|
|
4070
4178
|
// components/Puck/components/Preview/index.tsx
|
4071
4179
|
init_react_import();
|
4072
|
-
import { useCallback as useCallback8, useMemo as
|
4180
|
+
import { useCallback as useCallback8, useMemo as useMemo11 } from "react";
|
4073
4181
|
|
4074
4182
|
// components/AutoFrame/index.tsx
|
4075
4183
|
init_react_import();
|
4076
4184
|
import {
|
4077
|
-
createContext as
|
4078
|
-
useContext as
|
4185
|
+
createContext as createContext5,
|
4186
|
+
useContext as useContext8,
|
4079
4187
|
useEffect as useEffect15,
|
4080
|
-
useRef as
|
4188
|
+
useRef as useRef2,
|
4081
4189
|
useState as useState17
|
4082
4190
|
} from "react";
|
4083
4191
|
import hash from "object-hash";
|
4084
4192
|
import { createPortal as createPortal2 } from "react-dom";
|
4085
|
-
import { Fragment as Fragment13, jsx as
|
4193
|
+
import { Fragment as Fragment13, jsx as jsx32 } from "react/jsx-runtime";
|
4086
4194
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
4087
4195
|
var collectStyles = (doc) => {
|
4088
4196
|
const collected = [];
|
@@ -4282,10 +4390,10 @@ var CopyHostStyles = ({
|
|
4282
4390
|
observer.disconnect();
|
4283
4391
|
};
|
4284
4392
|
}, []);
|
4285
|
-
return /* @__PURE__ */
|
4393
|
+
return /* @__PURE__ */ jsx32(Fragment13, { children });
|
4286
4394
|
};
|
4287
|
-
var autoFrameContext =
|
4288
|
-
var useFrame = () =>
|
4395
|
+
var autoFrameContext = createContext5({});
|
4396
|
+
var useFrame = () => useContext8(autoFrameContext);
|
4289
4397
|
function AutoFrame(_a) {
|
4290
4398
|
var _b = _a, {
|
4291
4399
|
children,
|
@@ -4302,7 +4410,7 @@ function AutoFrame(_a) {
|
|
4302
4410
|
]);
|
4303
4411
|
const [loaded, setLoaded] = useState17(false);
|
4304
4412
|
const [ctx, setCtx] = useState17({});
|
4305
|
-
const ref =
|
4413
|
+
const ref = useRef2(null);
|
4306
4414
|
const [mountTarget, setMountTarget] = useState17();
|
4307
4415
|
useEffect15(() => {
|
4308
4416
|
var _a2;
|
@@ -4314,7 +4422,7 @@ function AutoFrame(_a) {
|
|
4314
4422
|
setMountTarget((_a2 = ref.current.contentDocument) == null ? void 0 : _a2.getElementById("frame-root"));
|
4315
4423
|
}
|
4316
4424
|
}, [ref, loaded]);
|
4317
|
-
return /* @__PURE__ */
|
4425
|
+
return /* @__PURE__ */ jsx32(
|
4318
4426
|
"iframe",
|
4319
4427
|
__spreadProps(__spreadValues({}, props), {
|
4320
4428
|
className,
|
@@ -4324,7 +4432,7 @@ function AutoFrame(_a) {
|
|
4324
4432
|
onLoad: () => {
|
4325
4433
|
setLoaded(true);
|
4326
4434
|
},
|
4327
|
-
children: /* @__PURE__ */
|
4435
|
+
children: /* @__PURE__ */ jsx32(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx32(CopyHostStyles, { debug, onStylesLoaded, children: createPortal2(children, mountTarget) }) })
|
4328
4436
|
})
|
4329
4437
|
);
|
4330
4438
|
}
|
@@ -4336,7 +4444,7 @@ init_react_import();
|
|
4336
4444
|
var styles_module_default18 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
4337
4445
|
|
4338
4446
|
// components/Puck/components/Preview/index.tsx
|
4339
|
-
import { Fragment as Fragment14, jsx as
|
4447
|
+
import { Fragment as Fragment14, jsx as jsx33 } from "react/jsx-runtime";
|
4340
4448
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
4341
4449
|
var Preview = ({ id = "puck-preview" }) => {
|
4342
4450
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
@@ -4345,13 +4453,13 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4345
4453
|
var _a, _b;
|
4346
4454
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
4347
4455
|
id: "puck-root"
|
4348
|
-
}, pageProps)) : /* @__PURE__ */
|
4456
|
+
}, pageProps)) : /* @__PURE__ */ jsx33(Fragment14, { children: pageProps.children });
|
4349
4457
|
},
|
4350
4458
|
[config.root]
|
4351
4459
|
);
|
4352
|
-
const Frame =
|
4460
|
+
const Frame = useMemo11(() => overrides.iframe, [overrides]);
|
4353
4461
|
const rootProps = state.data.root.props || state.data.root;
|
4354
|
-
return /* @__PURE__ */
|
4462
|
+
return /* @__PURE__ */ jsx33(
|
4355
4463
|
"div",
|
4356
4464
|
{
|
4357
4465
|
className: getClassName23(),
|
@@ -4359,7 +4467,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4359
4467
|
onClick: () => {
|
4360
4468
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
4361
4469
|
},
|
4362
|
-
children: iframe.enabled ? /* @__PURE__ */
|
4470
|
+
children: iframe.enabled ? /* @__PURE__ */ jsx33(
|
4363
4471
|
AutoFrame_default,
|
4364
4472
|
{
|
4365
4473
|
id: "preview-frame",
|
@@ -4368,27 +4476,27 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4368
4476
|
onStylesLoaded: () => {
|
4369
4477
|
setStatus("READY");
|
4370
4478
|
},
|
4371
|
-
children: /* @__PURE__ */
|
4372
|
-
const inner = /* @__PURE__ */
|
4479
|
+
children: /* @__PURE__ */ jsx33(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
4480
|
+
const inner = /* @__PURE__ */ jsx33(
|
4373
4481
|
Page,
|
4374
4482
|
__spreadProps(__spreadValues({}, rootProps), {
|
4375
4483
|
puck: { renderDropZone: DropZone, isEditing: true },
|
4376
4484
|
editMode: true,
|
4377
|
-
children: /* @__PURE__ */
|
4485
|
+
children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
|
4378
4486
|
})
|
4379
4487
|
);
|
4380
4488
|
if (Frame) {
|
4381
|
-
return /* @__PURE__ */
|
4489
|
+
return /* @__PURE__ */ jsx33(Frame, { document: document2, children: inner });
|
4382
4490
|
}
|
4383
4491
|
return inner;
|
4384
4492
|
} })
|
4385
4493
|
}
|
4386
|
-
) : /* @__PURE__ */
|
4494
|
+
) : /* @__PURE__ */ jsx33("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ jsx33(
|
4387
4495
|
Page,
|
4388
4496
|
__spreadProps(__spreadValues({}, rootProps), {
|
4389
4497
|
puck: { renderDropZone: DropZone, isEditing: true },
|
4390
4498
|
editMode: true,
|
4391
|
-
children: /* @__PURE__ */
|
4499
|
+
children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
|
4392
4500
|
})
|
4393
4501
|
) })
|
4394
4502
|
}
|
@@ -4438,7 +4546,7 @@ var scrollIntoView = (el) => {
|
|
4438
4546
|
};
|
4439
4547
|
|
4440
4548
|
// components/LayerTree/index.tsx
|
4441
|
-
import { useContext as
|
4549
|
+
import { useContext as useContext9 } from "react";
|
4442
4550
|
|
4443
4551
|
// lib/is-child-of-zone.ts
|
4444
4552
|
init_react_import();
|
@@ -4452,7 +4560,7 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
4452
4560
|
};
|
4453
4561
|
|
4454
4562
|
// components/LayerTree/index.tsx
|
4455
|
-
import { Fragment as Fragment15, jsx as
|
4563
|
+
import { Fragment as Fragment15, jsx as jsx34, jsxs as jsxs17 } from "react/jsx-runtime";
|
4456
4564
|
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
4457
4565
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
4458
4566
|
var LayerTree = ({
|
@@ -4465,15 +4573,15 @@ var LayerTree = ({
|
|
4465
4573
|
label
|
4466
4574
|
}) => {
|
4467
4575
|
const zones = data.zones || {};
|
4468
|
-
const ctx =
|
4576
|
+
const ctx = useContext9(dropZoneContext);
|
4469
4577
|
return /* @__PURE__ */ jsxs17(Fragment15, { children: [
|
4470
4578
|
label && /* @__PURE__ */ jsxs17("div", { className: getClassName24("zoneTitle"), children: [
|
4471
|
-
/* @__PURE__ */
|
4579
|
+
/* @__PURE__ */ jsx34("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx34(Layers, { size: "16" }) }),
|
4472
4580
|
" ",
|
4473
4581
|
label
|
4474
4582
|
] }),
|
4475
4583
|
/* @__PURE__ */ jsxs17("ul", { className: getClassName24(), children: [
|
4476
|
-
zoneContent.length === 0 && /* @__PURE__ */
|
4584
|
+
zoneContent.length === 0 && /* @__PURE__ */ jsx34("div", { className: getClassName24("helper"), children: "No items" }),
|
4477
4585
|
zoneContent.map((item, i) => {
|
4478
4586
|
var _a;
|
4479
4587
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -4501,7 +4609,7 @@ var LayerTree = ({
|
|
4501
4609
|
childIsSelected
|
4502
4610
|
}),
|
4503
4611
|
children: [
|
4504
|
-
/* @__PURE__ */
|
4612
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs17(
|
4505
4613
|
"button",
|
4506
4614
|
{
|
4507
4615
|
type: "button",
|
@@ -4534,22 +4642,22 @@ var LayerTree = ({
|
|
4534
4642
|
setHoveringComponent(null);
|
4535
4643
|
},
|
4536
4644
|
children: [
|
4537
|
-
containsZone && /* @__PURE__ */
|
4645
|
+
containsZone && /* @__PURE__ */ jsx34(
|
4538
4646
|
"div",
|
4539
4647
|
{
|
4540
4648
|
className: getClassNameLayer("chevron"),
|
4541
4649
|
title: isSelected ? "Collapse" : "Expand",
|
4542
|
-
children: /* @__PURE__ */
|
4650
|
+
children: /* @__PURE__ */ jsx34(ChevronDown, { size: "12" })
|
4543
4651
|
}
|
4544
4652
|
),
|
4545
4653
|
/* @__PURE__ */ jsxs17("div", { className: getClassNameLayer("title"), children: [
|
4546
|
-
/* @__PURE__ */
|
4547
|
-
/* @__PURE__ */
|
4654
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx34(Type, { size: "16" }) : /* @__PURE__ */ jsx34(LayoutGrid, { size: "16" }) }),
|
4655
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("name"), children: label2 })
|
4548
4656
|
] })
|
4549
4657
|
]
|
4550
4658
|
}
|
4551
4659
|
) }),
|
4552
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */
|
4660
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx34(
|
4553
4661
|
LayerTree,
|
4554
4662
|
{
|
4555
4663
|
config,
|
@@ -4571,8 +4679,8 @@ var LayerTree = ({
|
|
4571
4679
|
};
|
4572
4680
|
|
4573
4681
|
// components/Puck/components/Outline/index.tsx
|
4574
|
-
import { useCallback as useCallback9, useMemo as
|
4575
|
-
import { Fragment as Fragment16, jsx as
|
4682
|
+
import { useCallback as useCallback9, useMemo as useMemo12 } from "react";
|
4683
|
+
import { Fragment as Fragment16, jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
|
4576
4684
|
var Outline = () => {
|
4577
4685
|
const { dispatch, state, overrides, config } = useAppContext();
|
4578
4686
|
const { data, ui } = state;
|
@@ -4586,9 +4694,9 @@ var Outline = () => {
|
|
4586
4694
|
},
|
4587
4695
|
[]
|
4588
4696
|
);
|
4589
|
-
const Wrapper =
|
4590
|
-
return /* @__PURE__ */
|
4591
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */
|
4697
|
+
const Wrapper = useMemo12(() => overrides.outline || "div", [overrides]);
|
4698
|
+
return /* @__PURE__ */ jsx35(Wrapper, { children: /* @__PURE__ */ jsx35(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs18(Fragment16, { children: [
|
4699
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx35(
|
4592
4700
|
LayerTree,
|
4593
4701
|
{
|
4594
4702
|
config,
|
@@ -4601,7 +4709,7 @@ var Outline = () => {
|
|
4601
4709
|
),
|
4602
4710
|
Object.entries(findZonesForArea(data, "root")).map(
|
4603
4711
|
([zoneKey, zone]) => {
|
4604
|
-
return /* @__PURE__ */
|
4712
|
+
return /* @__PURE__ */ jsx35(
|
4605
4713
|
LayerTree,
|
4606
4714
|
{
|
4607
4715
|
config,
|
@@ -4625,7 +4733,8 @@ import { useHotkeys } from "react-hotkeys-hook";
|
|
4625
4733
|
function usePuckHistory({
|
4626
4734
|
dispatch,
|
4627
4735
|
initialAppState,
|
4628
|
-
historyStore
|
4736
|
+
historyStore,
|
4737
|
+
iframeEnabled
|
4629
4738
|
}) {
|
4630
4739
|
const back = () => {
|
4631
4740
|
var _a;
|
@@ -4643,6 +4752,16 @@ function usePuckHistory({
|
|
4643
4752
|
historyStore.forward();
|
4644
4753
|
}
|
4645
4754
|
};
|
4755
|
+
const backIframe = () => {
|
4756
|
+
if (iframeEnabled) {
|
4757
|
+
back();
|
4758
|
+
}
|
4759
|
+
};
|
4760
|
+
const forwardIframe = () => {
|
4761
|
+
if (iframeEnabled) {
|
4762
|
+
forward();
|
4763
|
+
}
|
4764
|
+
};
|
4646
4765
|
const setHistories = (histories) => {
|
4647
4766
|
var _a;
|
4648
4767
|
dispatch({
|
@@ -4661,9 +4780,23 @@ function usePuckHistory({
|
|
4661
4780
|
historyStore.setHistoryIndex(index);
|
4662
4781
|
}
|
4663
4782
|
};
|
4783
|
+
const frame = getFrame();
|
4784
|
+
const resolvedFrame = frame !== document ? frame : void 0;
|
4664
4785
|
useHotkeys("meta+z", back, { preventDefault: true });
|
4665
4786
|
useHotkeys("meta+shift+z", forward, { preventDefault: true });
|
4666
4787
|
useHotkeys("meta+y", forward, { preventDefault: true });
|
4788
|
+
useHotkeys("meta+z", backIframe, {
|
4789
|
+
preventDefault: true,
|
4790
|
+
document: resolvedFrame
|
4791
|
+
});
|
4792
|
+
useHotkeys("meta+shift+z", forwardIframe, {
|
4793
|
+
preventDefault: true,
|
4794
|
+
document: resolvedFrame
|
4795
|
+
});
|
4796
|
+
useHotkeys("meta+y", forwardIframe, {
|
4797
|
+
preventDefault: true,
|
4798
|
+
document: resolvedFrame
|
4799
|
+
});
|
4667
4800
|
return {
|
4668
4801
|
back,
|
4669
4802
|
forward,
|
@@ -4850,25 +4983,25 @@ var getBox = function getBox2(el) {
|
|
4850
4983
|
import {
|
4851
4984
|
useCallback as useCallback10,
|
4852
4985
|
useEffect as useEffect17,
|
4853
|
-
useMemo as
|
4854
|
-
useRef as
|
4986
|
+
useMemo as useMemo14,
|
4987
|
+
useRef as useRef3,
|
4855
4988
|
useState as useState20
|
4856
4989
|
} from "react";
|
4857
4990
|
|
4858
4991
|
// components/ViewportControls/index.tsx
|
4859
4992
|
init_react_import();
|
4860
|
-
import { useEffect as useEffect16, useMemo as
|
4993
|
+
import { useEffect as useEffect16, useMemo as useMemo13, useState as useState19 } from "react";
|
4861
4994
|
|
4862
4995
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
4863
4996
|
init_react_import();
|
4864
4997
|
var styles_module_default20 = { "ViewportControls": "_ViewportControls_g1wgg_1", "ViewportControls-divider": "_ViewportControls-divider_g1wgg_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_g1wgg_21", "ViewportButton--isActive": "_ViewportButton--isActive_g1wgg_34", "ViewportButton-inner": "_ViewportButton-inner_g1wgg_34" };
|
4865
4998
|
|
4866
4999
|
// components/ViewportControls/index.tsx
|
4867
|
-
import { jsx as
|
5000
|
+
import { jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
|
4868
5001
|
var icons = {
|
4869
|
-
Smartphone: /* @__PURE__ */
|
4870
|
-
Tablet: /* @__PURE__ */
|
4871
|
-
Monitor: /* @__PURE__ */
|
5002
|
+
Smartphone: /* @__PURE__ */ jsx36(Smartphone, { size: 16 }),
|
5003
|
+
Tablet: /* @__PURE__ */ jsx36(Tablet, { size: 16 }),
|
5004
|
+
Monitor: /* @__PURE__ */ jsx36(Monitor, { size: 16 })
|
4872
5005
|
};
|
4873
5006
|
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
4874
5007
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
@@ -4884,7 +5017,7 @@ var ViewportButton = ({
|
|
4884
5017
|
useEffect16(() => {
|
4885
5018
|
setIsActive(width === state.ui.viewports.current.width);
|
4886
5019
|
}, [width, state.ui.viewports.current.width]);
|
4887
|
-
return /* @__PURE__ */
|
5020
|
+
return /* @__PURE__ */ jsx36("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx36(
|
4888
5021
|
IconButton,
|
4889
5022
|
{
|
4890
5023
|
title,
|
@@ -4893,7 +5026,7 @@ var ViewportButton = ({
|
|
4893
5026
|
e.stopPropagation();
|
4894
5027
|
onClick({ width, height });
|
4895
5028
|
},
|
4896
|
-
children: /* @__PURE__ */
|
5029
|
+
children: /* @__PURE__ */ jsx36("span", { className: getClassNameButton("inner"), children })
|
4897
5030
|
}
|
4898
5031
|
) });
|
4899
5032
|
};
|
@@ -4917,7 +5050,7 @@ var ViewportControls = ({
|
|
4917
5050
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
4918
5051
|
(option) => option.value === autoZoom
|
4919
5052
|
);
|
4920
|
-
const zoomOptions =
|
5053
|
+
const zoomOptions = useMemo13(
|
4921
5054
|
() => [
|
4922
5055
|
...defaultZoomOptions,
|
4923
5056
|
...defaultsContainAutoZoom ? [] : [
|
@@ -4930,7 +5063,7 @@ var ViewportControls = ({
|
|
4930
5063
|
[autoZoom]
|
4931
5064
|
);
|
4932
5065
|
return /* @__PURE__ */ jsxs19("div", { className: getClassName25(), children: [
|
4933
|
-
viewports.map((viewport, i) => /* @__PURE__ */
|
5066
|
+
viewports.map((viewport, i) => /* @__PURE__ */ jsx36(
|
4934
5067
|
ViewportButton,
|
4935
5068
|
{
|
4936
5069
|
height: viewport.height,
|
@@ -4941,8 +5074,8 @@ var ViewportControls = ({
|
|
4941
5074
|
},
|
4942
5075
|
i
|
4943
5076
|
)),
|
4944
|
-
/* @__PURE__ */
|
4945
|
-
/* @__PURE__ */
|
5077
|
+
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
5078
|
+
/* @__PURE__ */ jsx36(
|
4946
5079
|
IconButton,
|
4947
5080
|
{
|
4948
5081
|
title: "Zoom viewport out",
|
@@ -4956,10 +5089,10 @@ var ViewportControls = ({
|
|
4956
5089
|
)].value
|
4957
5090
|
);
|
4958
5091
|
},
|
4959
|
-
children: /* @__PURE__ */
|
5092
|
+
children: /* @__PURE__ */ jsx36(ZoomOut, { size: 16 })
|
4960
5093
|
}
|
4961
5094
|
),
|
4962
|
-
/* @__PURE__ */
|
5095
|
+
/* @__PURE__ */ jsx36(
|
4963
5096
|
IconButton,
|
4964
5097
|
{
|
4965
5098
|
title: "Zoom viewport in",
|
@@ -4973,11 +5106,11 @@ var ViewportControls = ({
|
|
4973
5106
|
)].value
|
4974
5107
|
);
|
4975
5108
|
},
|
4976
|
-
children: /* @__PURE__ */
|
5109
|
+
children: /* @__PURE__ */ jsx36(ZoomIn, { size: 16 })
|
4977
5110
|
}
|
4978
5111
|
),
|
4979
|
-
/* @__PURE__ */
|
4980
|
-
/* @__PURE__ */
|
5112
|
+
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
5113
|
+
/* @__PURE__ */ jsx36(
|
4981
5114
|
"select",
|
4982
5115
|
{
|
4983
5116
|
className: getClassName25("zoomSelect"),
|
@@ -4985,7 +5118,7 @@ var ViewportControls = ({
|
|
4985
5118
|
onChange: (e) => {
|
4986
5119
|
onZoom(parseFloat(e.currentTarget.value));
|
4987
5120
|
},
|
4988
|
-
children: zoomOptions.map((option) => /* @__PURE__ */
|
5121
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ jsx36(
|
4989
5122
|
"option",
|
4990
5123
|
{
|
4991
5124
|
value: option.value,
|
@@ -5000,7 +5133,7 @@ var ViewportControls = ({
|
|
5000
5133
|
|
5001
5134
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
5002
5135
|
init_react_import();
|
5003
|
-
var styles_module_default21 = { "PuckCanvas": "
|
5136
|
+
var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
|
5004
5137
|
|
5005
5138
|
// lib/get-zoom-config.ts
|
5006
5139
|
init_react_import();
|
@@ -5033,20 +5166,20 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
5033
5166
|
};
|
5034
5167
|
|
5035
5168
|
// components/Puck/components/Canvas/index.tsx
|
5036
|
-
import { Fragment as Fragment17, jsx as
|
5169
|
+
import { Fragment as Fragment17, jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
|
5037
5170
|
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
5038
5171
|
var ZOOM_ON_CHANGE = true;
|
5039
5172
|
var Canvas = () => {
|
5040
5173
|
const { status, iframe } = useAppContext();
|
5041
5174
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
5042
5175
|
const { ui } = state;
|
5043
|
-
const frameRef =
|
5176
|
+
const frameRef = useRef3(null);
|
5044
5177
|
const [showTransition, setShowTransition] = useState20(false);
|
5045
|
-
const defaultRender =
|
5046
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */
|
5178
|
+
const defaultRender = useMemo14(() => {
|
5179
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment17, { children });
|
5047
5180
|
return PuckDefault;
|
5048
5181
|
}, []);
|
5049
|
-
const CustomPreview =
|
5182
|
+
const CustomPreview = useMemo14(
|
5050
5183
|
() => overrides.preview || defaultRender,
|
5051
5184
|
[overrides]
|
5052
5185
|
);
|
@@ -5117,7 +5250,7 @@ var Canvas = () => {
|
|
5117
5250
|
recordHistory: true
|
5118
5251
|
}),
|
5119
5252
|
children: [
|
5120
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */
|
5253
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx37("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx37(
|
5121
5254
|
ViewportControls,
|
5122
5255
|
{
|
5123
5256
|
autoZoom: zoomConfig.autoZoom,
|
@@ -5143,7 +5276,7 @@ var Canvas = () => {
|
|
5143
5276
|
}
|
5144
5277
|
) }),
|
5145
5278
|
/* @__PURE__ */ jsxs20("div", { className: getClassName26("inner"), ref: frameRef, children: [
|
5146
|
-
/* @__PURE__ */
|
5279
|
+
/* @__PURE__ */ jsx37(
|
5147
5280
|
"div",
|
5148
5281
|
{
|
5149
5282
|
className: getClassName26("root"),
|
@@ -5155,10 +5288,10 @@ var Canvas = () => {
|
|
5155
5288
|
overflow: iframe.enabled ? void 0 : "auto"
|
5156
5289
|
},
|
5157
5290
|
suppressHydrationWarning: true,
|
5158
|
-
children: /* @__PURE__ */
|
5291
|
+
children: /* @__PURE__ */ jsx37(CustomPreview, { children: /* @__PURE__ */ jsx37(Preview, {}) })
|
5159
5292
|
}
|
5160
5293
|
),
|
5161
|
-
/* @__PURE__ */
|
5294
|
+
/* @__PURE__ */ jsx37("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx37(Loader, { size: 24 }) })
|
5162
5295
|
] })
|
5163
5296
|
]
|
5164
5297
|
}
|
@@ -5202,7 +5335,7 @@ var insertComponent = (componentType, zone, index, {
|
|
5202
5335
|
|
5203
5336
|
// lib/use-loaded-overrides.ts
|
5204
5337
|
init_react_import();
|
5205
|
-
import { useMemo as
|
5338
|
+
import { useMemo as useMemo15 } from "react";
|
5206
5339
|
|
5207
5340
|
// lib/load-overrides.ts
|
5208
5341
|
init_react_import();
|
@@ -5241,18 +5374,18 @@ var useLoadedOverrides = ({
|
|
5241
5374
|
overrides,
|
5242
5375
|
plugins
|
5243
5376
|
}) => {
|
5244
|
-
return
|
5377
|
+
return useMemo15(() => {
|
5245
5378
|
return loadOverrides({ overrides, plugins });
|
5246
5379
|
}, [plugins, overrides]);
|
5247
5380
|
};
|
5248
5381
|
|
5249
5382
|
// components/DefaultOverride/index.tsx
|
5250
5383
|
init_react_import();
|
5251
|
-
import { Fragment as Fragment18, jsx as
|
5252
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */
|
5384
|
+
import { Fragment as Fragment18, jsx as jsx38 } from "react/jsx-runtime";
|
5385
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment18, { children });
|
5253
5386
|
|
5254
5387
|
// components/Puck/index.tsx
|
5255
|
-
import { Fragment as Fragment19, jsx as
|
5388
|
+
import { Fragment as Fragment19, jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
5256
5389
|
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
5257
5390
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
5258
5391
|
function Puck({
|
@@ -5275,13 +5408,13 @@ function Puck({
|
|
5275
5408
|
dnd,
|
5276
5409
|
initialHistory: _initialHistory
|
5277
5410
|
}) {
|
5278
|
-
var _a;
|
5411
|
+
var _a, _b;
|
5279
5412
|
const iframe = __spreadValues({
|
5280
5413
|
enabled: true,
|
5281
5414
|
waitForStyles: true
|
5282
5415
|
}, _iframe);
|
5283
5416
|
const [generatedAppState] = useState21(() => {
|
5284
|
-
var _a2,
|
5417
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
5285
5418
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
5286
5419
|
let clientUiState = {};
|
5287
5420
|
if (typeof window !== "undefined") {
|
@@ -5301,7 +5434,7 @@ function Puck({
|
|
5301
5434
|
clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
|
5302
5435
|
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
5303
5436
|
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
5304
|
-
height: ((
|
5437
|
+
height: ((_b2 = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b2.height) || ((_c = viewports[closestViewport]) == null ? void 0 : _c.height) || "auto",
|
5305
5438
|
width: ((_e = (_d = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _d.current) == null ? void 0 : _e.width) || ((_f = viewports[closestViewport]) == null ? void 0 : _f.width)
|
5306
5439
|
})
|
5307
5440
|
})
|
@@ -5364,7 +5497,12 @@ function Puck({
|
|
5364
5497
|
flushZones(initialAppState)
|
5365
5498
|
);
|
5366
5499
|
const { data, ui } = appState;
|
5367
|
-
const history = usePuckHistory({
|
5500
|
+
const history = usePuckHistory({
|
5501
|
+
dispatch,
|
5502
|
+
initialAppState,
|
5503
|
+
historyStore,
|
5504
|
+
iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
|
5505
|
+
});
|
5368
5506
|
const [menuOpen, setMenuOpen] = useState21(false);
|
5369
5507
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
5370
5508
|
const setItemSelector = useCallback11(
|
@@ -5422,28 +5560,28 @@ function Puck({
|
|
5422
5560
|
window.removeEventListener("resize", handleResize);
|
5423
5561
|
};
|
5424
5562
|
}, []);
|
5425
|
-
const defaultHeaderRender =
|
5563
|
+
const defaultHeaderRender = useMemo16(() => {
|
5426
5564
|
if (renderHeader) {
|
5427
5565
|
console.warn(
|
5428
5566
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
5429
5567
|
);
|
5430
5568
|
const RenderHeader = (_a2) => {
|
5431
|
-
var
|
5569
|
+
var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
|
5432
5570
|
const Comp = renderHeader;
|
5433
|
-
return /* @__PURE__ */
|
5571
|
+
return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
5434
5572
|
};
|
5435
5573
|
return RenderHeader;
|
5436
5574
|
}
|
5437
5575
|
return DefaultOverride;
|
5438
5576
|
}, [renderHeader]);
|
5439
|
-
const defaultHeaderActionsRender =
|
5577
|
+
const defaultHeaderActionsRender = useMemo16(() => {
|
5440
5578
|
if (renderHeaderActions) {
|
5441
5579
|
console.warn(
|
5442
5580
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
5443
5581
|
);
|
5444
5582
|
const RenderHeader = (props) => {
|
5445
5583
|
const Comp = renderHeaderActions;
|
5446
|
-
return /* @__PURE__ */
|
5584
|
+
return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
5447
5585
|
};
|
5448
5586
|
return RenderHeader;
|
5449
5587
|
}
|
@@ -5453,15 +5591,15 @@ function Puck({
|
|
5453
5591
|
overrides,
|
5454
5592
|
plugins
|
5455
5593
|
});
|
5456
|
-
const CustomPuck =
|
5594
|
+
const CustomPuck = useMemo16(
|
5457
5595
|
() => loadedOverrides.puck || DefaultOverride,
|
5458
5596
|
[loadedOverrides]
|
5459
5597
|
);
|
5460
|
-
const CustomHeader =
|
5598
|
+
const CustomHeader = useMemo16(
|
5461
5599
|
() => loadedOverrides.header || defaultHeaderRender,
|
5462
5600
|
[loadedOverrides]
|
5463
5601
|
);
|
5464
|
-
const CustomHeaderActions =
|
5602
|
+
const CustomHeaderActions = useMemo16(
|
5465
5603
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
5466
5604
|
[loadedOverrides]
|
5467
5605
|
);
|
@@ -5470,9 +5608,9 @@ function Puck({
|
|
5470
5608
|
setMounted(true);
|
5471
5609
|
}, []);
|
5472
5610
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
5473
|
-
const selectedComponentLabel = selectedItem ? (
|
5611
|
+
const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
|
5474
5612
|
return /* @__PURE__ */ jsxs21("div", { className: `Puck ${getClassName27()}`, children: [
|
5475
|
-
/* @__PURE__ */
|
5613
|
+
/* @__PURE__ */ jsx39(
|
5476
5614
|
AppProvider,
|
5477
5615
|
{
|
5478
5616
|
value: {
|
@@ -5494,7 +5632,7 @@ function Puck({
|
|
5494
5632
|
getPermissions: () => ({}),
|
5495
5633
|
refreshPermissions: () => null
|
5496
5634
|
},
|
5497
|
-
children: /* @__PURE__ */
|
5635
|
+
children: /* @__PURE__ */ jsx39(appContext.Consumer, { children: ({ resolveData }) => /* @__PURE__ */ jsx39(
|
5498
5636
|
DragDropContext,
|
5499
5637
|
{
|
5500
5638
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -5546,7 +5684,7 @@ function Puck({
|
|
5546
5684
|
});
|
5547
5685
|
}
|
5548
5686
|
},
|
5549
|
-
children: /* @__PURE__ */
|
5687
|
+
children: /* @__PURE__ */ jsx39(
|
5550
5688
|
DropZoneProvider,
|
5551
5689
|
{
|
5552
5690
|
value: {
|
@@ -5560,7 +5698,7 @@ function Puck({
|
|
5560
5698
|
mode: "edit",
|
5561
5699
|
areaId: "root"
|
5562
5700
|
},
|
5563
|
-
children: /* @__PURE__ */
|
5701
|
+
children: /* @__PURE__ */ jsx39(CustomPuck, { children: children || /* @__PURE__ */ jsx39(
|
5564
5702
|
"div",
|
5565
5703
|
{
|
5566
5704
|
className: getLayoutClassName({
|
@@ -5570,57 +5708,57 @@ function Puck({
|
|
5570
5708
|
rightSideBarVisible
|
5571
5709
|
}),
|
5572
5710
|
children: /* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("inner"), children: [
|
5573
|
-
/* @__PURE__ */
|
5711
|
+
/* @__PURE__ */ jsx39(
|
5574
5712
|
CustomHeader,
|
5575
5713
|
{
|
5576
|
-
actions: /* @__PURE__ */
|
5714
|
+
actions: /* @__PURE__ */ jsx39(Fragment19, { children: /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
|
5577
5715
|
Button,
|
5578
5716
|
{
|
5579
5717
|
onClick: () => {
|
5580
5718
|
onPublish && onPublish(data);
|
5581
5719
|
},
|
5582
|
-
icon: /* @__PURE__ */
|
5720
|
+
icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
|
5583
5721
|
children: "Publish"
|
5584
5722
|
}
|
5585
5723
|
) }) }),
|
5586
|
-
children: /* @__PURE__ */
|
5724
|
+
children: /* @__PURE__ */ jsx39("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("headerInner"), children: [
|
5587
5725
|
/* @__PURE__ */ jsxs21(
|
5588
5726
|
"div",
|
5589
5727
|
{
|
5590
5728
|
className: getLayoutClassName("headerToggle"),
|
5591
5729
|
children: [
|
5592
|
-
/* @__PURE__ */
|
5730
|
+
/* @__PURE__ */ jsx39(
|
5593
5731
|
"div",
|
5594
5732
|
{
|
5595
5733
|
className: getLayoutClassName(
|
5596
5734
|
"leftSideBarToggle"
|
5597
5735
|
),
|
5598
|
-
children: /* @__PURE__ */
|
5736
|
+
children: /* @__PURE__ */ jsx39(
|
5599
5737
|
IconButton,
|
5600
5738
|
{
|
5601
5739
|
onClick: () => {
|
5602
5740
|
toggleSidebars("left");
|
5603
5741
|
},
|
5604
5742
|
title: "Toggle left sidebar",
|
5605
|
-
children: /* @__PURE__ */
|
5743
|
+
children: /* @__PURE__ */ jsx39(PanelLeft, { focusable: "false" })
|
5606
5744
|
}
|
5607
5745
|
)
|
5608
5746
|
}
|
5609
5747
|
),
|
5610
|
-
/* @__PURE__ */
|
5748
|
+
/* @__PURE__ */ jsx39(
|
5611
5749
|
"div",
|
5612
5750
|
{
|
5613
5751
|
className: getLayoutClassName(
|
5614
5752
|
"rightSideBarToggle"
|
5615
5753
|
),
|
5616
|
-
children: /* @__PURE__ */
|
5754
|
+
children: /* @__PURE__ */ jsx39(
|
5617
5755
|
IconButton,
|
5618
5756
|
{
|
5619
5757
|
onClick: () => {
|
5620
5758
|
toggleSidebars("right");
|
5621
5759
|
},
|
5622
5760
|
title: "Toggle right sidebar",
|
5623
|
-
children: /* @__PURE__ */
|
5761
|
+
children: /* @__PURE__ */ jsx39(PanelRight, { focusable: "false" })
|
5624
5762
|
}
|
5625
5763
|
)
|
5626
5764
|
}
|
@@ -5628,7 +5766,7 @@ function Puck({
|
|
5628
5766
|
]
|
5629
5767
|
}
|
5630
5768
|
),
|
5631
|
-
/* @__PURE__ */
|
5769
|
+
/* @__PURE__ */ jsx39(
|
5632
5770
|
"div",
|
5633
5771
|
{
|
5634
5772
|
className: getLayoutClassName("headerTitle"),
|
@@ -5636,7 +5774,7 @@ function Puck({
|
|
5636
5774
|
headerTitle || rootProps.title || "Page",
|
5637
5775
|
headerPath && /* @__PURE__ */ jsxs21(Fragment19, { children: [
|
5638
5776
|
" ",
|
5639
|
-
/* @__PURE__ */
|
5777
|
+
/* @__PURE__ */ jsx39(
|
5640
5778
|
"code",
|
5641
5779
|
{
|
5642
5780
|
className: getLayoutClassName(
|
@@ -5654,36 +5792,36 @@ function Puck({
|
|
5654
5792
|
{
|
5655
5793
|
className: getLayoutClassName("headerTools"),
|
5656
5794
|
children: [
|
5657
|
-
/* @__PURE__ */
|
5795
|
+
/* @__PURE__ */ jsx39(
|
5658
5796
|
"div",
|
5659
5797
|
{
|
5660
5798
|
className: getLayoutClassName("menuButton"),
|
5661
|
-
children: /* @__PURE__ */
|
5799
|
+
children: /* @__PURE__ */ jsx39(
|
5662
5800
|
IconButton,
|
5663
5801
|
{
|
5664
5802
|
onClick: () => {
|
5665
5803
|
return setMenuOpen(!menuOpen);
|
5666
5804
|
},
|
5667
5805
|
title: "Toggle menu bar",
|
5668
|
-
children: menuOpen ? /* @__PURE__ */
|
5806
|
+
children: menuOpen ? /* @__PURE__ */ jsx39(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx39(ChevronDown, { focusable: "false" })
|
5669
5807
|
}
|
5670
5808
|
)
|
5671
5809
|
}
|
5672
5810
|
),
|
5673
|
-
/* @__PURE__ */
|
5811
|
+
/* @__PURE__ */ jsx39(
|
5674
5812
|
MenuBar,
|
5675
5813
|
{
|
5676
5814
|
appState,
|
5677
5815
|
dispatch,
|
5678
5816
|
onPublish,
|
5679
5817
|
menuOpen,
|
5680
|
-
renderHeaderActions: () => /* @__PURE__ */
|
5818
|
+
renderHeaderActions: () => /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
|
5681
5819
|
Button,
|
5682
5820
|
{
|
5683
5821
|
onClick: () => {
|
5684
5822
|
onPublish && onPublish(data);
|
5685
5823
|
},
|
5686
|
-
icon: /* @__PURE__ */
|
5824
|
+
icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
|
5687
5825
|
children: "Publish"
|
5688
5826
|
}
|
5689
5827
|
) }),
|
@@ -5697,18 +5835,18 @@ function Puck({
|
|
5697
5835
|
}
|
5698
5836
|
),
|
5699
5837
|
/* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("leftSideBar"), children: [
|
5700
|
-
/* @__PURE__ */
|
5701
|
-
/* @__PURE__ */
|
5838
|
+
/* @__PURE__ */ jsx39(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx39(Components, {}) }),
|
5839
|
+
/* @__PURE__ */ jsx39(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx39(Outline, {}) })
|
5702
5840
|
] }),
|
5703
|
-
/* @__PURE__ */
|
5704
|
-
/* @__PURE__ */
|
5841
|
+
/* @__PURE__ */ jsx39(Canvas, {}),
|
5842
|
+
/* @__PURE__ */ jsx39("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx39(
|
5705
5843
|
SidebarSection,
|
5706
5844
|
{
|
5707
5845
|
noPadding: true,
|
5708
5846
|
noBorderTop: true,
|
5709
5847
|
showBreadcrumbs: true,
|
5710
5848
|
title: selectedItem ? selectedComponentLabel : "Page",
|
5711
|
-
children: /* @__PURE__ */
|
5849
|
+
children: /* @__PURE__ */ jsx39(Fields, {})
|
5712
5850
|
}
|
5713
5851
|
) })
|
5714
5852
|
] })
|
@@ -5720,7 +5858,7 @@ function Puck({
|
|
5720
5858
|
) })
|
5721
5859
|
}
|
5722
5860
|
),
|
5723
|
-
/* @__PURE__ */
|
5861
|
+
/* @__PURE__ */ jsx39("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
5724
5862
|
] });
|
5725
5863
|
}
|
5726
5864
|
Puck.Components = Components;
|
@@ -5730,7 +5868,7 @@ Puck.Preview = Preview;
|
|
5730
5868
|
|
5731
5869
|
// components/Render/index.tsx
|
5732
5870
|
init_react_import();
|
5733
|
-
import { jsx as
|
5871
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
5734
5872
|
function Render({
|
5735
5873
|
config,
|
5736
5874
|
data
|
@@ -5743,7 +5881,7 @@ function Render({
|
|
5743
5881
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
5744
5882
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
5745
5883
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
5746
|
-
return /* @__PURE__ */
|
5884
|
+
return /* @__PURE__ */ jsx40(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ jsx40(
|
5747
5885
|
config.root.render,
|
5748
5886
|
__spreadProps(__spreadValues({}, rootProps), {
|
5749
5887
|
puck: {
|
@@ -5753,11 +5891,11 @@ function Render({
|
|
5753
5891
|
title,
|
5754
5892
|
editMode: false,
|
5755
5893
|
id: "puck-root",
|
5756
|
-
children: /* @__PURE__ */
|
5894
|
+
children: /* @__PURE__ */ jsx40(DropZone, { zone: rootDroppableId })
|
5757
5895
|
})
|
5758
5896
|
) });
|
5759
5897
|
}
|
5760
|
-
return /* @__PURE__ */
|
5898
|
+
return /* @__PURE__ */ jsx40(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ jsx40(DropZone, { zone: rootDroppableId }) });
|
5761
5899
|
}
|
5762
5900
|
|
5763
5901
|
// lib/migrate.ts
|