@measured/puck 0.17.2-canary.0655fc5 → 0.17.2-canary.98a70fd
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +633 -548
- package/dist/index.mjs +497 -409
- 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"),
|
@@ -1537,7 +1600,7 @@ import { useEffect as useEffect8 } from "react";
|
|
1537
1600
|
// components/ExternalInput/index.tsx
|
1538
1601
|
init_react_import();
|
1539
1602
|
import {
|
1540
|
-
useMemo,
|
1603
|
+
useMemo as useMemo2,
|
1541
1604
|
useEffect as useEffect7,
|
1542
1605
|
useState as useState8,
|
1543
1606
|
useCallback as useCallback4,
|
@@ -1558,7 +1621,7 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
|
|
1558
1621
|
|
1559
1622
|
// components/Modal/index.tsx
|
1560
1623
|
import { createPortal } from "react-dom";
|
1561
|
-
import { jsx as
|
1624
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
1562
1625
|
var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
|
1563
1626
|
var Modal = ({
|
1564
1627
|
children,
|
@@ -1570,10 +1633,10 @@ var Modal = ({
|
|
1570
1633
|
setRootEl(document.getElementById("puck-portal-root"));
|
1571
1634
|
}, []);
|
1572
1635
|
if (!rootEl) {
|
1573
|
-
return /* @__PURE__ */
|
1636
|
+
return /* @__PURE__ */ jsx12("div", {});
|
1574
1637
|
}
|
1575
1638
|
return createPortal(
|
1576
|
-
/* @__PURE__ */
|
1639
|
+
/* @__PURE__ */ jsx12("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ jsx12(
|
1577
1640
|
"div",
|
1578
1641
|
{
|
1579
1642
|
className: getClassName7("inner"),
|
@@ -1593,11 +1656,11 @@ init_react_import();
|
|
1593
1656
|
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
1657
|
|
1595
1658
|
// components/Heading/index.tsx
|
1596
|
-
import { jsx as
|
1659
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
1597
1660
|
var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
|
1598
1661
|
var Heading = ({ children, rank, size = "m" }) => {
|
1599
1662
|
const Tag = rank ? `h${rank}` : "span";
|
1600
|
-
return /* @__PURE__ */
|
1663
|
+
return /* @__PURE__ */ jsx13(
|
1601
1664
|
Tag,
|
1602
1665
|
{
|
1603
1666
|
className: getClassName8({
|
@@ -1619,57 +1682,29 @@ import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
1619
1682
|
init_react_import();
|
1620
1683
|
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
1684
|
|
1622
|
-
// lib/filter-data-attrs.ts
|
1623
|
-
init_react_import();
|
1624
|
-
var dataAttrRe = /^(data-.*)$/;
|
1625
|
-
var filterDataAttrs = (props) => {
|
1626
|
-
let filteredProps = {};
|
1627
|
-
for (const prop in props) {
|
1628
|
-
if (Object.prototype.hasOwnProperty.call(props, prop) && dataAttrRe.test(prop)) {
|
1629
|
-
filteredProps[prop] = props[prop];
|
1630
|
-
}
|
1631
|
-
}
|
1632
|
-
return filteredProps;
|
1633
|
-
};
|
1634
|
-
|
1635
1685
|
// components/Button/Button.tsx
|
1636
|
-
import { jsx as
|
1686
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
1637
1687
|
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
1638
|
-
var Button = (
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
} = _b, props = __objRest(_b, [
|
1653
|
-
"children",
|
1654
|
-
"href",
|
1655
|
-
"onClick",
|
1656
|
-
"variant",
|
1657
|
-
"type",
|
1658
|
-
"disabled",
|
1659
|
-
"tabIndex",
|
1660
|
-
"newTab",
|
1661
|
-
"fullWidth",
|
1662
|
-
"icon",
|
1663
|
-
"size",
|
1664
|
-
"loading"
|
1665
|
-
]);
|
1688
|
+
var Button = ({
|
1689
|
+
children,
|
1690
|
+
href,
|
1691
|
+
onClick,
|
1692
|
+
variant = "primary",
|
1693
|
+
type,
|
1694
|
+
disabled,
|
1695
|
+
tabIndex,
|
1696
|
+
newTab,
|
1697
|
+
fullWidth,
|
1698
|
+
icon,
|
1699
|
+
size = "medium",
|
1700
|
+
loading: loadingProp = false
|
1701
|
+
}) => {
|
1666
1702
|
const [loading, setLoading] = useState7(loadingProp);
|
1667
1703
|
useEffect6(() => setLoading(loadingProp), [loadingProp]);
|
1668
1704
|
const ElementType = href ? "a" : type ? "button" : "span";
|
1669
|
-
const dataAttrs = filterDataAttrs(props);
|
1670
1705
|
const el = /* @__PURE__ */ jsxs6(
|
1671
1706
|
ElementType,
|
1672
|
-
|
1707
|
+
{
|
1673
1708
|
className: getClassName9({
|
1674
1709
|
primary: variant === "primary",
|
1675
1710
|
secondary: variant === "secondary",
|
@@ -1689,20 +1724,19 @@ var Button = (_a) => {
|
|
1689
1724
|
tabIndex,
|
1690
1725
|
target: newTab ? "_blank" : void 0,
|
1691
1726
|
rel: newTab ? "noreferrer" : void 0,
|
1692
|
-
href
|
1693
|
-
}, dataAttrs), {
|
1727
|
+
href,
|
1694
1728
|
children: [
|
1695
|
-
icon && /* @__PURE__ */
|
1729
|
+
icon && /* @__PURE__ */ jsx14("div", { className: getClassName9("icon"), children: icon }),
|
1696
1730
|
children,
|
1697
|
-
loading && /* @__PURE__ */
|
1731
|
+
loading && /* @__PURE__ */ jsx14("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ jsx14(Loader, { size: 14 }) })
|
1698
1732
|
]
|
1699
|
-
}
|
1733
|
+
}
|
1700
1734
|
);
|
1701
1735
|
return el;
|
1702
1736
|
};
|
1703
1737
|
|
1704
1738
|
// components/ExternalInput/index.tsx
|
1705
|
-
import { Fragment as Fragment7, jsx as
|
1739
|
+
import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
1706
1740
|
var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
|
1707
1741
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
|
1708
1742
|
var dataCache = {};
|
@@ -1725,10 +1759,10 @@ var ExternalInput = ({
|
|
1725
1759
|
const hasFilterFields = !!filterFields;
|
1726
1760
|
const [filters, setFilters] = useState8(field.initialFilters || {});
|
1727
1761
|
const [filtersToggled, setFiltersToggled] = useState8(hasFilterFields);
|
1728
|
-
const mappedData =
|
1762
|
+
const mappedData = useMemo2(() => {
|
1729
1763
|
return data.map(mapRow);
|
1730
1764
|
}, [data]);
|
1731
|
-
const keys =
|
1765
|
+
const keys = useMemo2(() => {
|
1732
1766
|
const validKeys = /* @__PURE__ */ new Set();
|
1733
1767
|
for (const item of mappedData) {
|
1734
1768
|
for (const key of Object.keys(item)) {
|
@@ -1775,7 +1809,7 @@ var ExternalInput = ({
|
|
1775
1809
|
id,
|
1776
1810
|
children: [
|
1777
1811
|
/* @__PURE__ */ jsxs7("div", { className: getClassName10("actions"), children: [
|
1778
|
-
/* @__PURE__ */
|
1812
|
+
/* @__PURE__ */ jsx15(
|
1779
1813
|
"button",
|
1780
1814
|
{
|
1781
1815
|
type: "button",
|
@@ -1783,12 +1817,12 @@ var ExternalInput = ({
|
|
1783
1817
|
className: getClassName10("button"),
|
1784
1818
|
disabled: readOnly,
|
1785
1819
|
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ jsxs7(Fragment7, { children: [
|
1786
|
-
/* @__PURE__ */
|
1787
|
-
/* @__PURE__ */
|
1820
|
+
/* @__PURE__ */ jsx15(Link, { size: "16" }),
|
1821
|
+
/* @__PURE__ */ jsx15("span", { children: field.placeholder })
|
1788
1822
|
] })
|
1789
1823
|
}
|
1790
1824
|
),
|
1791
|
-
value && /* @__PURE__ */
|
1825
|
+
value && /* @__PURE__ */ jsx15(
|
1792
1826
|
"button",
|
1793
1827
|
{
|
1794
1828
|
type: "button",
|
@@ -1797,11 +1831,11 @@ var ExternalInput = ({
|
|
1797
1831
|
onChange(null);
|
1798
1832
|
},
|
1799
1833
|
disabled: readOnly,
|
1800
|
-
children: /* @__PURE__ */
|
1834
|
+
children: /* @__PURE__ */ jsx15(LockOpen, { size: 16 })
|
1801
1835
|
}
|
1802
1836
|
)
|
1803
1837
|
] }),
|
1804
|
-
/* @__PURE__ */
|
1838
|
+
/* @__PURE__ */ jsx15(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ jsxs7(
|
1805
1839
|
"form",
|
1806
1840
|
{
|
1807
1841
|
className: getClassNameModal({
|
@@ -1815,11 +1849,11 @@ var ExternalInput = ({
|
|
1815
1849
|
search(searchQuery, filters);
|
1816
1850
|
},
|
1817
1851
|
children: [
|
1818
|
-
/* @__PURE__ */
|
1852
|
+
/* @__PURE__ */ jsx15("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ jsxs7("div", { className: getClassNameModal("searchForm"), children: [
|
1819
1853
|
/* @__PURE__ */ jsxs7("label", { className: getClassNameModal("search"), children: [
|
1820
|
-
/* @__PURE__ */
|
1821
|
-
/* @__PURE__ */
|
1822
|
-
/* @__PURE__ */
|
1854
|
+
/* @__PURE__ */ jsx15("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
1855
|
+
/* @__PURE__ */ jsx15("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ jsx15(Search, { size: "18" }) }),
|
1856
|
+
/* @__PURE__ */ jsx15(
|
1823
1857
|
"input",
|
1824
1858
|
{
|
1825
1859
|
className: getClassNameModal("searchInput"),
|
@@ -1835,8 +1869,8 @@ var ExternalInput = ({
|
|
1835
1869
|
)
|
1836
1870
|
] }),
|
1837
1871
|
/* @__PURE__ */ jsxs7("div", { className: getClassNameModal("searchActions"), children: [
|
1838
|
-
/* @__PURE__ */
|
1839
|
-
hasFilterFields && /* @__PURE__ */
|
1872
|
+
/* @__PURE__ */ jsx15(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
1873
|
+
hasFilterFields && /* @__PURE__ */ jsx15("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ jsx15(
|
1840
1874
|
IconButton,
|
1841
1875
|
{
|
1842
1876
|
title: "Toggle filters",
|
@@ -1845,15 +1879,15 @@ var ExternalInput = ({
|
|
1845
1879
|
e.stopPropagation();
|
1846
1880
|
setFiltersToggled(!filtersToggled);
|
1847
1881
|
},
|
1848
|
-
children: /* @__PURE__ */
|
1882
|
+
children: /* @__PURE__ */ jsx15(SlidersHorizontal, { size: 20 })
|
1849
1883
|
}
|
1850
1884
|
) })
|
1851
1885
|
] })
|
1852
|
-
] }) : /* @__PURE__ */
|
1886
|
+
] }) : /* @__PURE__ */ jsx15(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
|
1853
1887
|
/* @__PURE__ */ jsxs7("div", { className: getClassNameModal("grid"), children: [
|
1854
|
-
hasFilterFields && /* @__PURE__ */
|
1888
|
+
hasFilterFields && /* @__PURE__ */ jsx15("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
1855
1889
|
const filterField = filterFields[fieldName];
|
1856
|
-
return /* @__PURE__ */
|
1890
|
+
return /* @__PURE__ */ jsx15(
|
1857
1891
|
AutoFieldPrivate,
|
1858
1892
|
{
|
1859
1893
|
field: filterField,
|
@@ -1872,7 +1906,7 @@ var ExternalInput = ({
|
|
1872
1906
|
}) }),
|
1873
1907
|
/* @__PURE__ */ jsxs7("div", { className: getClassNameModal("tableWrapper"), children: [
|
1874
1908
|
/* @__PURE__ */ jsxs7("table", { className: getClassNameModal("table"), children: [
|
1875
|
-
/* @__PURE__ */
|
1909
|
+
/* @__PURE__ */ jsx15("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ jsx15("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ jsx15(
|
1876
1910
|
"th",
|
1877
1911
|
{
|
1878
1912
|
className: getClassNameModal("th"),
|
@@ -1881,8 +1915,8 @@ var ExternalInput = ({
|
|
1881
1915
|
},
|
1882
1916
|
key
|
1883
1917
|
)) }) }),
|
1884
|
-
/* @__PURE__ */
|
1885
|
-
return /* @__PURE__ */
|
1918
|
+
/* @__PURE__ */ jsx15("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
1919
|
+
return /* @__PURE__ */ jsx15(
|
1886
1920
|
"tr",
|
1887
1921
|
{
|
1888
1922
|
style: { whiteSpace: "nowrap" },
|
@@ -1891,16 +1925,16 @@ var ExternalInput = ({
|
|
1891
1925
|
onChange(mapProp(data[i]));
|
1892
1926
|
setOpen(false);
|
1893
1927
|
},
|
1894
|
-
children: keys.map((key) => /* @__PURE__ */
|
1928
|
+
children: keys.map((key) => /* @__PURE__ */ jsx15("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
1895
1929
|
},
|
1896
1930
|
i
|
1897
1931
|
);
|
1898
1932
|
}) })
|
1899
1933
|
] }),
|
1900
|
-
/* @__PURE__ */
|
1934
|
+
/* @__PURE__ */ jsx15("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx15(Loader, { size: 24 }) })
|
1901
1935
|
] })
|
1902
1936
|
] }),
|
1903
|
-
/* @__PURE__ */
|
1937
|
+
/* @__PURE__ */ jsx15("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx15(Footer, { items: mappedData }) })
|
1904
1938
|
]
|
1905
1939
|
}
|
1906
1940
|
) })
|
@@ -1910,7 +1944,7 @@ var ExternalInput = ({
|
|
1910
1944
|
};
|
1911
1945
|
|
1912
1946
|
// components/AutoField/fields/ExternalField/index.tsx
|
1913
|
-
import { jsx as
|
1947
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
1914
1948
|
var ExternalField = ({
|
1915
1949
|
field,
|
1916
1950
|
onChange,
|
@@ -1934,7 +1968,7 @@ var ExternalField = ({
|
|
1934
1968
|
if (field.type !== "external") {
|
1935
1969
|
return null;
|
1936
1970
|
}
|
1937
|
-
return /* @__PURE__ */
|
1971
|
+
return /* @__PURE__ */ jsx16(Label, { label: label || name, icon: /* @__PURE__ */ jsx16(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx16(
|
1938
1972
|
ExternalInput,
|
1939
1973
|
{
|
1940
1974
|
name,
|
@@ -1959,7 +1993,7 @@ var ExternalField = ({
|
|
1959
1993
|
|
1960
1994
|
// components/AutoField/fields/RadioField/index.tsx
|
1961
1995
|
init_react_import();
|
1962
|
-
import { useMemo as
|
1996
|
+
import { useMemo as useMemo3 } from "react";
|
1963
1997
|
|
1964
1998
|
// lib/safe-json-parse.ts
|
1965
1999
|
init_react_import();
|
@@ -1973,7 +2007,7 @@ var safeJsonParse = (str) => {
|
|
1973
2007
|
};
|
1974
2008
|
|
1975
2009
|
// components/AutoField/fields/RadioField/index.tsx
|
1976
|
-
import { jsx as
|
2010
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
1977
2011
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
1978
2012
|
var RadioField = ({
|
1979
2013
|
field,
|
@@ -1985,26 +2019,26 @@ var RadioField = ({
|
|
1985
2019
|
label,
|
1986
2020
|
Label
|
1987
2021
|
}) => {
|
1988
|
-
const flatOptions =
|
2022
|
+
const flatOptions = useMemo3(
|
1989
2023
|
() => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
|
1990
2024
|
[field]
|
1991
2025
|
);
|
1992
2026
|
if (field.type !== "radio" || !field.options) {
|
1993
2027
|
return null;
|
1994
2028
|
}
|
1995
|
-
return /* @__PURE__ */
|
2029
|
+
return /* @__PURE__ */ jsx17(
|
1996
2030
|
Label,
|
1997
2031
|
{
|
1998
|
-
icon: /* @__PURE__ */
|
2032
|
+
icon: /* @__PURE__ */ jsx17(CircleCheckBig, { size: 16 }),
|
1999
2033
|
label: label || name,
|
2000
2034
|
readOnly,
|
2001
2035
|
el: "div",
|
2002
|
-
children: /* @__PURE__ */
|
2036
|
+
children: /* @__PURE__ */ jsx17("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ jsxs8(
|
2003
2037
|
"label",
|
2004
2038
|
{
|
2005
2039
|
className: getClassName11("radio"),
|
2006
2040
|
children: [
|
2007
|
-
/* @__PURE__ */
|
2041
|
+
/* @__PURE__ */ jsx17(
|
2008
2042
|
"input",
|
2009
2043
|
{
|
2010
2044
|
type: "radio",
|
@@ -2024,7 +2058,7 @@ var RadioField = ({
|
|
2024
2058
|
checked: value === option.value
|
2025
2059
|
}
|
2026
2060
|
),
|
2027
|
-
/* @__PURE__ */
|
2061
|
+
/* @__PURE__ */ jsx17("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
2028
2062
|
]
|
2029
2063
|
},
|
2030
2064
|
option.label + option.value
|
@@ -2035,8 +2069,8 @@ var RadioField = ({
|
|
2035
2069
|
|
2036
2070
|
// components/AutoField/fields/SelectField/index.tsx
|
2037
2071
|
init_react_import();
|
2038
|
-
import { useMemo as
|
2039
|
-
import { jsx as
|
2072
|
+
import { useMemo as useMemo4 } from "react";
|
2073
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
2040
2074
|
var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
|
2041
2075
|
var SelectField = ({
|
2042
2076
|
field,
|
@@ -2048,20 +2082,20 @@ var SelectField = ({
|
|
2048
2082
|
readOnly,
|
2049
2083
|
id
|
2050
2084
|
}) => {
|
2051
|
-
const flatOptions =
|
2085
|
+
const flatOptions = useMemo4(
|
2052
2086
|
() => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
|
2053
2087
|
[field]
|
2054
2088
|
);
|
2055
2089
|
if (field.type !== "select" || !field.options) {
|
2056
2090
|
return null;
|
2057
2091
|
}
|
2058
|
-
return /* @__PURE__ */
|
2092
|
+
return /* @__PURE__ */ jsx18(
|
2059
2093
|
Label,
|
2060
2094
|
{
|
2061
2095
|
label: label || name,
|
2062
|
-
icon: /* @__PURE__ */
|
2096
|
+
icon: /* @__PURE__ */ jsx18(ChevronDown, { size: 16 }),
|
2063
2097
|
readOnly,
|
2064
|
-
children: /* @__PURE__ */
|
2098
|
+
children: /* @__PURE__ */ jsx18(
|
2065
2099
|
"select",
|
2066
2100
|
{
|
2067
2101
|
id,
|
@@ -2078,7 +2112,7 @@ var SelectField = ({
|
|
2078
2112
|
}
|
2079
2113
|
},
|
2080
2114
|
value,
|
2081
|
-
children: field.options.map((option) => /* @__PURE__ */
|
2115
|
+
children: field.options.map((option) => /* @__PURE__ */ jsx18(
|
2082
2116
|
"option",
|
2083
2117
|
{
|
2084
2118
|
label: option.label,
|
@@ -2094,7 +2128,7 @@ var SelectField = ({
|
|
2094
2128
|
|
2095
2129
|
// components/AutoField/fields/TextareaField/index.tsx
|
2096
2130
|
init_react_import();
|
2097
|
-
import { jsx as
|
2131
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
2098
2132
|
var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
|
2099
2133
|
var TextareaField = ({
|
2100
2134
|
onChange,
|
@@ -2105,7 +2139,7 @@ var TextareaField = ({
|
|
2105
2139
|
Label,
|
2106
2140
|
id
|
2107
2141
|
}) => {
|
2108
|
-
return /* @__PURE__ */
|
2142
|
+
return /* @__PURE__ */ jsx19(Label, { label: label || name, icon: /* @__PURE__ */ jsx19(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx19(
|
2109
2143
|
"textarea",
|
2110
2144
|
{
|
2111
2145
|
id,
|
@@ -2132,7 +2166,7 @@ init_react_import();
|
|
2132
2166
|
var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
|
2133
2167
|
|
2134
2168
|
// components/AutoField/fields/ObjectField/index.tsx
|
2135
|
-
import { jsx as
|
2169
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
2136
2170
|
var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
|
2137
2171
|
var ObjectField = ({
|
2138
2172
|
field,
|
@@ -2144,43 +2178,54 @@ var ObjectField = ({
|
|
2144
2178
|
readOnly,
|
2145
2179
|
id
|
2146
2180
|
}) => {
|
2147
|
-
const {
|
2181
|
+
const { readOnlyFields, localName = name } = useNestedFieldContext();
|
2148
2182
|
if (field.type !== "object" || !field.objectFields) {
|
2149
2183
|
return null;
|
2150
2184
|
}
|
2151
|
-
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
2152
2185
|
const data = value || {};
|
2153
|
-
return /* @__PURE__ */
|
2186
|
+
return /* @__PURE__ */ jsx20(
|
2154
2187
|
Label,
|
2155
2188
|
{
|
2156
2189
|
label: label || name,
|
2157
|
-
icon: /* @__PURE__ */
|
2190
|
+
icon: /* @__PURE__ */ jsx20(EllipsisVertical, { size: 16 }),
|
2158
2191
|
el: "div",
|
2159
2192
|
readOnly,
|
2160
|
-
children: /* @__PURE__ */
|
2161
|
-
const subField = field.objectFields[
|
2162
|
-
const
|
2163
|
-
const
|
2164
|
-
const subReadOnly = readOnly ? readOnly :
|
2165
|
-
|
2166
|
-
|
2193
|
+
children: /* @__PURE__ */ jsx20("div", { className: getClassName14(), children: /* @__PURE__ */ jsx20("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
2194
|
+
const subField = field.objectFields[subName];
|
2195
|
+
const subPath = `${name}.${subName}`;
|
2196
|
+
const localSubPath = `${localName || name}.${subName}`;
|
2197
|
+
const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
|
2198
|
+
const label2 = subField.label || subName;
|
2199
|
+
return /* @__PURE__ */ jsx20(
|
2200
|
+
NestedFieldProvider,
|
2167
2201
|
{
|
2168
|
-
name:
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2202
|
+
name: localName || id,
|
2203
|
+
subName,
|
2204
|
+
readOnlyFields,
|
2205
|
+
children: /* @__PURE__ */ jsx20(
|
2206
|
+
AutoFieldPrivate,
|
2207
|
+
{
|
2208
|
+
name: subPath,
|
2209
|
+
label: subPath,
|
2210
|
+
id: `${id}_${subName}`,
|
2211
|
+
readOnly: subReadOnly,
|
2212
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
2213
|
+
label: label2
|
2214
|
+
// May be used by custom fields
|
2178
2215
|
}),
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2216
|
+
value: data[subName],
|
2217
|
+
onChange: (val, ui) => {
|
2218
|
+
onChange(
|
2219
|
+
__spreadProps(__spreadValues({}, data), {
|
2220
|
+
[subName]: val
|
2221
|
+
}),
|
2222
|
+
ui
|
2223
|
+
);
|
2224
|
+
}
|
2225
|
+
}
|
2226
|
+
)
|
2182
2227
|
},
|
2183
|
-
|
2228
|
+
subPath
|
2184
2229
|
);
|
2185
2230
|
}) }) })
|
2186
2231
|
}
|
@@ -2206,7 +2251,7 @@ var useSafeId = () => {
|
|
2206
2251
|
};
|
2207
2252
|
|
2208
2253
|
// components/AutoField/index.tsx
|
2209
|
-
import { Fragment as Fragment8, jsx as
|
2254
|
+
import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
2210
2255
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
|
2211
2256
|
var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
|
2212
2257
|
var FieldLabel = ({
|
@@ -2220,14 +2265,14 @@ var FieldLabel = ({
|
|
2220
2265
|
const El = el;
|
2221
2266
|
return /* @__PURE__ */ jsxs9(El, { className, children: [
|
2222
2267
|
/* @__PURE__ */ jsxs9("div", { className: getClassName15("label"), children: [
|
2223
|
-
icon ? /* @__PURE__ */
|
2268
|
+
icon ? /* @__PURE__ */ jsx21("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ jsx21(Fragment8, {}),
|
2224
2269
|
label,
|
2225
|
-
readOnly && /* @__PURE__ */
|
2270
|
+
readOnly && /* @__PURE__ */ jsx21("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ jsx21(Lock, { size: "12" }) })
|
2226
2271
|
] }),
|
2227
2272
|
children
|
2228
2273
|
] });
|
2229
2274
|
};
|
2230
|
-
var
|
2275
|
+
var FieldLabelInternal = ({
|
2231
2276
|
children,
|
2232
2277
|
icon,
|
2233
2278
|
label,
|
@@ -2235,14 +2280,14 @@ var FieldLabelInternal2 = ({
|
|
2235
2280
|
readOnly
|
2236
2281
|
}) => {
|
2237
2282
|
const { overrides } = useAppContext();
|
2238
|
-
const Wrapper =
|
2283
|
+
const Wrapper = useMemo5(
|
2239
2284
|
() => overrides.fieldLabel || FieldLabel,
|
2240
2285
|
[overrides]
|
2241
2286
|
);
|
2242
2287
|
if (!label) {
|
2243
|
-
return /* @__PURE__ */
|
2288
|
+
return /* @__PURE__ */ jsx21(Fragment8, { children });
|
2244
2289
|
}
|
2245
|
-
return /* @__PURE__ */
|
2290
|
+
return /* @__PURE__ */ jsx21(
|
2246
2291
|
Wrapper,
|
2247
2292
|
{
|
2248
2293
|
label,
|
@@ -2256,8 +2301,8 @@ var FieldLabelInternal2 = ({
|
|
2256
2301
|
};
|
2257
2302
|
function AutoFieldInternal(props) {
|
2258
2303
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2259
|
-
const { dispatch, overrides } = useAppContext();
|
2260
|
-
const { id, Label =
|
2304
|
+
const { dispatch, overrides, selectedItem } = useAppContext();
|
2305
|
+
const { id, Label = FieldLabelInternal } = props;
|
2261
2306
|
const field = props.field;
|
2262
2307
|
const label = field.label;
|
2263
2308
|
const defaultId = useSafeId();
|
@@ -2317,20 +2362,30 @@ function AutoFieldInternal(props) {
|
|
2317
2362
|
return null;
|
2318
2363
|
}
|
2319
2364
|
const CustomField = field.render;
|
2320
|
-
return /* @__PURE__ */
|
2365
|
+
return /* @__PURE__ */ jsx21("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx21("div", { className: getClassName15(), children: /* @__PURE__ */ jsx21(CustomField, __spreadValues({}, mergedProps)) }) });
|
2321
2366
|
}
|
2322
2367
|
const children = defaultFields[field.type](mergedProps);
|
2323
2368
|
const Render2 = render[field.type];
|
2324
|
-
|
2325
|
-
|
2369
|
+
const nestedFieldContext = useContext3(NestedFieldContext);
|
2370
|
+
return /* @__PURE__ */ jsx21(
|
2371
|
+
NestedFieldContext.Provider,
|
2326
2372
|
{
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
onClick: (e) => {
|
2331
|
-
e.stopPropagation();
|
2373
|
+
value: {
|
2374
|
+
readOnlyFields: nestedFieldContext.readOnlyFields || (selectedItem == null ? void 0 : selectedItem.readOnly) || {},
|
2375
|
+
localName: nestedFieldContext.localName
|
2332
2376
|
},
|
2333
|
-
children: /* @__PURE__ */
|
2377
|
+
children: /* @__PURE__ */ jsx21(
|
2378
|
+
"div",
|
2379
|
+
{
|
2380
|
+
className: getClassNameWrapper(),
|
2381
|
+
onFocus,
|
2382
|
+
onBlur,
|
2383
|
+
onClick: (e) => {
|
2384
|
+
e.stopPropagation();
|
2385
|
+
},
|
2386
|
+
children: /* @__PURE__ */ jsx21(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
|
2387
|
+
}
|
2388
|
+
)
|
2334
2389
|
}
|
2335
2390
|
);
|
2336
2391
|
}
|
@@ -2358,11 +2413,11 @@ function AutoFieldPrivate(props) {
|
|
2358
2413
|
value: localValue,
|
2359
2414
|
onChange: onChangeLocal
|
2360
2415
|
};
|
2361
|
-
return /* @__PURE__ */
|
2416
|
+
return /* @__PURE__ */ jsx21(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
|
2362
2417
|
}
|
2363
2418
|
function AutoField(props) {
|
2364
|
-
const DefaultLabel =
|
2365
|
-
const DefaultLabel2 = (labelProps) => /* @__PURE__ */
|
2419
|
+
const DefaultLabel = useMemo5(() => {
|
2420
|
+
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ jsx21(
|
2366
2421
|
"div",
|
2367
2422
|
__spreadProps(__spreadValues({}, labelProps), {
|
2368
2423
|
className: getClassName15({ readOnly: props.readOnly })
|
@@ -2370,7 +2425,7 @@ function AutoField(props) {
|
|
2370
2425
|
);
|
2371
2426
|
return DefaultLabel2;
|
2372
2427
|
}, [props.readOnly]);
|
2373
|
-
return /* @__PURE__ */
|
2428
|
+
return /* @__PURE__ */ jsx21(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
|
2374
2429
|
}
|
2375
2430
|
|
2376
2431
|
// components/Drawer/index.tsx
|
@@ -2382,14 +2437,14 @@ var styles_module_default10 = { "Drawer": "_Drawer_1oa7v_1", "DrawerItem--disabl
|
|
2382
2437
|
|
2383
2438
|
// components/Drawer/index.tsx
|
2384
2439
|
import {
|
2385
|
-
createContext as
|
2386
|
-
useContext as
|
2387
|
-
useMemo as
|
2440
|
+
createContext as createContext3,
|
2441
|
+
useContext as useContext4,
|
2442
|
+
useMemo as useMemo6
|
2388
2443
|
} from "react";
|
2389
|
-
import { jsx as
|
2444
|
+
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
2390
2445
|
var getClassName16 = get_class_name_factory_default("Drawer", styles_module_default10);
|
2391
2446
|
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
|
2392
|
-
var drawerContext =
|
2447
|
+
var drawerContext = createContext3({
|
2393
2448
|
droppableId: ""
|
2394
2449
|
});
|
2395
2450
|
var DrawerDraggable = ({
|
@@ -2398,7 +2453,7 @@ var DrawerDraggable = ({
|
|
2398
2453
|
index,
|
2399
2454
|
isDragDisabled
|
2400
2455
|
}) => {
|
2401
|
-
return /* @__PURE__ */
|
2456
|
+
return /* @__PURE__ */ jsx22(
|
2402
2457
|
Draggable,
|
2403
2458
|
{
|
2404
2459
|
id,
|
@@ -2420,21 +2475,21 @@ var DrawerItem = ({
|
|
2420
2475
|
index,
|
2421
2476
|
isDragDisabled
|
2422
2477
|
}) => {
|
2423
|
-
const ctx =
|
2478
|
+
const ctx = useContext4(drawerContext);
|
2424
2479
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
2425
|
-
const CustomInner =
|
2426
|
-
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */
|
2480
|
+
const CustomInner = useMemo6(
|
2481
|
+
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ jsx22("div", { className: getClassNameItem2("default"), children: children2 })),
|
2427
2482
|
[children]
|
2428
2483
|
);
|
2429
|
-
return /* @__PURE__ */
|
2484
|
+
return /* @__PURE__ */ jsx22(
|
2430
2485
|
DrawerDraggable,
|
2431
2486
|
{
|
2432
2487
|
id: resolvedId,
|
2433
2488
|
index,
|
2434
2489
|
isDragDisabled,
|
2435
|
-
children: /* @__PURE__ */
|
2436
|
-
/* @__PURE__ */
|
2437
|
-
/* @__PURE__ */
|
2490
|
+
children: /* @__PURE__ */ jsx22(CustomInner, { name, children: /* @__PURE__ */ jsx22("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs10("div", { className: getClassNameItem2("draggable"), children: [
|
2491
|
+
/* @__PURE__ */ jsx22("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
2492
|
+
/* @__PURE__ */ jsx22("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx22(DragIcon, { isDragDisabled }) })
|
2438
2493
|
] }) }) })
|
2439
2494
|
}
|
2440
2495
|
);
|
@@ -2445,7 +2500,7 @@ var Drawer = ({
|
|
2445
2500
|
direction = "vertical"
|
2446
2501
|
}) => {
|
2447
2502
|
const droppableId = `component-list:${_droppableId}`;
|
2448
|
-
return /* @__PURE__ */
|
2503
|
+
return /* @__PURE__ */ jsx22(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ jsx22(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ jsxs10(
|
2449
2504
|
"div",
|
2450
2505
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
2451
2506
|
ref: provided.innerRef,
|
@@ -2454,7 +2509,7 @@ var Drawer = ({
|
|
2454
2509
|
}),
|
2455
2510
|
children: [
|
2456
2511
|
children,
|
2457
|
-
/* @__PURE__ */
|
2512
|
+
/* @__PURE__ */ jsx22("span", { style: { display: "none" }, children: provided.placeholder })
|
2458
2513
|
]
|
2459
2514
|
})
|
2460
2515
|
) }) });
|
@@ -2463,13 +2518,13 @@ Drawer.Item = DrawerItem;
|
|
2463
2518
|
|
2464
2519
|
// components/DropZone/index.tsx
|
2465
2520
|
init_react_import();
|
2466
|
-
import { useContext as
|
2521
|
+
import { useContext as useContext5, useEffect as useEffect12 } from "react";
|
2467
2522
|
|
2468
2523
|
// components/DraggableComponent/index.tsx
|
2469
2524
|
init_react_import();
|
2470
2525
|
import {
|
2471
2526
|
useEffect as useEffect11,
|
2472
|
-
useMemo as
|
2527
|
+
useMemo as useMemo7,
|
2473
2528
|
useState as useState12
|
2474
2529
|
} from "react";
|
2475
2530
|
import { Draggable as Draggable2 } from "@measured/dnd";
|
@@ -2517,7 +2572,7 @@ var isIos = () => [
|
|
2517
2572
|
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
2518
2573
|
|
2519
2574
|
// components/DraggableComponent/index.tsx
|
2520
|
-
import { jsx as
|
2575
|
+
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
2521
2576
|
var getClassName17 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
2522
2577
|
var space = 8;
|
2523
2578
|
var actionsOverlayTop = space * 6.5;
|
@@ -2526,7 +2581,7 @@ var actionsRight = space;
|
|
2526
2581
|
var DefaultActionBar = ({
|
2527
2582
|
label,
|
2528
2583
|
children
|
2529
|
-
}) => /* @__PURE__ */
|
2584
|
+
}) => /* @__PURE__ */ jsx23(ActionBar, { label, children: /* @__PURE__ */ jsx23(ActionBar.Group, { children }) });
|
2530
2585
|
var DraggableComponent = ({
|
2531
2586
|
children,
|
2532
2587
|
id,
|
@@ -2559,14 +2614,14 @@ var DraggableComponent = ({
|
|
2559
2614
|
setDisableSecondaryAnimation(true);
|
2560
2615
|
}
|
2561
2616
|
}, []);
|
2562
|
-
const CustomActionBar =
|
2617
|
+
const CustomActionBar = useMemo7(
|
2563
2618
|
() => overrides.actionBar || DefaultActionBar,
|
2564
2619
|
[overrides.actionBar]
|
2565
2620
|
);
|
2566
2621
|
const permissions = getPermissions({
|
2567
2622
|
item: selectedItem
|
2568
2623
|
});
|
2569
|
-
return /* @__PURE__ */
|
2624
|
+
return /* @__PURE__ */ jsx23(
|
2570
2625
|
El,
|
2571
2626
|
{
|
2572
2627
|
draggableId: id,
|
@@ -2596,15 +2651,15 @@ var DraggableComponent = ({
|
|
2596
2651
|
onClick,
|
2597
2652
|
children: [
|
2598
2653
|
debug,
|
2599
|
-
isLoading && /* @__PURE__ */
|
2600
|
-
isSelected && /* @__PURE__ */
|
2654
|
+
isLoading && /* @__PURE__ */ jsx23("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ jsx23(Loader, {}) }),
|
2655
|
+
isSelected && /* @__PURE__ */ jsx23(
|
2601
2656
|
"div",
|
2602
2657
|
{
|
2603
2658
|
className: getClassName17("actionsOverlay"),
|
2604
2659
|
style: {
|
2605
2660
|
top: actionsOverlayTop / zoomConfig.zoom
|
2606
2661
|
},
|
2607
|
-
children: /* @__PURE__ */
|
2662
|
+
children: /* @__PURE__ */ jsx23(
|
2608
2663
|
"div",
|
2609
2664
|
{
|
2610
2665
|
className: getClassName17("actions"),
|
@@ -2614,15 +2669,15 @@ var DraggableComponent = ({
|
|
2614
2669
|
right: actionsRight / zoomConfig.zoom
|
2615
2670
|
},
|
2616
2671
|
children: /* @__PURE__ */ jsxs11(CustomActionBar, { label, children: [
|
2617
|
-
permissions.duplicate && /* @__PURE__ */
|
2618
|
-
permissions.delete && /* @__PURE__ */
|
2672
|
+
permissions.duplicate && /* @__PURE__ */ jsx23(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx23(Copy, { size: 16 }) }),
|
2673
|
+
permissions.delete && /* @__PURE__ */ jsx23(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx23(Trash, { size: 16 }) })
|
2619
2674
|
] })
|
2620
2675
|
}
|
2621
2676
|
)
|
2622
2677
|
}
|
2623
2678
|
),
|
2624
|
-
/* @__PURE__ */
|
2625
|
-
/* @__PURE__ */
|
2679
|
+
/* @__PURE__ */ jsx23("div", { className: getClassName17("overlay") }),
|
2680
|
+
/* @__PURE__ */ jsx23("div", { className: getClassName17("contents"), children })
|
2626
2681
|
]
|
2627
2682
|
})
|
2628
2683
|
)
|
@@ -2638,7 +2693,7 @@ var styles_module_default12 = { "DropZone": "_DropZone_djoti_1", "DropZone-conte
|
|
2638
2693
|
// components/DropZone/context.tsx
|
2639
2694
|
init_react_import();
|
2640
2695
|
import {
|
2641
|
-
createContext as
|
2696
|
+
createContext as createContext4,
|
2642
2697
|
useCallback as useCallback6,
|
2643
2698
|
useState as useState13
|
2644
2699
|
} from "react";
|
@@ -2657,8 +2712,8 @@ var getZoneId = (zoneCompound) => {
|
|
2657
2712
|
};
|
2658
2713
|
|
2659
2714
|
// components/DropZone/context.tsx
|
2660
|
-
import { Fragment as Fragment9, jsx as
|
2661
|
-
var dropZoneContext =
|
2715
|
+
import { Fragment as Fragment9, jsx as jsx24 } from "react/jsx-runtime";
|
2716
|
+
var dropZoneContext = createContext4(null);
|
2662
2717
|
var DropZoneProvider = ({
|
2663
2718
|
children,
|
2664
2719
|
value
|
@@ -2735,7 +2790,7 @@ var DropZoneProvider = ({
|
|
2735
2790
|
[value, setPathData]
|
2736
2791
|
);
|
2737
2792
|
const [zoneWillDrag, setZoneWillDrag] = useState13("");
|
2738
|
-
return /* @__PURE__ */
|
2793
|
+
return /* @__PURE__ */ jsx24(Fragment9, { children: value && /* @__PURE__ */ jsx24(
|
2739
2794
|
dropZoneContext.Provider,
|
2740
2795
|
{
|
2741
2796
|
value: __spreadValues({
|
@@ -2761,12 +2816,12 @@ var DropZoneProvider = ({
|
|
2761
2816
|
};
|
2762
2817
|
|
2763
2818
|
// components/DropZone/index.tsx
|
2764
|
-
import { Fragment as Fragment10, jsx as
|
2819
|
+
import { Fragment as Fragment10, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
2765
2820
|
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
|
2766
2821
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
2767
2822
|
var _a;
|
2768
2823
|
const appContext2 = useAppContext();
|
2769
|
-
const ctx =
|
2824
|
+
const ctx = useContext5(dropZoneContext);
|
2770
2825
|
const {
|
2771
2826
|
// These all need setting via context
|
2772
2827
|
data,
|
@@ -2816,7 +2871,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2816
2871
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
2817
2872
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
2818
2873
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
2819
|
-
return /* @__PURE__ */
|
2874
|
+
return /* @__PURE__ */ jsx25("div", { children: "DropZone requires context to work." });
|
2820
2875
|
}
|
2821
2876
|
const {
|
2822
2877
|
hoveringArea = "root",
|
@@ -2857,7 +2912,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2857
2912
|
}
|
2858
2913
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
2859
2914
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
2860
|
-
return /* @__PURE__ */
|
2915
|
+
return /* @__PURE__ */ jsx25(
|
2861
2916
|
"div",
|
2862
2917
|
{
|
2863
2918
|
className: getClassName18({
|
@@ -2874,7 +2929,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2874
2929
|
onMouseUp: () => {
|
2875
2930
|
setZoneWillDrag("");
|
2876
2931
|
},
|
2877
|
-
children: /* @__PURE__ */
|
2932
|
+
children: /* @__PURE__ */ jsx25(
|
2878
2933
|
Droppable,
|
2879
2934
|
{
|
2880
2935
|
droppableId: zoneCompound,
|
@@ -2929,13 +2984,13 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2929
2984
|
className: getClassName18("item"),
|
2930
2985
|
style: { zIndex: isDragging ? 1 : void 0 },
|
2931
2986
|
children: [
|
2932
|
-
/* @__PURE__ */
|
2987
|
+
/* @__PURE__ */ jsx25(
|
2933
2988
|
DropZoneProvider,
|
2934
2989
|
{
|
2935
2990
|
value: __spreadProps(__spreadValues({}, ctx), {
|
2936
2991
|
areaId: componentId
|
2937
2992
|
}),
|
2938
|
-
children: /* @__PURE__ */
|
2993
|
+
children: /* @__PURE__ */ jsx25(
|
2939
2994
|
DraggableComponent,
|
2940
2995
|
{
|
2941
2996
|
label,
|
@@ -3003,12 +3058,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
3003
3058
|
style: {
|
3004
3059
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
3005
3060
|
},
|
3006
|
-
children: /* @__PURE__ */
|
3061
|
+
children: /* @__PURE__ */ jsx25("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ jsx25(Render2, __spreadValues({}, defaultedProps)) })
|
3007
3062
|
}
|
3008
3063
|
)
|
3009
3064
|
}
|
3010
3065
|
),
|
3011
|
-
userIsDragging && /* @__PURE__ */
|
3066
|
+
userIsDragging && /* @__PURE__ */ jsx25(
|
3012
3067
|
"div",
|
3013
3068
|
{
|
3014
3069
|
className: getClassName18("hitbox"),
|
@@ -3025,7 +3080,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
3025
3080
|
);
|
3026
3081
|
}),
|
3027
3082
|
provided == null ? void 0 : provided.placeholder,
|
3028
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */
|
3083
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ jsx25(
|
3029
3084
|
"div",
|
3030
3085
|
{
|
3031
3086
|
"data-puck-placeholder": true,
|
@@ -3046,7 +3101,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
3046
3101
|
);
|
3047
3102
|
}
|
3048
3103
|
function DropZoneRender({ zone }) {
|
3049
|
-
const ctx =
|
3104
|
+
const ctx = useContext5(dropZoneContext);
|
3050
3105
|
const { data, areaId = "root", config } = ctx || {};
|
3051
3106
|
let zoneCompound = rootDroppableId;
|
3052
3107
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -3057,14 +3112,14 @@ function DropZoneRender({ zone }) {
|
|
3057
3112
|
zoneCompound = `${areaId}:${zone}`;
|
3058
3113
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
3059
3114
|
}
|
3060
|
-
return /* @__PURE__ */
|
3115
|
+
return /* @__PURE__ */ jsx25(Fragment10, { children: content.map((item) => {
|
3061
3116
|
const Component = config.components[item.type];
|
3062
3117
|
if (Component) {
|
3063
|
-
return /* @__PURE__ */
|
3118
|
+
return /* @__PURE__ */ jsx25(
|
3064
3119
|
DropZoneProvider,
|
3065
3120
|
{
|
3066
3121
|
value: { data, config, areaId: item.props.id },
|
3067
|
-
children: /* @__PURE__ */
|
3122
|
+
children: /* @__PURE__ */ jsx25(
|
3068
3123
|
Component.render,
|
3069
3124
|
__spreadProps(__spreadValues({}, item.props), {
|
3070
3125
|
puck: { renderDropZone: DropZone }
|
@@ -3078,11 +3133,11 @@ function DropZoneRender({ zone }) {
|
|
3078
3133
|
}) });
|
3079
3134
|
}
|
3080
3135
|
function DropZone(props) {
|
3081
|
-
const ctx =
|
3136
|
+
const ctx = useContext5(dropZoneContext);
|
3082
3137
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
3083
|
-
return /* @__PURE__ */
|
3138
|
+
return /* @__PURE__ */ jsx25(DropZoneEdit, __spreadValues({}, props));
|
3084
3139
|
}
|
3085
|
-
return /* @__PURE__ */
|
3140
|
+
return /* @__PURE__ */ jsx25(DropZoneRender, __spreadValues({}, props));
|
3086
3141
|
}
|
3087
3142
|
|
3088
3143
|
// components/Puck/index.tsx
|
@@ -3090,7 +3145,7 @@ init_react_import();
|
|
3090
3145
|
import {
|
3091
3146
|
useCallback as useCallback11,
|
3092
3147
|
useEffect as useEffect18,
|
3093
|
-
useMemo as
|
3148
|
+
useMemo as useMemo16,
|
3094
3149
|
useReducer,
|
3095
3150
|
useState as useState21
|
3096
3151
|
} from "react";
|
@@ -3102,11 +3157,11 @@ import { useState as useState14 } from "react";
|
|
3102
3157
|
// lib/get-frame.ts
|
3103
3158
|
init_react_import();
|
3104
3159
|
var getFrame = () => {
|
3105
|
-
let
|
3106
|
-
if ((
|
3107
|
-
|
3160
|
+
let frameEl = document.querySelector("#preview-frame");
|
3161
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
3162
|
+
return frameEl.contentDocument || document;
|
3108
3163
|
}
|
3109
|
-
return
|
3164
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
3110
3165
|
};
|
3111
3166
|
|
3112
3167
|
// lib/use-placeholder-style.ts
|
@@ -3165,7 +3220,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
|
|
3165
3220
|
|
3166
3221
|
// lib/use-breadcrumbs.ts
|
3167
3222
|
init_react_import();
|
3168
|
-
import { useContext as
|
3223
|
+
import { useContext as useContext6, useMemo as useMemo8 } from "react";
|
3169
3224
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
3170
3225
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
3171
3226
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -3215,8 +3270,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
3215
3270
|
state: { data },
|
3216
3271
|
selectedItem
|
3217
3272
|
} = useAppContext();
|
3218
|
-
const dzContext =
|
3219
|
-
return
|
3273
|
+
const dzContext = useContext6(dropZoneContext);
|
3274
|
+
return useMemo8(() => {
|
3220
3275
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
3221
3276
|
selectedItem,
|
3222
3277
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -3230,7 +3285,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
3230
3285
|
};
|
3231
3286
|
|
3232
3287
|
// components/SidebarSection/index.tsx
|
3233
|
-
import { jsx as
|
3288
|
+
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
3234
3289
|
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
3235
3290
|
var SidebarSection = ({
|
3236
3291
|
children,
|
@@ -3249,9 +3304,9 @@ var SidebarSection = ({
|
|
3249
3304
|
className: getClassName19({ noBorderTop, noPadding }),
|
3250
3305
|
style: { background },
|
3251
3306
|
children: [
|
3252
|
-
/* @__PURE__ */
|
3307
|
+
/* @__PURE__ */ jsx26("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumbs"), children: [
|
3253
3308
|
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs13("div", { className: getClassName19("breadcrumb"), children: [
|
3254
|
-
/* @__PURE__ */
|
3309
|
+
/* @__PURE__ */ jsx26(
|
3255
3310
|
"button",
|
3256
3311
|
{
|
3257
3312
|
type: "button",
|
@@ -3260,12 +3315,12 @@ var SidebarSection = ({
|
|
3260
3315
|
children: breadcrumb.label
|
3261
3316
|
}
|
3262
3317
|
),
|
3263
|
-
/* @__PURE__ */
|
3318
|
+
/* @__PURE__ */ jsx26(ChevronRight, { size: 16 })
|
3264
3319
|
] }, i)) : null,
|
3265
|
-
/* @__PURE__ */
|
3320
|
+
/* @__PURE__ */ jsx26("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx26(Heading, { rank: "2", size: "xs", children: title }) })
|
3266
3321
|
] }) }),
|
3267
|
-
/* @__PURE__ */
|
3268
|
-
isLoading && /* @__PURE__ */
|
3322
|
+
/* @__PURE__ */ jsx26("div", { className: getClassName19("content"), children }),
|
3323
|
+
isLoading && /* @__PURE__ */ jsx26("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx26(Loader, { size: 32 }) })
|
3269
3324
|
]
|
3270
3325
|
}
|
3271
3326
|
);
|
@@ -3468,6 +3523,9 @@ function reduceData(data, action, config) {
|
|
3468
3523
|
});
|
3469
3524
|
}
|
3470
3525
|
if (action.type === "move") {
|
3526
|
+
if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
|
3527
|
+
return data;
|
3528
|
+
}
|
3471
3529
|
const newData = setupZone(
|
3472
3530
|
setupZone(data, action.sourceZone),
|
3473
3531
|
action.destinationZone
|
@@ -3646,7 +3704,7 @@ init_react_import();
|
|
3646
3704
|
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" };
|
3647
3705
|
|
3648
3706
|
// components/MenuBar/index.tsx
|
3649
|
-
import { Fragment as Fragment11, jsx as
|
3707
|
+
import { Fragment as Fragment11, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
3650
3708
|
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
3651
3709
|
function MenuBar({
|
3652
3710
|
appState,
|
@@ -3660,7 +3718,7 @@ function MenuBar({
|
|
3660
3718
|
history: { back, forward, historyStore }
|
3661
3719
|
} = useAppContext();
|
3662
3720
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
3663
|
-
return /* @__PURE__ */
|
3721
|
+
return /* @__PURE__ */ jsx27(
|
3664
3722
|
"div",
|
3665
3723
|
{
|
3666
3724
|
className: getClassName20({ menuOpen }),
|
@@ -3676,10 +3734,10 @@ function MenuBar({
|
|
3676
3734
|
},
|
3677
3735
|
children: /* @__PURE__ */ jsxs14("div", { className: getClassName20("inner"), children: [
|
3678
3736
|
/* @__PURE__ */ jsxs14("div", { className: getClassName20("history"), children: [
|
3679
|
-
/* @__PURE__ */
|
3680
|
-
/* @__PURE__ */
|
3737
|
+
/* @__PURE__ */ jsx27(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ jsx27(Undo2, { size: 21 }) }),
|
3738
|
+
/* @__PURE__ */ jsx27(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ jsx27(Redo2, { size: 21 }) })
|
3681
3739
|
] }),
|
3682
|
-
/* @__PURE__ */
|
3740
|
+
/* @__PURE__ */ jsx27(Fragment11, { children: renderHeaderActions && renderHeaderActions({
|
3683
3741
|
state: appState,
|
3684
3742
|
dispatch
|
3685
3743
|
}) })
|
@@ -3700,15 +3758,15 @@ init_react_import();
|
|
3700
3758
|
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" };
|
3701
3759
|
|
3702
3760
|
// components/Puck/components/Fields/index.tsx
|
3703
|
-
import { useCallback as useCallback7, useEffect as useEffect13, useMemo as
|
3761
|
+
import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo9, useState as useState15 } from "react";
|
3704
3762
|
|
3705
3763
|
// lib/use-parent.ts
|
3706
3764
|
init_react_import();
|
3707
|
-
import { useContext as
|
3765
|
+
import { useContext as useContext7 } from "react";
|
3708
3766
|
var useParent = (itemSelector) => {
|
3709
3767
|
var _a;
|
3710
3768
|
const { selectedItem, state } = useAppContext();
|
3711
|
-
const { pathData } =
|
3769
|
+
const { pathData } = useContext7(dropZoneContext) || {};
|
3712
3770
|
const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
|
3713
3771
|
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
3714
3772
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
@@ -3717,7 +3775,7 @@ var useParent = (itemSelector) => {
|
|
3717
3775
|
};
|
3718
3776
|
|
3719
3777
|
// components/Puck/components/Fields/index.tsx
|
3720
|
-
import { Fragment as Fragment12, jsx as
|
3778
|
+
import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
3721
3779
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
3722
3780
|
var defaultPageFields = {
|
3723
3781
|
title: { type: "text" }
|
@@ -3725,7 +3783,7 @@ var defaultPageFields = {
|
|
3725
3783
|
var DefaultFields = ({
|
3726
3784
|
children
|
3727
3785
|
}) => {
|
3728
|
-
return /* @__PURE__ */
|
3786
|
+
return /* @__PURE__ */ jsx28(Fragment12, { children });
|
3729
3787
|
};
|
3730
3788
|
var useResolvedFields = () => {
|
3731
3789
|
var _a, _b;
|
@@ -3734,7 +3792,7 @@ var useResolvedFields = () => {
|
|
3734
3792
|
const { data } = state;
|
3735
3793
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
3736
3794
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
3737
|
-
const defaultFields =
|
3795
|
+
const defaultFields = useMemo9(
|
3738
3796
|
() => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
|
3739
3797
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
3740
3798
|
);
|
@@ -3816,7 +3874,7 @@ var Fields = () => {
|
|
3816
3874
|
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;
|
3817
3875
|
const isLoading = fieldsResolving || componentResolving;
|
3818
3876
|
const rootProps = data.root.props || data.root;
|
3819
|
-
const Wrapper =
|
3877
|
+
const Wrapper = useMemo9(() => overrides.fields || DefaultFields, [overrides]);
|
3820
3878
|
return /* @__PURE__ */ jsxs15(
|
3821
3879
|
"form",
|
3822
3880
|
{
|
@@ -3825,7 +3883,7 @@ var Fields = () => {
|
|
3825
3883
|
e.preventDefault();
|
3826
3884
|
},
|
3827
3885
|
children: [
|
3828
|
-
/* @__PURE__ */
|
3886
|
+
/* @__PURE__ */ jsx28(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
3829
3887
|
const field = fields[fieldName];
|
3830
3888
|
if (!(field == null ? void 0 : field.type)) return null;
|
3831
3889
|
const onChange = (value, updatedUi) => {
|
@@ -3896,7 +3954,7 @@ var Fields = () => {
|
|
3896
3954
|
item: selectedItem
|
3897
3955
|
});
|
3898
3956
|
const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
|
3899
|
-
return /* @__PURE__ */
|
3957
|
+
return /* @__PURE__ */ jsx28(
|
3900
3958
|
AutoFieldPrivate,
|
3901
3959
|
{
|
3902
3960
|
field,
|
@@ -3914,7 +3972,7 @@ var Fields = () => {
|
|
3914
3972
|
root: true
|
3915
3973
|
});
|
3916
3974
|
const id = `root_${field.type}_${fieldName}`;
|
3917
|
-
return /* @__PURE__ */
|
3975
|
+
return /* @__PURE__ */ jsx28(
|
3918
3976
|
AutoFieldPrivate,
|
3919
3977
|
{
|
3920
3978
|
field,
|
@@ -3928,7 +3986,7 @@ var Fields = () => {
|
|
3928
3986
|
);
|
3929
3987
|
}
|
3930
3988
|
}) }),
|
3931
|
-
isLoading && /* @__PURE__ */
|
3989
|
+
isLoading && /* @__PURE__ */ jsx28("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx28("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx28(Loader, { size: 16 }) }) })
|
3932
3990
|
]
|
3933
3991
|
}
|
3934
3992
|
);
|
@@ -3949,7 +4007,7 @@ init_react_import();
|
|
3949
4007
|
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" };
|
3950
4008
|
|
3951
4009
|
// components/ComponentList/index.tsx
|
3952
|
-
import { jsx as
|
4010
|
+
import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
3953
4011
|
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
3954
4012
|
var ComponentListItem = ({
|
3955
4013
|
name,
|
@@ -3960,7 +4018,7 @@ var ComponentListItem = ({
|
|
3960
4018
|
const canInsert = getPermissions({
|
3961
4019
|
type: name
|
3962
4020
|
}).insert;
|
3963
|
-
return /* @__PURE__ */
|
4021
|
+
return /* @__PURE__ */ jsx29(
|
3964
4022
|
Drawer.Item,
|
3965
4023
|
{
|
3966
4024
|
label,
|
@@ -3993,14 +4051,14 @@ var ComponentList = ({
|
|
3993
4051
|
}),
|
3994
4052
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
3995
4053
|
children: [
|
3996
|
-
/* @__PURE__ */
|
3997
|
-
/* @__PURE__ */
|
4054
|
+
/* @__PURE__ */ jsx29("div", { children: title }),
|
4055
|
+
/* @__PURE__ */ jsx29("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx29(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx29(ChevronDown, { size: 12 }) })
|
3998
4056
|
]
|
3999
4057
|
}
|
4000
4058
|
),
|
4001
|
-
/* @__PURE__ */
|
4059
|
+
/* @__PURE__ */ jsx29("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx29(Drawer, { droppableId: title, children: children || Object.keys(config.components).map((componentKey, i) => {
|
4002
4060
|
var _a;
|
4003
|
-
return /* @__PURE__ */
|
4061
|
+
return /* @__PURE__ */ jsx29(
|
4004
4062
|
ComponentListItem,
|
4005
4063
|
{
|
4006
4064
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -4015,7 +4073,7 @@ var ComponentList = ({
|
|
4015
4073
|
ComponentList.Item = ComponentListItem;
|
4016
4074
|
|
4017
4075
|
// lib/use-component-list.tsx
|
4018
|
-
import { jsx as
|
4076
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
4019
4077
|
var useComponentList = (config, ui) => {
|
4020
4078
|
const [componentList, setComponentList] = useState16();
|
4021
4079
|
useEffect14(() => {
|
@@ -4028,7 +4086,7 @@ var useComponentList = (config, ui) => {
|
|
4028
4086
|
if (category.visible === false || !category.components) {
|
4029
4087
|
return null;
|
4030
4088
|
}
|
4031
|
-
return /* @__PURE__ */
|
4089
|
+
return /* @__PURE__ */ jsx30(
|
4032
4090
|
ComponentList,
|
4033
4091
|
{
|
4034
4092
|
id: categoryKey,
|
@@ -4037,7 +4095,7 @@ var useComponentList = (config, ui) => {
|
|
4037
4095
|
var _a2;
|
4038
4096
|
matchedComponents.push(componentName);
|
4039
4097
|
const componentConf = config.components[componentName] || {};
|
4040
|
-
return /* @__PURE__ */
|
4098
|
+
return /* @__PURE__ */ jsx30(
|
4041
4099
|
ComponentList.Item,
|
4042
4100
|
{
|
4043
4101
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
@@ -4057,7 +4115,7 @@ var useComponentList = (config, ui) => {
|
|
4057
4115
|
);
|
4058
4116
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
4059
4117
|
_componentList.push(
|
4060
|
-
/* @__PURE__ */
|
4118
|
+
/* @__PURE__ */ jsx30(
|
4061
4119
|
ComponentList,
|
4062
4120
|
{
|
4063
4121
|
id: "other",
|
@@ -4065,7 +4123,7 @@ var useComponentList = (config, ui) => {
|
|
4065
4123
|
children: remainingComponents.map((componentName, i) => {
|
4066
4124
|
var _a2;
|
4067
4125
|
const componentConf = config.components[componentName] || {};
|
4068
|
-
return /* @__PURE__ */
|
4126
|
+
return /* @__PURE__ */ jsx30(
|
4069
4127
|
ComponentList.Item,
|
4070
4128
|
{
|
4071
4129
|
name: componentName,
|
@@ -4087,31 +4145,31 @@ var useComponentList = (config, ui) => {
|
|
4087
4145
|
};
|
4088
4146
|
|
4089
4147
|
// components/Puck/components/Components/index.tsx
|
4090
|
-
import { useMemo as
|
4091
|
-
import { jsx as
|
4148
|
+
import { useMemo as useMemo10 } from "react";
|
4149
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
4092
4150
|
var Components = () => {
|
4093
4151
|
const { config, state, overrides } = useAppContext();
|
4094
4152
|
const componentList = useComponentList(config, state.ui);
|
4095
|
-
const Wrapper =
|
4096
|
-
return /* @__PURE__ */
|
4153
|
+
const Wrapper = useMemo10(() => overrides.components || "div", [overrides]);
|
4154
|
+
return /* @__PURE__ */ jsx31(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx31(ComponentList, { id: "all" }) });
|
4097
4155
|
};
|
4098
4156
|
|
4099
4157
|
// components/Puck/components/Preview/index.tsx
|
4100
4158
|
init_react_import();
|
4101
|
-
import { useCallback as useCallback8, useMemo as
|
4159
|
+
import { useCallback as useCallback8, useMemo as useMemo11 } from "react";
|
4102
4160
|
|
4103
4161
|
// components/AutoFrame/index.tsx
|
4104
4162
|
init_react_import();
|
4105
4163
|
import {
|
4106
|
-
createContext as
|
4107
|
-
useContext as
|
4164
|
+
createContext as createContext5,
|
4165
|
+
useContext as useContext8,
|
4108
4166
|
useEffect as useEffect15,
|
4109
|
-
useRef as
|
4167
|
+
useRef as useRef2,
|
4110
4168
|
useState as useState17
|
4111
4169
|
} from "react";
|
4112
4170
|
import hash from "object-hash";
|
4113
4171
|
import { createPortal as createPortal2 } from "react-dom";
|
4114
|
-
import { Fragment as Fragment13, jsx as
|
4172
|
+
import { Fragment as Fragment13, jsx as jsx32 } from "react/jsx-runtime";
|
4115
4173
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
4116
4174
|
var collectStyles = (doc) => {
|
4117
4175
|
const collected = [];
|
@@ -4311,10 +4369,10 @@ var CopyHostStyles = ({
|
|
4311
4369
|
observer.disconnect();
|
4312
4370
|
};
|
4313
4371
|
}, []);
|
4314
|
-
return /* @__PURE__ */
|
4372
|
+
return /* @__PURE__ */ jsx32(Fragment13, { children });
|
4315
4373
|
};
|
4316
|
-
var autoFrameContext =
|
4317
|
-
var useFrame = () =>
|
4374
|
+
var autoFrameContext = createContext5({});
|
4375
|
+
var useFrame = () => useContext8(autoFrameContext);
|
4318
4376
|
function AutoFrame(_a) {
|
4319
4377
|
var _b = _a, {
|
4320
4378
|
children,
|
@@ -4331,7 +4389,7 @@ function AutoFrame(_a) {
|
|
4331
4389
|
]);
|
4332
4390
|
const [loaded, setLoaded] = useState17(false);
|
4333
4391
|
const [ctx, setCtx] = useState17({});
|
4334
|
-
const ref =
|
4392
|
+
const ref = useRef2(null);
|
4335
4393
|
const [mountTarget, setMountTarget] = useState17();
|
4336
4394
|
useEffect15(() => {
|
4337
4395
|
var _a2;
|
@@ -4343,7 +4401,7 @@ function AutoFrame(_a) {
|
|
4343
4401
|
setMountTarget((_a2 = ref.current.contentDocument) == null ? void 0 : _a2.getElementById("frame-root"));
|
4344
4402
|
}
|
4345
4403
|
}, [ref, loaded]);
|
4346
|
-
return /* @__PURE__ */
|
4404
|
+
return /* @__PURE__ */ jsx32(
|
4347
4405
|
"iframe",
|
4348
4406
|
__spreadProps(__spreadValues({}, props), {
|
4349
4407
|
className,
|
@@ -4353,7 +4411,7 @@ function AutoFrame(_a) {
|
|
4353
4411
|
onLoad: () => {
|
4354
4412
|
setLoaded(true);
|
4355
4413
|
},
|
4356
|
-
children: /* @__PURE__ */
|
4414
|
+
children: /* @__PURE__ */ jsx32(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx32(CopyHostStyles, { debug, onStylesLoaded, children: createPortal2(children, mountTarget) }) })
|
4357
4415
|
})
|
4358
4416
|
);
|
4359
4417
|
}
|
@@ -4365,7 +4423,7 @@ init_react_import();
|
|
4365
4423
|
var styles_module_default18 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
4366
4424
|
|
4367
4425
|
// components/Puck/components/Preview/index.tsx
|
4368
|
-
import { Fragment as Fragment14, jsx as
|
4426
|
+
import { Fragment as Fragment14, jsx as jsx33 } from "react/jsx-runtime";
|
4369
4427
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
4370
4428
|
var Preview = ({ id = "puck-preview" }) => {
|
4371
4429
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
@@ -4374,13 +4432,13 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4374
4432
|
var _a, _b;
|
4375
4433
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
4376
4434
|
id: "puck-root"
|
4377
|
-
}, pageProps)) : /* @__PURE__ */
|
4435
|
+
}, pageProps)) : /* @__PURE__ */ jsx33(Fragment14, { children: pageProps.children });
|
4378
4436
|
},
|
4379
4437
|
[config.root]
|
4380
4438
|
);
|
4381
|
-
const Frame =
|
4439
|
+
const Frame = useMemo11(() => overrides.iframe, [overrides]);
|
4382
4440
|
const rootProps = state.data.root.props || state.data.root;
|
4383
|
-
return /* @__PURE__ */
|
4441
|
+
return /* @__PURE__ */ jsx33(
|
4384
4442
|
"div",
|
4385
4443
|
{
|
4386
4444
|
className: getClassName23(),
|
@@ -4388,7 +4446,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4388
4446
|
onClick: () => {
|
4389
4447
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
4390
4448
|
},
|
4391
|
-
children: iframe.enabled ? /* @__PURE__ */
|
4449
|
+
children: iframe.enabled ? /* @__PURE__ */ jsx33(
|
4392
4450
|
AutoFrame_default,
|
4393
4451
|
{
|
4394
4452
|
id: "preview-frame",
|
@@ -4397,27 +4455,27 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4397
4455
|
onStylesLoaded: () => {
|
4398
4456
|
setStatus("READY");
|
4399
4457
|
},
|
4400
|
-
children: /* @__PURE__ */
|
4401
|
-
const inner = /* @__PURE__ */
|
4458
|
+
children: /* @__PURE__ */ jsx33(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
4459
|
+
const inner = /* @__PURE__ */ jsx33(
|
4402
4460
|
Page,
|
4403
4461
|
__spreadProps(__spreadValues({}, rootProps), {
|
4404
4462
|
puck: { renderDropZone: DropZone, isEditing: true },
|
4405
4463
|
editMode: true,
|
4406
|
-
children: /* @__PURE__ */
|
4464
|
+
children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
|
4407
4465
|
})
|
4408
4466
|
);
|
4409
4467
|
if (Frame) {
|
4410
|
-
return /* @__PURE__ */
|
4468
|
+
return /* @__PURE__ */ jsx33(Frame, { document: document2, children: inner });
|
4411
4469
|
}
|
4412
4470
|
return inner;
|
4413
4471
|
} })
|
4414
4472
|
}
|
4415
|
-
) : /* @__PURE__ */
|
4473
|
+
) : /* @__PURE__ */ jsx33("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ jsx33(
|
4416
4474
|
Page,
|
4417
4475
|
__spreadProps(__spreadValues({}, rootProps), {
|
4418
4476
|
puck: { renderDropZone: DropZone, isEditing: true },
|
4419
4477
|
editMode: true,
|
4420
|
-
children: /* @__PURE__ */
|
4478
|
+
children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
|
4421
4479
|
})
|
4422
4480
|
) })
|
4423
4481
|
}
|
@@ -4467,7 +4525,7 @@ var scrollIntoView = (el) => {
|
|
4467
4525
|
};
|
4468
4526
|
|
4469
4527
|
// components/LayerTree/index.tsx
|
4470
|
-
import { useContext as
|
4528
|
+
import { useContext as useContext9 } from "react";
|
4471
4529
|
|
4472
4530
|
// lib/is-child-of-zone.ts
|
4473
4531
|
init_react_import();
|
@@ -4481,7 +4539,7 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
4481
4539
|
};
|
4482
4540
|
|
4483
4541
|
// components/LayerTree/index.tsx
|
4484
|
-
import { Fragment as Fragment15, jsx as
|
4542
|
+
import { Fragment as Fragment15, jsx as jsx34, jsxs as jsxs17 } from "react/jsx-runtime";
|
4485
4543
|
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
4486
4544
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
4487
4545
|
var LayerTree = ({
|
@@ -4494,15 +4552,15 @@ var LayerTree = ({
|
|
4494
4552
|
label
|
4495
4553
|
}) => {
|
4496
4554
|
const zones = data.zones || {};
|
4497
|
-
const ctx =
|
4555
|
+
const ctx = useContext9(dropZoneContext);
|
4498
4556
|
return /* @__PURE__ */ jsxs17(Fragment15, { children: [
|
4499
4557
|
label && /* @__PURE__ */ jsxs17("div", { className: getClassName24("zoneTitle"), children: [
|
4500
|
-
/* @__PURE__ */
|
4558
|
+
/* @__PURE__ */ jsx34("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx34(Layers, { size: "16" }) }),
|
4501
4559
|
" ",
|
4502
4560
|
label
|
4503
4561
|
] }),
|
4504
4562
|
/* @__PURE__ */ jsxs17("ul", { className: getClassName24(), children: [
|
4505
|
-
zoneContent.length === 0 && /* @__PURE__ */
|
4563
|
+
zoneContent.length === 0 && /* @__PURE__ */ jsx34("div", { className: getClassName24("helper"), children: "No items" }),
|
4506
4564
|
zoneContent.map((item, i) => {
|
4507
4565
|
var _a;
|
4508
4566
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -4530,7 +4588,7 @@ var LayerTree = ({
|
|
4530
4588
|
childIsSelected
|
4531
4589
|
}),
|
4532
4590
|
children: [
|
4533
|
-
/* @__PURE__ */
|
4591
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs17(
|
4534
4592
|
"button",
|
4535
4593
|
{
|
4536
4594
|
type: "button",
|
@@ -4563,22 +4621,22 @@ var LayerTree = ({
|
|
4563
4621
|
setHoveringComponent(null);
|
4564
4622
|
},
|
4565
4623
|
children: [
|
4566
|
-
containsZone && /* @__PURE__ */
|
4624
|
+
containsZone && /* @__PURE__ */ jsx34(
|
4567
4625
|
"div",
|
4568
4626
|
{
|
4569
4627
|
className: getClassNameLayer("chevron"),
|
4570
4628
|
title: isSelected ? "Collapse" : "Expand",
|
4571
|
-
children: /* @__PURE__ */
|
4629
|
+
children: /* @__PURE__ */ jsx34(ChevronDown, { size: "12" })
|
4572
4630
|
}
|
4573
4631
|
),
|
4574
4632
|
/* @__PURE__ */ jsxs17("div", { className: getClassNameLayer("title"), children: [
|
4575
|
-
/* @__PURE__ */
|
4576
|
-
/* @__PURE__ */
|
4633
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx34(Type, { size: "16" }) : /* @__PURE__ */ jsx34(LayoutGrid, { size: "16" }) }),
|
4634
|
+
/* @__PURE__ */ jsx34("div", { className: getClassNameLayer("name"), children: label2 })
|
4577
4635
|
] })
|
4578
4636
|
]
|
4579
4637
|
}
|
4580
4638
|
) }),
|
4581
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */
|
4639
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx34(
|
4582
4640
|
LayerTree,
|
4583
4641
|
{
|
4584
4642
|
config,
|
@@ -4600,8 +4658,8 @@ var LayerTree = ({
|
|
4600
4658
|
};
|
4601
4659
|
|
4602
4660
|
// components/Puck/components/Outline/index.tsx
|
4603
|
-
import { useCallback as useCallback9, useMemo as
|
4604
|
-
import { Fragment as Fragment16, jsx as
|
4661
|
+
import { useCallback as useCallback9, useMemo as useMemo12 } from "react";
|
4662
|
+
import { Fragment as Fragment16, jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
|
4605
4663
|
var Outline = () => {
|
4606
4664
|
const { dispatch, state, overrides, config } = useAppContext();
|
4607
4665
|
const { data, ui } = state;
|
@@ -4615,9 +4673,9 @@ var Outline = () => {
|
|
4615
4673
|
},
|
4616
4674
|
[]
|
4617
4675
|
);
|
4618
|
-
const Wrapper =
|
4619
|
-
return /* @__PURE__ */
|
4620
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */
|
4676
|
+
const Wrapper = useMemo12(() => overrides.outline || "div", [overrides]);
|
4677
|
+
return /* @__PURE__ */ jsx35(Wrapper, { children: /* @__PURE__ */ jsx35(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs18(Fragment16, { children: [
|
4678
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx35(
|
4621
4679
|
LayerTree,
|
4622
4680
|
{
|
4623
4681
|
config,
|
@@ -4630,7 +4688,7 @@ var Outline = () => {
|
|
4630
4688
|
),
|
4631
4689
|
Object.entries(findZonesForArea(data, "root")).map(
|
4632
4690
|
([zoneKey, zone]) => {
|
4633
|
-
return /* @__PURE__ */
|
4691
|
+
return /* @__PURE__ */ jsx35(
|
4634
4692
|
LayerTree,
|
4635
4693
|
{
|
4636
4694
|
config,
|
@@ -4654,7 +4712,8 @@ import { useHotkeys } from "react-hotkeys-hook";
|
|
4654
4712
|
function usePuckHistory({
|
4655
4713
|
dispatch,
|
4656
4714
|
initialAppState,
|
4657
|
-
historyStore
|
4715
|
+
historyStore,
|
4716
|
+
iframeEnabled
|
4658
4717
|
}) {
|
4659
4718
|
const back = () => {
|
4660
4719
|
var _a;
|
@@ -4672,6 +4731,16 @@ function usePuckHistory({
|
|
4672
4731
|
historyStore.forward();
|
4673
4732
|
}
|
4674
4733
|
};
|
4734
|
+
const backIframe = () => {
|
4735
|
+
if (iframeEnabled) {
|
4736
|
+
back();
|
4737
|
+
}
|
4738
|
+
};
|
4739
|
+
const forwardIframe = () => {
|
4740
|
+
if (iframeEnabled) {
|
4741
|
+
forward();
|
4742
|
+
}
|
4743
|
+
};
|
4675
4744
|
const setHistories = (histories) => {
|
4676
4745
|
var _a;
|
4677
4746
|
dispatch({
|
@@ -4690,9 +4759,23 @@ function usePuckHistory({
|
|
4690
4759
|
historyStore.setHistoryIndex(index);
|
4691
4760
|
}
|
4692
4761
|
};
|
4762
|
+
const frame = getFrame();
|
4763
|
+
const resolvedFrame = frame !== document ? frame : void 0;
|
4693
4764
|
useHotkeys("meta+z", back, { preventDefault: true });
|
4694
4765
|
useHotkeys("meta+shift+z", forward, { preventDefault: true });
|
4695
4766
|
useHotkeys("meta+y", forward, { preventDefault: true });
|
4767
|
+
useHotkeys("meta+z", backIframe, {
|
4768
|
+
preventDefault: true,
|
4769
|
+
document: resolvedFrame
|
4770
|
+
});
|
4771
|
+
useHotkeys("meta+shift+z", forwardIframe, {
|
4772
|
+
preventDefault: true,
|
4773
|
+
document: resolvedFrame
|
4774
|
+
});
|
4775
|
+
useHotkeys("meta+y", forwardIframe, {
|
4776
|
+
preventDefault: true,
|
4777
|
+
document: resolvedFrame
|
4778
|
+
});
|
4696
4779
|
return {
|
4697
4780
|
back,
|
4698
4781
|
forward,
|
@@ -4879,25 +4962,25 @@ var getBox = function getBox2(el) {
|
|
4879
4962
|
import {
|
4880
4963
|
useCallback as useCallback10,
|
4881
4964
|
useEffect as useEffect17,
|
4882
|
-
useMemo as
|
4883
|
-
useRef as
|
4965
|
+
useMemo as useMemo14,
|
4966
|
+
useRef as useRef3,
|
4884
4967
|
useState as useState20
|
4885
4968
|
} from "react";
|
4886
4969
|
|
4887
4970
|
// components/ViewportControls/index.tsx
|
4888
4971
|
init_react_import();
|
4889
|
-
import { useEffect as useEffect16, useMemo as
|
4972
|
+
import { useEffect as useEffect16, useMemo as useMemo13, useState as useState19 } from "react";
|
4890
4973
|
|
4891
4974
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
4892
4975
|
init_react_import();
|
4893
4976
|
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" };
|
4894
4977
|
|
4895
4978
|
// components/ViewportControls/index.tsx
|
4896
|
-
import { jsx as
|
4979
|
+
import { jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
|
4897
4980
|
var icons = {
|
4898
|
-
Smartphone: /* @__PURE__ */
|
4899
|
-
Tablet: /* @__PURE__ */
|
4900
|
-
Monitor: /* @__PURE__ */
|
4981
|
+
Smartphone: /* @__PURE__ */ jsx36(Smartphone, { size: 16 }),
|
4982
|
+
Tablet: /* @__PURE__ */ jsx36(Tablet, { size: 16 }),
|
4983
|
+
Monitor: /* @__PURE__ */ jsx36(Monitor, { size: 16 })
|
4901
4984
|
};
|
4902
4985
|
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
4903
4986
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
@@ -4913,7 +4996,7 @@ var ViewportButton = ({
|
|
4913
4996
|
useEffect16(() => {
|
4914
4997
|
setIsActive(width === state.ui.viewports.current.width);
|
4915
4998
|
}, [width, state.ui.viewports.current.width]);
|
4916
|
-
return /* @__PURE__ */
|
4999
|
+
return /* @__PURE__ */ jsx36("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx36(
|
4917
5000
|
IconButton,
|
4918
5001
|
{
|
4919
5002
|
title,
|
@@ -4922,7 +5005,7 @@ var ViewportButton = ({
|
|
4922
5005
|
e.stopPropagation();
|
4923
5006
|
onClick({ width, height });
|
4924
5007
|
},
|
4925
|
-
children: /* @__PURE__ */
|
5008
|
+
children: /* @__PURE__ */ jsx36("span", { className: getClassNameButton("inner"), children })
|
4926
5009
|
}
|
4927
5010
|
) });
|
4928
5011
|
};
|
@@ -4946,7 +5029,7 @@ var ViewportControls = ({
|
|
4946
5029
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
4947
5030
|
(option) => option.value === autoZoom
|
4948
5031
|
);
|
4949
|
-
const zoomOptions =
|
5032
|
+
const zoomOptions = useMemo13(
|
4950
5033
|
() => [
|
4951
5034
|
...defaultZoomOptions,
|
4952
5035
|
...defaultsContainAutoZoom ? [] : [
|
@@ -4959,7 +5042,7 @@ var ViewportControls = ({
|
|
4959
5042
|
[autoZoom]
|
4960
5043
|
);
|
4961
5044
|
return /* @__PURE__ */ jsxs19("div", { className: getClassName25(), children: [
|
4962
|
-
viewports.map((viewport, i) => /* @__PURE__ */
|
5045
|
+
viewports.map((viewport, i) => /* @__PURE__ */ jsx36(
|
4963
5046
|
ViewportButton,
|
4964
5047
|
{
|
4965
5048
|
height: viewport.height,
|
@@ -4970,8 +5053,8 @@ var ViewportControls = ({
|
|
4970
5053
|
},
|
4971
5054
|
i
|
4972
5055
|
)),
|
4973
|
-
/* @__PURE__ */
|
4974
|
-
/* @__PURE__ */
|
5056
|
+
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
5057
|
+
/* @__PURE__ */ jsx36(
|
4975
5058
|
IconButton,
|
4976
5059
|
{
|
4977
5060
|
title: "Zoom viewport out",
|
@@ -4985,10 +5068,10 @@ var ViewportControls = ({
|
|
4985
5068
|
)].value
|
4986
5069
|
);
|
4987
5070
|
},
|
4988
|
-
children: /* @__PURE__ */
|
5071
|
+
children: /* @__PURE__ */ jsx36(ZoomOut, { size: 16 })
|
4989
5072
|
}
|
4990
5073
|
),
|
4991
|
-
/* @__PURE__ */
|
5074
|
+
/* @__PURE__ */ jsx36(
|
4992
5075
|
IconButton,
|
4993
5076
|
{
|
4994
5077
|
title: "Zoom viewport in",
|
@@ -5002,11 +5085,11 @@ var ViewportControls = ({
|
|
5002
5085
|
)].value
|
5003
5086
|
);
|
5004
5087
|
},
|
5005
|
-
children: /* @__PURE__ */
|
5088
|
+
children: /* @__PURE__ */ jsx36(ZoomIn, { size: 16 })
|
5006
5089
|
}
|
5007
5090
|
),
|
5008
|
-
/* @__PURE__ */
|
5009
|
-
/* @__PURE__ */
|
5091
|
+
/* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
|
5092
|
+
/* @__PURE__ */ jsx36(
|
5010
5093
|
"select",
|
5011
5094
|
{
|
5012
5095
|
className: getClassName25("zoomSelect"),
|
@@ -5014,7 +5097,7 @@ var ViewportControls = ({
|
|
5014
5097
|
onChange: (e) => {
|
5015
5098
|
onZoom(parseFloat(e.currentTarget.value));
|
5016
5099
|
},
|
5017
|
-
children: zoomOptions.map((option) => /* @__PURE__ */
|
5100
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ jsx36(
|
5018
5101
|
"option",
|
5019
5102
|
{
|
5020
5103
|
value: option.value,
|
@@ -5029,7 +5112,7 @@ var ViewportControls = ({
|
|
5029
5112
|
|
5030
5113
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
5031
5114
|
init_react_import();
|
5032
|
-
var styles_module_default21 = { "PuckCanvas": "
|
5115
|
+
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" };
|
5033
5116
|
|
5034
5117
|
// lib/get-zoom-config.ts
|
5035
5118
|
init_react_import();
|
@@ -5062,20 +5145,20 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
5062
5145
|
};
|
5063
5146
|
|
5064
5147
|
// components/Puck/components/Canvas/index.tsx
|
5065
|
-
import { Fragment as Fragment17, jsx as
|
5148
|
+
import { Fragment as Fragment17, jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
|
5066
5149
|
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
5067
5150
|
var ZOOM_ON_CHANGE = true;
|
5068
5151
|
var Canvas = () => {
|
5069
5152
|
const { status, iframe } = useAppContext();
|
5070
5153
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
5071
5154
|
const { ui } = state;
|
5072
|
-
const frameRef =
|
5155
|
+
const frameRef = useRef3(null);
|
5073
5156
|
const [showTransition, setShowTransition] = useState20(false);
|
5074
|
-
const defaultRender =
|
5075
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */
|
5157
|
+
const defaultRender = useMemo14(() => {
|
5158
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment17, { children });
|
5076
5159
|
return PuckDefault;
|
5077
5160
|
}, []);
|
5078
|
-
const CustomPreview =
|
5161
|
+
const CustomPreview = useMemo14(
|
5079
5162
|
() => overrides.preview || defaultRender,
|
5080
5163
|
[overrides]
|
5081
5164
|
);
|
@@ -5146,7 +5229,7 @@ var Canvas = () => {
|
|
5146
5229
|
recordHistory: true
|
5147
5230
|
}),
|
5148
5231
|
children: [
|
5149
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */
|
5232
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx37("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx37(
|
5150
5233
|
ViewportControls,
|
5151
5234
|
{
|
5152
5235
|
autoZoom: zoomConfig.autoZoom,
|
@@ -5172,7 +5255,7 @@ var Canvas = () => {
|
|
5172
5255
|
}
|
5173
5256
|
) }),
|
5174
5257
|
/* @__PURE__ */ jsxs20("div", { className: getClassName26("inner"), ref: frameRef, children: [
|
5175
|
-
/* @__PURE__ */
|
5258
|
+
/* @__PURE__ */ jsx37(
|
5176
5259
|
"div",
|
5177
5260
|
{
|
5178
5261
|
className: getClassName26("root"),
|
@@ -5184,10 +5267,10 @@ var Canvas = () => {
|
|
5184
5267
|
overflow: iframe.enabled ? void 0 : "auto"
|
5185
5268
|
},
|
5186
5269
|
suppressHydrationWarning: true,
|
5187
|
-
children: /* @__PURE__ */
|
5270
|
+
children: /* @__PURE__ */ jsx37(CustomPreview, { children: /* @__PURE__ */ jsx37(Preview, {}) })
|
5188
5271
|
}
|
5189
5272
|
),
|
5190
|
-
/* @__PURE__ */
|
5273
|
+
/* @__PURE__ */ jsx37("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx37(Loader, { size: 24 }) })
|
5191
5274
|
] })
|
5192
5275
|
]
|
5193
5276
|
}
|
@@ -5231,7 +5314,7 @@ var insertComponent = (componentType, zone, index, {
|
|
5231
5314
|
|
5232
5315
|
// lib/use-loaded-overrides.ts
|
5233
5316
|
init_react_import();
|
5234
|
-
import { useMemo as
|
5317
|
+
import { useMemo as useMemo15 } from "react";
|
5235
5318
|
|
5236
5319
|
// lib/load-overrides.ts
|
5237
5320
|
init_react_import();
|
@@ -5270,18 +5353,18 @@ var useLoadedOverrides = ({
|
|
5270
5353
|
overrides,
|
5271
5354
|
plugins
|
5272
5355
|
}) => {
|
5273
|
-
return
|
5356
|
+
return useMemo15(() => {
|
5274
5357
|
return loadOverrides({ overrides, plugins });
|
5275
5358
|
}, [plugins, overrides]);
|
5276
5359
|
};
|
5277
5360
|
|
5278
5361
|
// components/DefaultOverride/index.tsx
|
5279
5362
|
init_react_import();
|
5280
|
-
import { Fragment as Fragment18, jsx as
|
5281
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */
|
5363
|
+
import { Fragment as Fragment18, jsx as jsx38 } from "react/jsx-runtime";
|
5364
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment18, { children });
|
5282
5365
|
|
5283
5366
|
// components/Puck/index.tsx
|
5284
|
-
import { Fragment as Fragment19, jsx as
|
5367
|
+
import { Fragment as Fragment19, jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
5285
5368
|
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
5286
5369
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
5287
5370
|
function Puck({
|
@@ -5304,13 +5387,13 @@ function Puck({
|
|
5304
5387
|
dnd,
|
5305
5388
|
initialHistory: _initialHistory
|
5306
5389
|
}) {
|
5307
|
-
var _a;
|
5390
|
+
var _a, _b;
|
5308
5391
|
const iframe = __spreadValues({
|
5309
5392
|
enabled: true,
|
5310
5393
|
waitForStyles: true
|
5311
5394
|
}, _iframe);
|
5312
5395
|
const [generatedAppState] = useState21(() => {
|
5313
|
-
var _a2,
|
5396
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
5314
5397
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
5315
5398
|
let clientUiState = {};
|
5316
5399
|
if (typeof window !== "undefined") {
|
@@ -5330,7 +5413,7 @@ function Puck({
|
|
5330
5413
|
clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
|
5331
5414
|
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
5332
5415
|
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
5333
|
-
height: ((
|
5416
|
+
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",
|
5334
5417
|
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)
|
5335
5418
|
})
|
5336
5419
|
})
|
@@ -5393,7 +5476,12 @@ function Puck({
|
|
5393
5476
|
flushZones(initialAppState)
|
5394
5477
|
);
|
5395
5478
|
const { data, ui } = appState;
|
5396
|
-
const history = usePuckHistory({
|
5479
|
+
const history = usePuckHistory({
|
5480
|
+
dispatch,
|
5481
|
+
initialAppState,
|
5482
|
+
historyStore,
|
5483
|
+
iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
|
5484
|
+
});
|
5397
5485
|
const [menuOpen, setMenuOpen] = useState21(false);
|
5398
5486
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
5399
5487
|
const setItemSelector = useCallback11(
|
@@ -5451,28 +5539,28 @@ function Puck({
|
|
5451
5539
|
window.removeEventListener("resize", handleResize);
|
5452
5540
|
};
|
5453
5541
|
}, []);
|
5454
|
-
const defaultHeaderRender =
|
5542
|
+
const defaultHeaderRender = useMemo16(() => {
|
5455
5543
|
if (renderHeader) {
|
5456
5544
|
console.warn(
|
5457
5545
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
5458
5546
|
);
|
5459
5547
|
const RenderHeader = (_a2) => {
|
5460
|
-
var
|
5548
|
+
var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
|
5461
5549
|
const Comp = renderHeader;
|
5462
|
-
return /* @__PURE__ */
|
5550
|
+
return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
5463
5551
|
};
|
5464
5552
|
return RenderHeader;
|
5465
5553
|
}
|
5466
5554
|
return DefaultOverride;
|
5467
5555
|
}, [renderHeader]);
|
5468
|
-
const defaultHeaderActionsRender =
|
5556
|
+
const defaultHeaderActionsRender = useMemo16(() => {
|
5469
5557
|
if (renderHeaderActions) {
|
5470
5558
|
console.warn(
|
5471
5559
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
5472
5560
|
);
|
5473
5561
|
const RenderHeader = (props) => {
|
5474
5562
|
const Comp = renderHeaderActions;
|
5475
|
-
return /* @__PURE__ */
|
5563
|
+
return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
5476
5564
|
};
|
5477
5565
|
return RenderHeader;
|
5478
5566
|
}
|
@@ -5482,15 +5570,15 @@ function Puck({
|
|
5482
5570
|
overrides,
|
5483
5571
|
plugins
|
5484
5572
|
});
|
5485
|
-
const CustomPuck =
|
5573
|
+
const CustomPuck = useMemo16(
|
5486
5574
|
() => loadedOverrides.puck || DefaultOverride,
|
5487
5575
|
[loadedOverrides]
|
5488
5576
|
);
|
5489
|
-
const CustomHeader =
|
5577
|
+
const CustomHeader = useMemo16(
|
5490
5578
|
() => loadedOverrides.header || defaultHeaderRender,
|
5491
5579
|
[loadedOverrides]
|
5492
5580
|
);
|
5493
|
-
const CustomHeaderActions =
|
5581
|
+
const CustomHeaderActions = useMemo16(
|
5494
5582
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
5495
5583
|
[loadedOverrides]
|
5496
5584
|
);
|
@@ -5499,9 +5587,9 @@ function Puck({
|
|
5499
5587
|
setMounted(true);
|
5500
5588
|
}, []);
|
5501
5589
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
5502
|
-
const selectedComponentLabel = selectedItem ? (
|
5590
|
+
const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
|
5503
5591
|
return /* @__PURE__ */ jsxs21("div", { className: `Puck ${getClassName27()}`, children: [
|
5504
|
-
/* @__PURE__ */
|
5592
|
+
/* @__PURE__ */ jsx39(
|
5505
5593
|
AppProvider,
|
5506
5594
|
{
|
5507
5595
|
value: {
|
@@ -5523,7 +5611,7 @@ function Puck({
|
|
5523
5611
|
getPermissions: () => ({}),
|
5524
5612
|
refreshPermissions: () => null
|
5525
5613
|
},
|
5526
|
-
children: /* @__PURE__ */
|
5614
|
+
children: /* @__PURE__ */ jsx39(appContext.Consumer, { children: ({ resolveData }) => /* @__PURE__ */ jsx39(
|
5527
5615
|
DragDropContext,
|
5528
5616
|
{
|
5529
5617
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -5575,7 +5663,7 @@ function Puck({
|
|
5575
5663
|
});
|
5576
5664
|
}
|
5577
5665
|
},
|
5578
|
-
children: /* @__PURE__ */
|
5666
|
+
children: /* @__PURE__ */ jsx39(
|
5579
5667
|
DropZoneProvider,
|
5580
5668
|
{
|
5581
5669
|
value: {
|
@@ -5589,7 +5677,7 @@ function Puck({
|
|
5589
5677
|
mode: "edit",
|
5590
5678
|
areaId: "root"
|
5591
5679
|
},
|
5592
|
-
children: /* @__PURE__ */
|
5680
|
+
children: /* @__PURE__ */ jsx39(CustomPuck, { children: children || /* @__PURE__ */ jsx39(
|
5593
5681
|
"div",
|
5594
5682
|
{
|
5595
5683
|
className: getLayoutClassName({
|
@@ -5599,57 +5687,57 @@ function Puck({
|
|
5599
5687
|
rightSideBarVisible
|
5600
5688
|
}),
|
5601
5689
|
children: /* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("inner"), children: [
|
5602
|
-
/* @__PURE__ */
|
5690
|
+
/* @__PURE__ */ jsx39(
|
5603
5691
|
CustomHeader,
|
5604
5692
|
{
|
5605
|
-
actions: /* @__PURE__ */
|
5693
|
+
actions: /* @__PURE__ */ jsx39(Fragment19, { children: /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
|
5606
5694
|
Button,
|
5607
5695
|
{
|
5608
5696
|
onClick: () => {
|
5609
5697
|
onPublish && onPublish(data);
|
5610
5698
|
},
|
5611
|
-
icon: /* @__PURE__ */
|
5699
|
+
icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
|
5612
5700
|
children: "Publish"
|
5613
5701
|
}
|
5614
5702
|
) }) }),
|
5615
|
-
children: /* @__PURE__ */
|
5703
|
+
children: /* @__PURE__ */ jsx39("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("headerInner"), children: [
|
5616
5704
|
/* @__PURE__ */ jsxs21(
|
5617
5705
|
"div",
|
5618
5706
|
{
|
5619
5707
|
className: getLayoutClassName("headerToggle"),
|
5620
5708
|
children: [
|
5621
|
-
/* @__PURE__ */
|
5709
|
+
/* @__PURE__ */ jsx39(
|
5622
5710
|
"div",
|
5623
5711
|
{
|
5624
5712
|
className: getLayoutClassName(
|
5625
5713
|
"leftSideBarToggle"
|
5626
5714
|
),
|
5627
|
-
children: /* @__PURE__ */
|
5715
|
+
children: /* @__PURE__ */ jsx39(
|
5628
5716
|
IconButton,
|
5629
5717
|
{
|
5630
5718
|
onClick: () => {
|
5631
5719
|
toggleSidebars("left");
|
5632
5720
|
},
|
5633
5721
|
title: "Toggle left sidebar",
|
5634
|
-
children: /* @__PURE__ */
|
5722
|
+
children: /* @__PURE__ */ jsx39(PanelLeft, { focusable: "false" })
|
5635
5723
|
}
|
5636
5724
|
)
|
5637
5725
|
}
|
5638
5726
|
),
|
5639
|
-
/* @__PURE__ */
|
5727
|
+
/* @__PURE__ */ jsx39(
|
5640
5728
|
"div",
|
5641
5729
|
{
|
5642
5730
|
className: getLayoutClassName(
|
5643
5731
|
"rightSideBarToggle"
|
5644
5732
|
),
|
5645
|
-
children: /* @__PURE__ */
|
5733
|
+
children: /* @__PURE__ */ jsx39(
|
5646
5734
|
IconButton,
|
5647
5735
|
{
|
5648
5736
|
onClick: () => {
|
5649
5737
|
toggleSidebars("right");
|
5650
5738
|
},
|
5651
5739
|
title: "Toggle right sidebar",
|
5652
|
-
children: /* @__PURE__ */
|
5740
|
+
children: /* @__PURE__ */ jsx39(PanelRight, { focusable: "false" })
|
5653
5741
|
}
|
5654
5742
|
)
|
5655
5743
|
}
|
@@ -5657,7 +5745,7 @@ function Puck({
|
|
5657
5745
|
]
|
5658
5746
|
}
|
5659
5747
|
),
|
5660
|
-
/* @__PURE__ */
|
5748
|
+
/* @__PURE__ */ jsx39(
|
5661
5749
|
"div",
|
5662
5750
|
{
|
5663
5751
|
className: getLayoutClassName("headerTitle"),
|
@@ -5665,7 +5753,7 @@ function Puck({
|
|
5665
5753
|
headerTitle || rootProps.title || "Page",
|
5666
5754
|
headerPath && /* @__PURE__ */ jsxs21(Fragment19, { children: [
|
5667
5755
|
" ",
|
5668
|
-
/* @__PURE__ */
|
5756
|
+
/* @__PURE__ */ jsx39(
|
5669
5757
|
"code",
|
5670
5758
|
{
|
5671
5759
|
className: getLayoutClassName(
|
@@ -5683,36 +5771,36 @@ function Puck({
|
|
5683
5771
|
{
|
5684
5772
|
className: getLayoutClassName("headerTools"),
|
5685
5773
|
children: [
|
5686
|
-
/* @__PURE__ */
|
5774
|
+
/* @__PURE__ */ jsx39(
|
5687
5775
|
"div",
|
5688
5776
|
{
|
5689
5777
|
className: getLayoutClassName("menuButton"),
|
5690
|
-
children: /* @__PURE__ */
|
5778
|
+
children: /* @__PURE__ */ jsx39(
|
5691
5779
|
IconButton,
|
5692
5780
|
{
|
5693
5781
|
onClick: () => {
|
5694
5782
|
return setMenuOpen(!menuOpen);
|
5695
5783
|
},
|
5696
5784
|
title: "Toggle menu bar",
|
5697
|
-
children: menuOpen ? /* @__PURE__ */
|
5785
|
+
children: menuOpen ? /* @__PURE__ */ jsx39(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx39(ChevronDown, { focusable: "false" })
|
5698
5786
|
}
|
5699
5787
|
)
|
5700
5788
|
}
|
5701
5789
|
),
|
5702
|
-
/* @__PURE__ */
|
5790
|
+
/* @__PURE__ */ jsx39(
|
5703
5791
|
MenuBar,
|
5704
5792
|
{
|
5705
5793
|
appState,
|
5706
5794
|
dispatch,
|
5707
5795
|
onPublish,
|
5708
5796
|
menuOpen,
|
5709
|
-
renderHeaderActions: () => /* @__PURE__ */
|
5797
|
+
renderHeaderActions: () => /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
|
5710
5798
|
Button,
|
5711
5799
|
{
|
5712
5800
|
onClick: () => {
|
5713
5801
|
onPublish && onPublish(data);
|
5714
5802
|
},
|
5715
|
-
icon: /* @__PURE__ */
|
5803
|
+
icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
|
5716
5804
|
children: "Publish"
|
5717
5805
|
}
|
5718
5806
|
) }),
|
@@ -5726,18 +5814,18 @@ function Puck({
|
|
5726
5814
|
}
|
5727
5815
|
),
|
5728
5816
|
/* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("leftSideBar"), children: [
|
5729
|
-
/* @__PURE__ */
|
5730
|
-
/* @__PURE__ */
|
5817
|
+
/* @__PURE__ */ jsx39(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx39(Components, {}) }),
|
5818
|
+
/* @__PURE__ */ jsx39(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx39(Outline, {}) })
|
5731
5819
|
] }),
|
5732
|
-
/* @__PURE__ */
|
5733
|
-
/* @__PURE__ */
|
5820
|
+
/* @__PURE__ */ jsx39(Canvas, {}),
|
5821
|
+
/* @__PURE__ */ jsx39("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx39(
|
5734
5822
|
SidebarSection,
|
5735
5823
|
{
|
5736
5824
|
noPadding: true,
|
5737
5825
|
noBorderTop: true,
|
5738
5826
|
showBreadcrumbs: true,
|
5739
5827
|
title: selectedItem ? selectedComponentLabel : "Page",
|
5740
|
-
children: /* @__PURE__ */
|
5828
|
+
children: /* @__PURE__ */ jsx39(Fields, {})
|
5741
5829
|
}
|
5742
5830
|
) })
|
5743
5831
|
] })
|
@@ -5749,7 +5837,7 @@ function Puck({
|
|
5749
5837
|
) })
|
5750
5838
|
}
|
5751
5839
|
),
|
5752
|
-
/* @__PURE__ */
|
5840
|
+
/* @__PURE__ */ jsx39("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
5753
5841
|
] });
|
5754
5842
|
}
|
5755
5843
|
Puck.Components = Components;
|
@@ -5759,7 +5847,7 @@ Puck.Preview = Preview;
|
|
5759
5847
|
|
5760
5848
|
// components/Render/index.tsx
|
5761
5849
|
init_react_import();
|
5762
|
-
import { jsx as
|
5850
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
5763
5851
|
function Render({
|
5764
5852
|
config,
|
5765
5853
|
data
|
@@ -5772,7 +5860,7 @@ function Render({
|
|
5772
5860
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
5773
5861
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
5774
5862
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
5775
|
-
return /* @__PURE__ */
|
5863
|
+
return /* @__PURE__ */ jsx40(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ jsx40(
|
5776
5864
|
config.root.render,
|
5777
5865
|
__spreadProps(__spreadValues({}, rootProps), {
|
5778
5866
|
puck: {
|
@@ -5782,11 +5870,11 @@ function Render({
|
|
5782
5870
|
title,
|
5783
5871
|
editMode: false,
|
5784
5872
|
id: "puck-root",
|
5785
|
-
children: /* @__PURE__ */
|
5873
|
+
children: /* @__PURE__ */ jsx40(DropZone, { zone: rootDroppableId })
|
5786
5874
|
})
|
5787
5875
|
) });
|
5788
5876
|
}
|
5789
|
-
return /* @__PURE__ */
|
5877
|
+
return /* @__PURE__ */ jsx40(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ jsx40(DropZone, { zone: rootDroppableId }) });
|
5790
5878
|
}
|
5791
5879
|
|
5792
5880
|
// lib/migrate.ts
|