@measured/puck 0.18.0-canary.874ba1b → 0.18.0-canary.97d25d4

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -308,10 +308,10 @@ init_react_import();
308
308
 
309
309
  // css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
310
310
  init_react_import();
311
- var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input": "_Input_1l5m8_1", "Input-label": "_Input-label_1l5m8_26", "Input-labelIcon": "_Input-labelIcon_1l5m8_35", "Input-disabledIcon": "_Input-disabledIcon_1l5m8_42", "Input-input": "_Input-input_1l5m8_47", "Input--readOnly": "_Input--readOnly_1l5m8_91", "Input-radioGroupItems": "_Input-radioGroupItems_1l5m8_102", "Input-radio": "_Input-radio_1l5m8_102", "Input-radioInner": "_Input-radioInner_1l5m8_119", "Input-radioInput": "_Input-radioInput_1l5m8_164" };
311
+ var styles_module_default2 = { "InputWrapper": "_InputWrapper_1h1p1_1", "Input-label": "_Input-label_1h1p1_5", "Input-labelIcon": "_Input-labelIcon_1h1p1_14", "Input-disabledIcon": "_Input-disabledIcon_1h1p1_21", "Input-input": "_Input-input_1h1p1_26", "Input": "_Input_1h1p1_1", "Input--readOnly": "_Input--readOnly_1h1p1_70", "Input-radioGroupItems": "_Input-radioGroupItems_1h1p1_81", "Input-radio": "_Input-radio_1h1p1_81", "Input-radioInner": "_Input-radioInner_1h1p1_98", "Input-radioInput": "_Input-radioInput_1h1p1_143" };
312
312
 
313
313
  // components/AutoField/index.tsx
314
- var import_react19 = require("react");
314
+ var import_react20 = require("react");
315
315
 
316
316
  // components/AutoField/fields/index.tsx
317
317
  init_react_import();
@@ -771,7 +771,7 @@ var IconButton = ({
771
771
  };
772
772
 
773
773
  // components/AutoField/fields/ArrayField/index.tsx
774
- var import_react11 = require("react");
774
+ var import_react12 = require("react");
775
775
 
776
776
  // components/DragIcon/index.tsx
777
777
  init_react_import();
@@ -988,13 +988,11 @@ var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __asy
988
988
  onResolveStart(item);
989
989
  }
990
990
  const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
991
- const { readOnly: existingReadOnly = {} } = item || {};
992
- const newReadOnly = __spreadValues(__spreadValues({}, existingReadOnly), readOnly);
993
991
  const resolvedItem = __spreadProps(__spreadValues({}, item), {
994
992
  props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
995
993
  });
996
- if (Object.keys(newReadOnly).length) {
997
- resolvedItem.readOnly = newReadOnly;
994
+ if (Object.keys(readOnly).length) {
995
+ resolvedItem.readOnly = readOnly;
998
996
  }
999
997
  cache.lastChange[item.props.id] = {
1000
998
  item,
@@ -1361,8 +1359,53 @@ var Sortable = ({
1361
1359
  return children({ status, ref: sortableRef });
1362
1360
  };
1363
1361
 
1364
- // components/AutoField/fields/ArrayField/index.tsx
1362
+ // components/AutoField/context.tsx
1363
+ init_react_import();
1364
+ var import_react11 = require("react");
1365
1365
  var import_jsx_runtime7 = require("react/jsx-runtime");
1366
+ var NestedFieldContext = (0, import_react11.createContext)({});
1367
+ var useNestedFieldContext = () => {
1368
+ const context = (0, import_react11.useContext)(NestedFieldContext);
1369
+ return __spreadProps(__spreadValues({}, context), {
1370
+ readOnlyFields: context.readOnlyFields || {}
1371
+ });
1372
+ };
1373
+ var NestedFieldProvider = ({
1374
+ children,
1375
+ name,
1376
+ subName,
1377
+ wildcardName = name,
1378
+ readOnlyFields
1379
+ }) => {
1380
+ const subPath = `${name}.${subName}`;
1381
+ const wildcardSubPath = `${wildcardName}.${subName}`;
1382
+ const subReadOnlyFields = (0, import_react11.useMemo)(
1383
+ () => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
1384
+ const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
1385
+ if (isLocal) {
1386
+ const subPathPattern = new RegExp(
1387
+ `^(${name}|${wildcardName}).`.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\./g, "\\.").replace(/\*/g, "\\*")
1388
+ );
1389
+ const localName = readOnlyKey.replace(subPathPattern, "");
1390
+ return __spreadProps(__spreadValues({}, acc), {
1391
+ [localName]: readOnlyFields[readOnlyKey]
1392
+ });
1393
+ }
1394
+ return acc;
1395
+ }, {}),
1396
+ [name, subName, wildcardName, readOnlyFields]
1397
+ );
1398
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1399
+ NestedFieldContext.Provider,
1400
+ {
1401
+ value: { readOnlyFields: subReadOnlyFields, localName: subName },
1402
+ children
1403
+ }
1404
+ );
1405
+ };
1406
+
1407
+ // components/AutoField/fields/ArrayField/index.tsx
1408
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1366
1409
  var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
1367
1410
  var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
1368
1411
  var ArrayField = ({
@@ -1373,10 +1416,10 @@ var ArrayField = ({
1373
1416
  label,
1374
1417
  readOnly,
1375
1418
  id,
1376
- Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", __spreadValues({}, props))
1419
+ Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", __spreadValues({}, props))
1377
1420
  }) => {
1378
1421
  const { state, setUi, selectedItem, getPermissions } = useAppContext();
1379
- const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
1422
+ const { readOnlyFields, localName = name } = useNestedFieldContext();
1380
1423
  const value = _value;
1381
1424
  const arrayState = state.ui.arrayState[id] || {
1382
1425
  items: Array.from(value || []).map((item, idx) => {
@@ -1387,11 +1430,11 @@ var ArrayField = ({
1387
1430
  }),
1388
1431
  openId: ""
1389
1432
  };
1390
- const [localState, setLocalState] = (0, import_react11.useState)({ arrayState, value });
1391
- (0, import_react11.useEffect)(() => {
1433
+ const [localState, setLocalState] = (0, import_react12.useState)({ arrayState, value });
1434
+ (0, import_react12.useEffect)(() => {
1392
1435
  setLocalState({ arrayState, value });
1393
1436
  }, [value, state.ui.arrayState[id]]);
1394
- const mapArrayStateToUi = (0, import_react11.useCallback)(
1437
+ const mapArrayStateToUi = (0, import_react12.useCallback)(
1395
1438
  (partialArrayState) => {
1396
1439
  return {
1397
1440
  arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
@@ -1401,13 +1444,13 @@ var ArrayField = ({
1401
1444
  },
1402
1445
  [arrayState]
1403
1446
  );
1404
- const getHighestIndex = (0, import_react11.useCallback)(() => {
1447
+ const getHighestIndex = (0, import_react12.useCallback)(() => {
1405
1448
  return arrayState.items.reduce(
1406
1449
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
1407
1450
  -1
1408
1451
  );
1409
1452
  }, [arrayState]);
1410
- const regenerateArrayState = (0, import_react11.useCallback)(
1453
+ const regenerateArrayState = (0, import_react12.useCallback)(
1411
1454
  (value2) => {
1412
1455
  let highestIndex = getHighestIndex();
1413
1456
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -1426,7 +1469,7 @@ var ArrayField = ({
1426
1469
  },
1427
1470
  [arrayState]
1428
1471
  );
1429
- (0, import_react11.useEffect)(() => {
1472
+ (0, import_react12.useEffect)(() => {
1430
1473
  if (arrayState.items.length > 0) {
1431
1474
  setUi(mapArrayStateToUi(arrayState));
1432
1475
  }
@@ -1436,14 +1479,14 @@ var ArrayField = ({
1436
1479
  return null;
1437
1480
  }
1438
1481
  const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
1439
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1482
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1440
1483
  Label2,
1441
1484
  {
1442
1485
  label: label || name,
1443
- icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(List, { size: 16 }),
1486
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(List, { size: 16 }),
1444
1487
  el: "div",
1445
1488
  readOnly,
1446
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1489
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1447
1490
  SortableProvider,
1448
1491
  {
1449
1492
  onMove: (move) => {
@@ -1465,7 +1508,7 @@ var ArrayField = ({
1465
1508
  arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
1466
1509
  });
1467
1510
  },
1468
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1511
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1469
1512
  "div",
1470
1513
  {
1471
1514
  className: getClassName5({
@@ -1479,13 +1522,13 @@ var ArrayField = ({
1479
1522
  localState.arrayState.items.map((item, i) => {
1480
1523
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
1481
1524
  const data = Array.from(localState.value || [])[i] || {};
1482
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1525
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1483
1526
  Sortable,
1484
1527
  {
1485
1528
  id: _arrayId,
1486
1529
  index: i,
1487
1530
  disabled: readOnly,
1488
- children: ({ status, ref }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1531
+ children: ({ status, ref }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1489
1532
  "div",
1490
1533
  {
1491
1534
  ref,
@@ -1495,7 +1538,7 @@ var ArrayField = ({
1495
1538
  readOnly
1496
1539
  }),
1497
1540
  children: [
1498
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1541
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1499
1542
  "div",
1500
1543
  {
1501
1544
  onClick: (e) => {
@@ -1518,9 +1561,9 @@ var ArrayField = ({
1518
1561
  className: getClassNameItem("summary"),
1519
1562
  children: [
1520
1563
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
1521
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("rhs"), children: [
1522
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("actions"), children: [
1523
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1564
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("rhs"), children: [
1565
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("actions"), children: [
1566
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1524
1567
  IconButton,
1525
1568
  {
1526
1569
  type: "button",
@@ -1537,10 +1580,10 @@ var ArrayField = ({
1537
1580
  );
1538
1581
  },
1539
1582
  title: "Duplicate",
1540
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 })
1583
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Copy, { size: 16 })
1541
1584
  }
1542
1585
  ) }),
1543
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1586
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1544
1587
  IconButton,
1545
1588
  {
1546
1589
  type: "button",
@@ -1561,43 +1604,56 @@ var ArrayField = ({
1561
1604
  );
1562
1605
  },
1563
1606
  title: "Delete",
1564
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 })
1607
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Trash, { size: 16 })
1565
1608
  }
1566
1609
  ) })
1567
1610
  ] }),
1568
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DragIcon, {}) })
1611
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DragIcon, {}) })
1569
1612
  ] })
1570
1613
  ]
1571
1614
  }
1572
1615
  ),
1573
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((fieldName) => {
1574
- const subField = field.arrayFields[fieldName];
1575
- const subFieldName = `${name}[${i}].${fieldName}`;
1576
- const wildcardFieldName = `${name}[*].${fieldName}`;
1577
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
1578
- const label2 = subField.label || fieldName;
1579
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1580
- AutoFieldPrivate,
1616
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
1617
+ const subField = field.arrayFields[subName];
1618
+ const indexName = `${name}[${i}]`;
1619
+ const subPath = `${indexName}.${subName}`;
1620
+ const localIndexName = `${localName}[${i}]`;
1621
+ const localWildcardName = `${localName}[*]`;
1622
+ const localSubPath = `${localIndexName}.${subName}`;
1623
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
1624
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
1625
+ const label2 = subField.label || subName;
1626
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1627
+ NestedFieldProvider,
1581
1628
  {
1582
- name: subFieldName,
1583
- label: label2,
1584
- id: `${_arrayId}_${fieldName}`,
1585
- readOnly: subReadOnly,
1586
- field: __spreadProps(__spreadValues({}, subField), {
1587
- label: label2
1588
- // May be used by custom fields
1589
- }),
1590
- value: data[fieldName],
1591
- onChange: (val, ui) => {
1592
- onChange(
1593
- replace(value, i, __spreadProps(__spreadValues({}, data), {
1594
- [fieldName]: val
1595
- })),
1596
- ui
1597
- );
1598
- }
1629
+ name: localIndexName,
1630
+ wildcardName: localWildcardName,
1631
+ subName,
1632
+ readOnlyFields,
1633
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1634
+ AutoFieldPrivate,
1635
+ {
1636
+ name: subPath,
1637
+ label: label2,
1638
+ id: `${_arrayId}_${subName}`,
1639
+ readOnly: subReadOnly,
1640
+ field: __spreadProps(__spreadValues({}, subField), {
1641
+ label: label2
1642
+ // May be used by custom fields
1643
+ }),
1644
+ value: data[subName],
1645
+ onChange: (val, ui) => {
1646
+ onChange(
1647
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
1648
+ [subName]: val
1649
+ })),
1650
+ ui
1651
+ );
1652
+ }
1653
+ }
1654
+ )
1599
1655
  },
1600
- subFieldName
1656
+ subPath
1601
1657
  );
1602
1658
  }) }) })
1603
1659
  ]
@@ -1607,7 +1663,7 @@ var ArrayField = ({
1607
1663
  _arrayId
1608
1664
  );
1609
1665
  }),
1610
- !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1666
+ !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1611
1667
  "button",
1612
1668
  {
1613
1669
  type: "button",
@@ -1621,7 +1677,7 @@ var ArrayField = ({
1621
1677
  const newArrayState = regenerateArrayState(newValue);
1622
1678
  onChange(newValue, mapArrayStateToUi(newArrayState));
1623
1679
  },
1624
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Plus, { size: 21 })
1680
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Plus, { size: 21 })
1625
1681
  }
1626
1682
  )
1627
1683
  ]
@@ -1635,28 +1691,29 @@ var ArrayField = ({
1635
1691
 
1636
1692
  // components/AutoField/fields/DefaultField/index.tsx
1637
1693
  init_react_import();
1638
- var import_jsx_runtime8 = require("react/jsx-runtime");
1694
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1639
1695
  var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
1640
1696
  var DefaultField = ({
1641
1697
  field,
1642
1698
  onChange,
1643
1699
  readOnly,
1644
- value,
1700
+ value: _value,
1645
1701
  name,
1646
1702
  label,
1647
1703
  Label: Label2,
1648
1704
  id
1649
1705
  }) => {
1650
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1706
+ const value = _value;
1707
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1651
1708
  Label2,
1652
1709
  {
1653
1710
  label: label || name,
1654
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1655
- field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Type, { size: 16 }),
1656
- field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Hash, { size: 16 })
1711
+ icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1712
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Type, { size: 16 }),
1713
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Hash, { size: 16 })
1657
1714
  ] }),
1658
1715
  readOnly,
1659
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1716
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1660
1717
  "input",
1661
1718
  {
1662
1719
  className: getClassName6("input"),
@@ -1664,10 +1721,17 @@ var DefaultField = ({
1664
1721
  type: field.type,
1665
1722
  title: label || name,
1666
1723
  name,
1667
- value: typeof value === "undefined" ? "" : value.toString(),
1724
+ value: (value == null ? void 0 : value.toString) ? value.toString() : "",
1668
1725
  onChange: (e) => {
1669
1726
  if (field.type === "number") {
1670
- onChange(Number(e.currentTarget.value));
1727
+ const numberValue = Number(e.currentTarget.value);
1728
+ if (typeof field.min !== "undefined" && numberValue < field.min) {
1729
+ return;
1730
+ }
1731
+ if (typeof field.max !== "undefined" && numberValue > field.max) {
1732
+ return;
1733
+ }
1734
+ onChange(numberValue);
1671
1735
  } else {
1672
1736
  onChange(e.currentTarget.value);
1673
1737
  }
@@ -1685,11 +1749,11 @@ var DefaultField = ({
1685
1749
 
1686
1750
  // components/AutoField/fields/ExternalField/index.tsx
1687
1751
  init_react_import();
1688
- var import_react15 = require("react");
1752
+ var import_react16 = require("react");
1689
1753
 
1690
1754
  // components/ExternalInput/index.tsx
1691
1755
  init_react_import();
1692
- var import_react14 = require("react");
1756
+ var import_react15 = require("react");
1693
1757
 
1694
1758
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
1695
1759
  init_react_import();
@@ -1697,7 +1761,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
1697
1761
 
1698
1762
  // components/Modal/index.tsx
1699
1763
  init_react_import();
1700
- var import_react12 = require("react");
1764
+ var import_react13 = require("react");
1701
1765
 
1702
1766
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
1703
1767
  init_react_import();
@@ -1705,22 +1769,22 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
1705
1769
 
1706
1770
  // components/Modal/index.tsx
1707
1771
  var import_react_dom = require("react-dom");
1708
- var import_jsx_runtime9 = require("react/jsx-runtime");
1772
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1709
1773
  var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
1710
1774
  var Modal = ({
1711
1775
  children,
1712
1776
  onClose,
1713
1777
  isOpen
1714
1778
  }) => {
1715
- const [rootEl, setRootEl] = (0, import_react12.useState)(null);
1716
- (0, import_react12.useEffect)(() => {
1779
+ const [rootEl, setRootEl] = (0, import_react13.useState)(null);
1780
+ (0, import_react13.useEffect)(() => {
1717
1781
  setRootEl(document.getElementById("puck-portal-root"));
1718
1782
  }, []);
1719
1783
  if (!rootEl) {
1720
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", {});
1784
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {});
1721
1785
  }
1722
1786
  return (0, import_react_dom.createPortal)(
1723
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1787
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1724
1788
  "div",
1725
1789
  {
1726
1790
  className: getClassName7("inner"),
@@ -1740,11 +1804,11 @@ init_react_import();
1740
1804
  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" };
1741
1805
 
1742
1806
  // components/Heading/index.tsx
1743
- var import_jsx_runtime10 = require("react/jsx-runtime");
1807
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1744
1808
  var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
1745
1809
  var Heading = ({ children, rank, size = "m" }) => {
1746
1810
  const Tag = rank ? `h${rank}` : "span";
1747
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1811
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1748
1812
  Tag,
1749
1813
  {
1750
1814
  className: getClassName8({
@@ -1760,7 +1824,7 @@ init_react_import();
1760
1824
 
1761
1825
  // components/Button/Button.tsx
1762
1826
  init_react_import();
1763
- var import_react13 = require("react");
1827
+ var import_react14 = require("react");
1764
1828
 
1765
1829
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
1766
1830
  init_react_import();
@@ -1780,7 +1844,7 @@ var filterDataAttrs = (props) => {
1780
1844
  };
1781
1845
 
1782
1846
  // components/Button/Button.tsx
1783
- var import_jsx_runtime11 = require("react/jsx-runtime");
1847
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1784
1848
  var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
1785
1849
  var Button = (_a) => {
1786
1850
  var _b = _a, {
@@ -1810,11 +1874,11 @@ var Button = (_a) => {
1810
1874
  "size",
1811
1875
  "loading"
1812
1876
  ]);
1813
- const [loading, setLoading] = (0, import_react13.useState)(loadingProp);
1814
- (0, import_react13.useEffect)(() => setLoading(loadingProp), [loadingProp]);
1877
+ const [loading, setLoading] = (0, import_react14.useState)(loadingProp);
1878
+ (0, import_react14.useEffect)(() => setLoading(loadingProp), [loadingProp]);
1815
1879
  const ElementType = href ? "a" : type ? "button" : "span";
1816
1880
  const dataAttrs = filterDataAttrs(props);
1817
- const el = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1881
+ const el = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1818
1882
  ElementType,
1819
1883
  __spreadProps(__spreadValues({
1820
1884
  className: getClassName9({
@@ -1839,9 +1903,9 @@ var Button = (_a) => {
1839
1903
  href
1840
1904
  }, dataAttrs), {
1841
1905
  children: [
1842
- icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("icon"), children: icon }),
1906
+ icon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("icon"), children: icon }),
1843
1907
  children,
1844
- loading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Loader, { size: 14 }) })
1908
+ loading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loader, { size: 14 }) })
1845
1909
  ]
1846
1910
  })
1847
1911
  );
@@ -1849,7 +1913,7 @@ var Button = (_a) => {
1849
1913
  };
1850
1914
 
1851
1915
  // components/ExternalInput/index.tsx
1852
- var import_jsx_runtime12 = require("react/jsx-runtime");
1916
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1853
1917
  var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
1854
1918
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
1855
1919
  var dataCache = {};
@@ -1866,28 +1930,28 @@ var ExternalInput = ({
1866
1930
  mapRow = (val) => val,
1867
1931
  filterFields
1868
1932
  } = field || {};
1869
- const [data, setData] = (0, import_react14.useState)([]);
1870
- const [isOpen, setOpen] = (0, import_react14.useState)(false);
1871
- const [isLoading, setIsLoading] = (0, import_react14.useState)(true);
1933
+ const [data, setData] = (0, import_react15.useState)([]);
1934
+ const [isOpen, setOpen] = (0, import_react15.useState)(false);
1935
+ const [isLoading, setIsLoading] = (0, import_react15.useState)(true);
1872
1936
  const hasFilterFields = !!filterFields;
1873
- const [filters, setFilters] = (0, import_react14.useState)(field.initialFilters || {});
1874
- const [filtersToggled, setFiltersToggled] = (0, import_react14.useState)(hasFilterFields);
1875
- const mappedData = (0, import_react14.useMemo)(() => {
1937
+ const [filters, setFilters] = (0, import_react15.useState)(field.initialFilters || {});
1938
+ const [filtersToggled, setFiltersToggled] = (0, import_react15.useState)(hasFilterFields);
1939
+ const mappedData = (0, import_react15.useMemo)(() => {
1876
1940
  return data.map(mapRow);
1877
1941
  }, [data]);
1878
- const keys = (0, import_react14.useMemo)(() => {
1942
+ const keys = (0, import_react15.useMemo)(() => {
1879
1943
  const validKeys = /* @__PURE__ */ new Set();
1880
1944
  for (const item of mappedData) {
1881
1945
  for (const key of Object.keys(item)) {
1882
- if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react14.isValidElement)(item[key])) {
1946
+ if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react15.isValidElement)(item[key])) {
1883
1947
  validKeys.add(key);
1884
1948
  }
1885
1949
  }
1886
1950
  }
1887
1951
  return Array.from(validKeys);
1888
1952
  }, [mappedData]);
1889
- const [searchQuery, setSearchQuery] = (0, import_react14.useState)(field.initialQuery || "");
1890
- const search = (0, import_react14.useCallback)(
1953
+ const [searchQuery, setSearchQuery] = (0, import_react15.useState)(field.initialQuery || "");
1954
+ const search = (0, import_react15.useCallback)(
1891
1955
  (query, filters2) => __async(void 0, null, function* () {
1892
1956
  setIsLoading(true);
1893
1957
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
@@ -1900,18 +1964,18 @@ var ExternalInput = ({
1900
1964
  }),
1901
1965
  [id, field]
1902
1966
  );
1903
- const Footer = (0, import_react14.useCallback)(
1904
- (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: getClassNameModal("footer"), children: [
1967
+ const Footer = (0, import_react15.useCallback)(
1968
+ (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: getClassNameModal("footer"), children: [
1905
1969
  props.items.length,
1906
1970
  " result",
1907
1971
  props.items.length === 1 ? "" : "s"
1908
1972
  ] }),
1909
1973
  [field.renderFooter]
1910
1974
  );
1911
- (0, import_react14.useEffect)(() => {
1975
+ (0, import_react15.useEffect)(() => {
1912
1976
  search(searchQuery, filters);
1913
1977
  }, []);
1914
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1978
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1915
1979
  "div",
1916
1980
  {
1917
1981
  className: getClassName10({
@@ -1921,21 +1985,21 @@ var ExternalInput = ({
1921
1985
  }),
1922
1986
  id,
1923
1987
  children: [
1924
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName10("actions"), children: [
1925
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1988
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName10("actions"), children: [
1989
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1926
1990
  "button",
1927
1991
  {
1928
1992
  type: "button",
1929
1993
  onClick: () => setOpen(true),
1930
1994
  className: getClassName10("button"),
1931
1995
  disabled: readOnly,
1932
- children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1933
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Link, { size: "16" }),
1934
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: field.placeholder })
1996
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1997
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: "16" }),
1998
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: field.placeholder })
1935
1999
  ] })
1936
2000
  }
1937
2001
  ),
1938
- value && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2002
+ value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1939
2003
  "button",
1940
2004
  {
1941
2005
  type: "button",
@@ -1944,11 +2008,11 @@ var ExternalInput = ({
1944
2008
  onChange(null);
1945
2009
  },
1946
2010
  disabled: readOnly,
1947
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LockOpen, { size: 16 })
2011
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LockOpen, { size: 16 })
1948
2012
  }
1949
2013
  )
1950
2014
  ] }),
1951
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2015
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1952
2016
  "form",
1953
2017
  {
1954
2018
  className: getClassNameModal({
@@ -1962,11 +2026,11 @@ var ExternalInput = ({
1962
2026
  search(searchQuery, filters);
1963
2027
  },
1964
2028
  children: [
1965
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
1966
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: getClassNameModal("search"), children: [
1967
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
1968
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Search, { size: "18" }) }),
1969
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2029
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
2030
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: getClassNameModal("search"), children: [
2031
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
2032
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Search, { size: "18" }) }),
2033
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1970
2034
  "input",
1971
2035
  {
1972
2036
  className: getClassNameModal("searchInput"),
@@ -1981,9 +2045,9 @@ var ExternalInput = ({
1981
2045
  }
1982
2046
  )
1983
2047
  ] }),
1984
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
1985
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
1986
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2048
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
2049
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
2050
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1987
2051
  IconButton,
1988
2052
  {
1989
2053
  title: "Toggle filters",
@@ -1992,15 +2056,15 @@ var ExternalInput = ({
1992
2056
  e.stopPropagation();
1993
2057
  setFiltersToggled(!filtersToggled);
1994
2058
  },
1995
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlidersHorizontal, { size: 20 })
2059
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SlidersHorizontal, { size: 20 })
1996
2060
  }
1997
2061
  ) })
1998
2062
  ] })
1999
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
2000
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("grid"), children: [
2001
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
2063
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
2064
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("grid"), children: [
2065
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
2002
2066
  const filterField = filterFields[fieldName];
2003
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2067
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2004
2068
  AutoFieldPrivate,
2005
2069
  {
2006
2070
  field: filterField,
@@ -2017,9 +2081,9 @@ var ExternalInput = ({
2017
2081
  fieldName
2018
2082
  );
2019
2083
  }) }),
2020
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
2021
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: getClassNameModal("table"), children: [
2022
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2084
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
2085
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: getClassNameModal("table"), children: [
2086
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2023
2087
  "th",
2024
2088
  {
2025
2089
  className: getClassNameModal("th"),
@@ -2028,8 +2092,8 @@ var ExternalInput = ({
2028
2092
  },
2029
2093
  key
2030
2094
  )) }) }),
2031
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
2032
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2095
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
2096
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2033
2097
  "tr",
2034
2098
  {
2035
2099
  style: { whiteSpace: "nowrap" },
@@ -2038,16 +2102,16 @@ var ExternalInput = ({
2038
2102
  onChange(mapProp(data[i]));
2039
2103
  setOpen(false);
2040
2104
  },
2041
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
2105
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
2042
2106
  },
2043
2107
  i
2044
2108
  );
2045
2109
  }) })
2046
2110
  ] }),
2047
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loader, { size: 24 }) })
2111
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader, { size: 24 }) })
2048
2112
  ] })
2049
2113
  ] }),
2050
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Footer, { items: mappedData }) })
2114
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Footer, { items: mappedData }) })
2051
2115
  ]
2052
2116
  }
2053
2117
  ) })
@@ -2057,7 +2121,7 @@ var ExternalInput = ({
2057
2121
  };
2058
2122
 
2059
2123
  // components/AutoField/fields/ExternalField/index.tsx
2060
- var import_jsx_runtime13 = require("react/jsx-runtime");
2124
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2061
2125
  var ExternalField = ({
2062
2126
  field,
2063
2127
  onChange,
@@ -2071,7 +2135,7 @@ var ExternalField = ({
2071
2135
  var _a, _b, _c;
2072
2136
  const validField = field;
2073
2137
  const deprecatedField = field;
2074
- (0, import_react15.useEffect)(() => {
2138
+ (0, import_react16.useEffect)(() => {
2075
2139
  if (deprecatedField.adaptor) {
2076
2140
  console.error(
2077
2141
  "Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
@@ -2081,7 +2145,7 @@ var ExternalField = ({
2081
2145
  if (field.type !== "external") {
2082
2146
  return null;
2083
2147
  }
2084
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2148
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2085
2149
  ExternalInput,
2086
2150
  {
2087
2151
  name,
@@ -2106,7 +2170,7 @@ var ExternalField = ({
2106
2170
 
2107
2171
  // components/AutoField/fields/RadioField/index.tsx
2108
2172
  init_react_import();
2109
- var import_react16 = require("react");
2173
+ var import_react17 = require("react");
2110
2174
 
2111
2175
  // lib/safe-json-parse.ts
2112
2176
  init_react_import();
@@ -2120,7 +2184,7 @@ var safeJsonParse = (str) => {
2120
2184
  };
2121
2185
 
2122
2186
  // components/AutoField/fields/RadioField/index.tsx
2123
- var import_jsx_runtime14 = require("react/jsx-runtime");
2187
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2124
2188
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
2125
2189
  var RadioField = ({
2126
2190
  field,
@@ -2132,26 +2196,26 @@ var RadioField = ({
2132
2196
  label,
2133
2197
  Label: Label2
2134
2198
  }) => {
2135
- const flatOptions = (0, import_react16.useMemo)(
2199
+ const flatOptions = (0, import_react17.useMemo)(
2136
2200
  () => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
2137
2201
  [field]
2138
2202
  );
2139
2203
  if (field.type !== "radio" || !field.options) {
2140
2204
  return null;
2141
2205
  }
2142
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2206
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2143
2207
  Label2,
2144
2208
  {
2145
- icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CircleCheckBig, { size: 16 }),
2209
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CircleCheckBig, { size: 16 }),
2146
2210
  label: label || name,
2147
2211
  readOnly,
2148
2212
  el: "div",
2149
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2213
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2150
2214
  "label",
2151
2215
  {
2152
2216
  className: getClassName11("radio"),
2153
2217
  children: [
2154
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2218
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2155
2219
  "input",
2156
2220
  {
2157
2221
  type: "radio",
@@ -2171,7 +2235,7 @@ var RadioField = ({
2171
2235
  checked: value === option.value
2172
2236
  }
2173
2237
  ),
2174
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
2238
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
2175
2239
  ]
2176
2240
  },
2177
2241
  option.label + option.value
@@ -2182,8 +2246,8 @@ var RadioField = ({
2182
2246
 
2183
2247
  // components/AutoField/fields/SelectField/index.tsx
2184
2248
  init_react_import();
2185
- var import_react17 = require("react");
2186
- var import_jsx_runtime15 = require("react/jsx-runtime");
2249
+ var import_react18 = require("react");
2250
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2187
2251
  var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
2188
2252
  var SelectField = ({
2189
2253
  field,
@@ -2195,20 +2259,20 @@ var SelectField = ({
2195
2259
  readOnly,
2196
2260
  id
2197
2261
  }) => {
2198
- const flatOptions = (0, import_react17.useMemo)(
2262
+ const flatOptions = (0, import_react18.useMemo)(
2199
2263
  () => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
2200
2264
  [field]
2201
2265
  );
2202
2266
  if (field.type !== "select" || !field.options) {
2203
2267
  return null;
2204
2268
  }
2205
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2269
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2206
2270
  Label2,
2207
2271
  {
2208
2272
  label: label || name,
2209
- icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, { size: 16 }),
2273
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDown, { size: 16 }),
2210
2274
  readOnly,
2211
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2275
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2212
2276
  "select",
2213
2277
  {
2214
2278
  id,
@@ -2225,7 +2289,7 @@ var SelectField = ({
2225
2289
  }
2226
2290
  },
2227
2291
  value,
2228
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2292
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2229
2293
  "option",
2230
2294
  {
2231
2295
  label: option.label,
@@ -2241,7 +2305,7 @@ var SelectField = ({
2241
2305
 
2242
2306
  // components/AutoField/fields/TextareaField/index.tsx
2243
2307
  init_react_import();
2244
- var import_jsx_runtime16 = require("react/jsx-runtime");
2308
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2245
2309
  var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
2246
2310
  var TextareaField = ({
2247
2311
  onChange,
@@ -2252,7 +2316,7 @@ var TextareaField = ({
2252
2316
  Label: Label2,
2253
2317
  id
2254
2318
  }) => {
2255
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2319
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2256
2320
  "textarea",
2257
2321
  {
2258
2322
  id,
@@ -2279,7 +2343,7 @@ init_react_import();
2279
2343
  var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
2280
2344
 
2281
2345
  // components/AutoField/fields/ObjectField/index.tsx
2282
- var import_jsx_runtime17 = require("react/jsx-runtime");
2346
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2283
2347
  var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
2284
2348
  var ObjectField = ({
2285
2349
  field,
@@ -2291,47 +2355,54 @@ var ObjectField = ({
2291
2355
  readOnly,
2292
2356
  id
2293
2357
  }) => {
2294
- const { selectedItem } = useAppContext();
2358
+ const { readOnlyFields, localName = name } = useNestedFieldContext();
2295
2359
  if (field.type !== "object" || !field.objectFields) {
2296
2360
  return null;
2297
2361
  }
2298
- const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
2299
2362
  const data = value || {};
2300
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2363
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2301
2364
  Label2,
2302
2365
  {
2303
2366
  label: label || name,
2304
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EllipsisVertical, { size: 16 }),
2367
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EllipsisVertical, { size: 16 }),
2305
2368
  el: "div",
2306
2369
  readOnly,
2307
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
2308
- const subField = field.objectFields[fieldName];
2309
- const subFieldName = `${name}.${fieldName}`;
2310
- const wildcardFieldName = `${name}.${fieldName}`;
2311
- const subReadOnly = readOnly ? readOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
2312
- const label2 = subField.label || fieldName;
2313
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2314
- AutoFieldPrivate,
2370
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
2371
+ const subField = field.objectFields[subName];
2372
+ const subPath = `${name}.${subName}`;
2373
+ const localSubPath = `${localName || name}.${subName}`;
2374
+ const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
2375
+ const label2 = subField.label || subName;
2376
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2377
+ NestedFieldProvider,
2315
2378
  {
2316
- name: subFieldName,
2317
- label: label2,
2318
- id: `${id}_${fieldName}`,
2319
- readOnly: subReadOnly,
2320
- field: __spreadProps(__spreadValues({}, subField), {
2321
- label: label2
2322
- // May be used by custom fields
2323
- }),
2324
- value: data[fieldName],
2325
- onChange: (val, ui) => {
2326
- onChange(
2327
- __spreadProps(__spreadValues({}, data), {
2328
- [fieldName]: val
2379
+ name: localName || id,
2380
+ subName,
2381
+ readOnlyFields,
2382
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2383
+ AutoFieldPrivate,
2384
+ {
2385
+ name: subPath,
2386
+ label: subPath,
2387
+ id: `${id}_${subName}`,
2388
+ readOnly: subReadOnly,
2389
+ field: __spreadProps(__spreadValues({}, subField), {
2390
+ label: label2
2391
+ // May be used by custom fields
2329
2392
  }),
2330
- ui
2331
- );
2332
- }
2393
+ value: data[subName],
2394
+ onChange: (val, ui) => {
2395
+ onChange(
2396
+ __spreadProps(__spreadValues({}, data), {
2397
+ [subName]: val
2398
+ }),
2399
+ ui
2400
+ );
2401
+ }
2402
+ }
2403
+ )
2333
2404
  },
2334
- subFieldName
2405
+ subPath
2335
2406
  );
2336
2407
  }) }) })
2337
2408
  }
@@ -2340,7 +2411,7 @@ var ObjectField = ({
2340
2411
 
2341
2412
  // lib/use-safe-id.ts
2342
2413
  init_react_import();
2343
- var import_react18 = __toESM(require("react"));
2414
+ var import_react19 = __toESM(require("react"));
2344
2415
 
2345
2416
  // lib/generate-id.ts
2346
2417
  init_react_import();
@@ -2349,15 +2420,15 @@ var generateId = (type) => type ? `${type}-${(0, import_uuid.v4)()}` : (0, impor
2349
2420
 
2350
2421
  // lib/use-safe-id.ts
2351
2422
  var useSafeId = () => {
2352
- if (typeof import_react18.default.useId !== "undefined") {
2353
- return import_react18.default.useId();
2423
+ if (typeof import_react19.default.useId !== "undefined") {
2424
+ return import_react19.default.useId();
2354
2425
  }
2355
- const [id] = (0, import_react18.useState)(generateId());
2426
+ const [id] = (0, import_react19.useState)(generateId());
2356
2427
  return id;
2357
2428
  };
2358
2429
 
2359
2430
  // components/AutoField/index.tsx
2360
- var import_jsx_runtime18 = require("react/jsx-runtime");
2431
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2361
2432
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
2362
2433
  var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
2363
2434
  var FieldLabel = ({
@@ -2369,16 +2440,16 @@ var FieldLabel = ({
2369
2440
  className
2370
2441
  }) => {
2371
2442
  const El = el;
2372
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(El, { className, children: [
2373
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName15("label"), children: [
2374
- icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, {}),
2443
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(El, { className, children: [
2444
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName15("label"), children: [
2445
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, {}),
2375
2446
  label,
2376
- readOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Lock, { size: "12" }) })
2447
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Lock, { size: "12" }) })
2377
2448
  ] }),
2378
2449
  children
2379
2450
  ] });
2380
2451
  };
2381
- var FieldLabelInternal2 = ({
2452
+ var FieldLabelInternal = ({
2382
2453
  children,
2383
2454
  icon,
2384
2455
  label,
@@ -2386,14 +2457,14 @@ var FieldLabelInternal2 = ({
2386
2457
  readOnly
2387
2458
  }) => {
2388
2459
  const { overrides } = useAppContext();
2389
- const Wrapper = (0, import_react19.useMemo)(
2460
+ const Wrapper = (0, import_react20.useMemo)(
2390
2461
  () => overrides.fieldLabel || FieldLabel,
2391
2462
  [overrides]
2392
2463
  );
2393
2464
  if (!label) {
2394
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children });
2465
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
2395
2466
  }
2396
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2467
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2397
2468
  Wrapper,
2398
2469
  {
2399
2470
  label,
@@ -2407,8 +2478,9 @@ var FieldLabelInternal2 = ({
2407
2478
  };
2408
2479
  function AutoFieldInternal(props) {
2409
2480
  var _a, _b, _c, _d, _e, _f, _g, _h;
2410
- const { dispatch, overrides } = useAppContext();
2411
- const { id, Label: Label2 = FieldLabelInternal2 } = props;
2481
+ const { dispatch, overrides, selectedItem } = useAppContext();
2482
+ const nestedFieldContext = (0, import_react20.useContext)(NestedFieldContext);
2483
+ const { id, Label: Label2 = FieldLabelInternal } = props;
2412
2484
  const field = props.field;
2413
2485
  const label = field.label;
2414
2486
  const defaultId = useSafeId();
@@ -2439,7 +2511,7 @@ function AutoFieldInternal(props) {
2439
2511
  Label: Label2,
2440
2512
  id: resolvedId
2441
2513
  });
2442
- const onFocus = (0, import_react19.useCallback)(
2514
+ const onFocus = (0, import_react20.useCallback)(
2443
2515
  (e) => {
2444
2516
  if (mergedProps.name && e.target.nodeName === "INPUT") {
2445
2517
  e.stopPropagation();
@@ -2453,7 +2525,7 @@ function AutoFieldInternal(props) {
2453
2525
  },
2454
2526
  [mergedProps.name]
2455
2527
  );
2456
- const onBlur = (0, import_react19.useCallback)((e) => {
2528
+ const onBlur = (0, import_react20.useCallback)((e) => {
2457
2529
  if ("name" in e.target) {
2458
2530
  dispatch({
2459
2531
  type: "setUi",
@@ -2468,27 +2540,36 @@ function AutoFieldInternal(props) {
2468
2540
  return null;
2469
2541
  }
2470
2542
  const CustomField = field.render;
2471
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CustomField, __spreadValues({}, mergedProps)) }) });
2543
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CustomField, __spreadValues({}, mergedProps)) }) });
2472
2544
  }
2473
2545
  const children = defaultFields[field.type](mergedProps);
2474
2546
  const Render2 = render[field.type];
2475
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2476
- "div",
2547
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2548
+ NestedFieldContext.Provider,
2477
2549
  {
2478
- className: getClassNameWrapper(),
2479
- onFocus,
2480
- onBlur,
2481
- onClick: (e) => {
2482
- e.stopPropagation();
2550
+ value: {
2551
+ readOnlyFields: nestedFieldContext.readOnlyFields || (selectedItem == null ? void 0 : selectedItem.readOnly) || {},
2552
+ localName: nestedFieldContext.localName
2483
2553
  },
2484
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2554
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2555
+ "div",
2556
+ {
2557
+ className: getClassNameWrapper(),
2558
+ onFocus,
2559
+ onBlur,
2560
+ onClick: (e) => {
2561
+ e.stopPropagation();
2562
+ },
2563
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2564
+ }
2565
+ )
2485
2566
  }
2486
2567
  );
2487
2568
  }
2488
2569
  function AutoFieldPrivate(props) {
2489
2570
  const { state } = useAppContext();
2490
2571
  const { value, onChange } = props;
2491
- const [localValue, setLocalValue] = (0, import_react19.useState)(value);
2572
+ const [localValue, setLocalValue] = (0, import_react20.useState)(value);
2492
2573
  const onChangeDb = (0, import_use_debounce.useDebouncedCallback)(
2493
2574
  (val, ui) => {
2494
2575
  onChange(val, ui);
@@ -2496,11 +2577,11 @@ function AutoFieldPrivate(props) {
2496
2577
  50,
2497
2578
  { leading: true }
2498
2579
  );
2499
- const onChangeLocal = (0, import_react19.useCallback)((val, ui) => {
2580
+ const onChangeLocal = (0, import_react20.useCallback)((val, ui) => {
2500
2581
  setLocalValue(val);
2501
2582
  onChangeDb(val, ui);
2502
2583
  }, []);
2503
- (0, import_react19.useEffect)(() => {
2584
+ (0, import_react20.useEffect)(() => {
2504
2585
  if (state.ui.field.focus !== props.name) {
2505
2586
  setLocalValue(value);
2506
2587
  }
@@ -2509,11 +2590,11 @@ function AutoFieldPrivate(props) {
2509
2590
  value: localValue,
2510
2591
  onChange: onChangeLocal
2511
2592
  };
2512
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2593
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2513
2594
  }
2514
2595
  function AutoField(props) {
2515
- const DefaultLabel = (0, import_react19.useMemo)(() => {
2516
- const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2596
+ const DefaultLabel = (0, import_react20.useMemo)(() => {
2597
+ const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2517
2598
  "div",
2518
2599
  __spreadProps(__spreadValues({}, labelProps), {
2519
2600
  className: getClassName15({ readOnly: props.readOnly })
@@ -2521,7 +2602,7 @@ function AutoField(props) {
2521
2602
  );
2522
2603
  return DefaultLabel2;
2523
2604
  }, [props.readOnly]);
2524
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2605
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2525
2606
  }
2526
2607
 
2527
2608
  // components/Drawer/index.tsx
@@ -2532,21 +2613,21 @@ init_react_import();
2532
2613
  var styles_module_default10 = { "Drawer": "_Drawer_fkqfo_1", "Drawer-draggable": "_Drawer-draggable_fkqfo_8", "Drawer-draggableBg": "_Drawer-draggableBg_fkqfo_12", "Drawer-draggableFg": "_Drawer-draggableFg_fkqfo_21", "DrawerItem-draggable": "_DrawerItem-draggable_fkqfo_25", "DrawerItem--disabled": "_DrawerItem--disabled_fkqfo_38", "DrawerItem": "_DrawerItem_fkqfo_25", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_fkqfo_48", "DrawerItem-name": "_DrawerItem-name_fkqfo_66" };
2533
2614
 
2534
2615
  // components/Drawer/index.tsx
2535
- var import_react31 = require("react");
2616
+ var import_react32 = require("react");
2536
2617
 
2537
2618
  // components/DragDropContext/index.tsx
2538
2619
  init_react_import();
2539
- var import_react29 = require("@dnd-kit/react");
2540
- var import_react30 = require("react");
2620
+ var import_react30 = require("@dnd-kit/react");
2621
+ var import_react31 = require("react");
2541
2622
  var import_dom = require("@dnd-kit/dom");
2542
2623
 
2543
2624
  // components/DropZone/index.tsx
2544
2625
  init_react_import();
2545
- var import_react28 = require("react");
2626
+ var import_react29 = require("react");
2546
2627
 
2547
2628
  // components/DraggableComponent/index.tsx
2548
2629
  init_react_import();
2549
- var import_react22 = require("react");
2630
+ var import_react23 = require("react");
2550
2631
 
2551
2632
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
2552
2633
  init_react_import();
@@ -2911,11 +2992,11 @@ function getDeepScrollPosition(element) {
2911
2992
 
2912
2993
  // components/DropZone/context.tsx
2913
2994
  init_react_import();
2914
- var import_react20 = require("react");
2995
+ var import_react21 = require("react");
2915
2996
  var import_zustand = require("zustand");
2916
- var import_jsx_runtime19 = require("react/jsx-runtime");
2917
- var dropZoneContext = (0, import_react20.createContext)(null);
2918
- var ZoneStoreContext = (0, import_react20.createContext)(
2997
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2998
+ var dropZoneContext = (0, import_react21.createContext)(null);
2999
+ var ZoneStoreContext = (0, import_react21.createContext)(
2919
3000
  (0, import_zustand.createStore)(() => ({
2920
3001
  zoneDepthIndex: {},
2921
3002
  nextZoneDepthIndex: {},
@@ -2929,25 +3010,25 @@ var ZoneStoreProvider = ({
2929
3010
  children,
2930
3011
  store
2931
3012
  }) => {
2932
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ZoneStoreContext.Provider, { value: store, children });
3013
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ZoneStoreContext.Provider, { value: store, children });
2933
3014
  };
2934
3015
  var DropZoneProvider = ({
2935
3016
  children,
2936
3017
  value
2937
3018
  }) => {
2938
- const [hoveringComponent, setHoveringComponent] = (0, import_react20.useState)();
2939
- const [areasWithZones, setAreasWithZones] = (0, import_react20.useState)(
3019
+ const [hoveringComponent, setHoveringComponent] = (0, import_react21.useState)();
3020
+ const [areasWithZones, setAreasWithZones] = (0, import_react21.useState)(
2940
3021
  {}
2941
3022
  );
2942
- const [activeZones, setActiveZones] = (0, import_react20.useState)({});
3023
+ const [activeZones, setActiveZones] = (0, import_react21.useState)({});
2943
3024
  const { dispatch } = useAppContext();
2944
- const registerZoneArea = (0, import_react20.useCallback)(
3025
+ const registerZoneArea = (0, import_react21.useCallback)(
2945
3026
  (area) => {
2946
3027
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
2947
3028
  },
2948
3029
  [setAreasWithZones]
2949
3030
  );
2950
- const registerZone = (0, import_react20.useCallback)(
3031
+ const registerZone = (0, import_react21.useCallback)(
2951
3032
  (zoneCompound) => {
2952
3033
  if (!dispatch) {
2953
3034
  return;
@@ -2960,7 +3041,7 @@ var DropZoneProvider = ({
2960
3041
  },
2961
3042
  [setActiveZones, dispatch]
2962
3043
  );
2963
- const unregisterZone = (0, import_react20.useCallback)(
3044
+ const unregisterZone = (0, import_react21.useCallback)(
2964
3045
  (zoneCompound) => {
2965
3046
  if (!dispatch) {
2966
3047
  return;
@@ -2975,7 +3056,7 @@ var DropZoneProvider = ({
2975
3056
  },
2976
3057
  [setActiveZones, dispatch]
2977
3058
  );
2978
- const memoValue = (0, import_react20.useMemo)(
3059
+ const memoValue = (0, import_react21.useMemo)(
2979
3060
  () => __spreadValues({
2980
3061
  hoveringComponent,
2981
3062
  setHoveringComponent,
@@ -2987,16 +3068,16 @@ var DropZoneProvider = ({
2987
3068
  }, value),
2988
3069
  [value, hoveringComponent, areasWithZones, activeZones]
2989
3070
  );
2990
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
3071
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
2991
3072
  };
2992
3073
 
2993
3074
  // lib/use-context-store.ts
2994
3075
  init_react_import();
2995
- var import_react21 = require("react");
3076
+ var import_react22 = require("react");
2996
3077
  var import_zustand2 = require("zustand");
2997
3078
  var import_shallow = require("zustand/react/shallow");
2998
3079
  function useContextStore(context, selector) {
2999
- const store = (0, import_react21.useContext)(context);
3080
+ const store = (0, import_react22.useContext)(context);
3000
3081
  if (!store) {
3001
3082
  throw new Error("useContextStore must be used inside context");
3002
3083
  }
@@ -3004,7 +3085,7 @@ function useContextStore(context, selector) {
3004
3085
  }
3005
3086
 
3006
3087
  // components/DraggableComponent/index.tsx
3007
- var import_jsx_runtime20 = require("react/jsx-runtime");
3088
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3008
3089
  var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
3009
3090
  var DEBUG2 = false;
3010
3091
  var space = 8;
@@ -3015,12 +3096,12 @@ var DefaultActionBar = ({
3015
3096
  label,
3016
3097
  children,
3017
3098
  parentAction
3018
- }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(ActionBar, { children: [
3019
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(ActionBar.Group, { children: [
3099
+ }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar, { children: [
3100
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar.Group, { children: [
3020
3101
  parentAction,
3021
- label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Label, { label })
3102
+ label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Label, { label })
3022
3103
  ] }),
3023
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Group, { children })
3104
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Group, { children })
3024
3105
  ] });
3025
3106
  var convertIdToSelector = (id, zoneCompound, data) => {
3026
3107
  const content = zoneCompound && data.zones && zoneCompound !== "default-zone" ? data.zones[zoneCompound] : data.content;
@@ -3055,9 +3136,9 @@ var DraggableComponent = ({
3055
3136
  iframe,
3056
3137
  state
3057
3138
  } = useAppContext();
3058
- const ctx = (0, import_react22.useContext)(dropZoneContext);
3059
- const [localZones, setLocalZones] = (0, import_react22.useState)({});
3060
- const registerLocalZone = (0, import_react22.useCallback)(
3139
+ const ctx = (0, import_react23.useContext)(dropZoneContext);
3140
+ const [localZones, setLocalZones] = (0, import_react23.useState)({});
3141
+ const registerLocalZone = (0, import_react23.useCallback)(
3061
3142
  (zoneCompound2, active) => {
3062
3143
  var _a;
3063
3144
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -3067,7 +3148,7 @@ var DraggableComponent = ({
3067
3148
  },
3068
3149
  [setLocalZones]
3069
3150
  );
3070
- const unregisterLocalZone = (0, import_react22.useCallback)(
3151
+ const unregisterLocalZone = (0, import_react23.useCallback)(
3071
3152
  (zoneCompound2) => {
3072
3153
  var _a;
3073
3154
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -3081,8 +3162,8 @@ var DraggableComponent = ({
3081
3162
  );
3082
3163
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
3083
3164
  const { path = [] } = ctx || {};
3084
- const [canDrag, setCanDrag] = (0, import_react22.useState)(false);
3085
- (0, import_react22.useEffect)(() => {
3165
+ const [canDrag, setCanDrag] = (0, import_react23.useState)(false);
3166
+ (0, import_react23.useEffect)(() => {
3086
3167
  var _a;
3087
3168
  const item = getItem({ index, zone: zoneCompound }, state.data);
3088
3169
  if (item) {
@@ -3098,7 +3179,7 @@ var DraggableComponent = ({
3098
3179
  );
3099
3180
  const canCollide = canDrag || userIsDragging;
3100
3181
  const disabled = !isEnabled || !canCollide;
3101
- const [dragAxis, setDragAxis] = (0, import_react22.useState)(userDragAxis || autoDragAxis);
3182
+ const [dragAxis, setDragAxis] = (0, import_react23.useState)(userDragAxis || autoDragAxis);
3102
3183
  const { ref: sortableRef, status } = useSortableSafe({
3103
3184
  id,
3104
3185
  index,
@@ -3124,8 +3205,8 @@ var DraggableComponent = ({
3124
3205
  }
3125
3206
  });
3126
3207
  const thisIsDragging = status === "dragging";
3127
- const ref = (0, import_react22.useRef)(null);
3128
- const refSetter = (0, import_react22.useCallback)(
3208
+ const ref = (0, import_react23.useRef)(null);
3209
+ const refSetter = (0, import_react23.useCallback)(
3129
3210
  (el) => {
3130
3211
  sortableRef(el);
3131
3212
  if (el) {
@@ -3134,14 +3215,14 @@ var DraggableComponent = ({
3134
3215
  },
3135
3216
  [sortableRef]
3136
3217
  );
3137
- const [portalEl, setPortalEl] = (0, import_react22.useState)();
3138
- (0, import_react22.useEffect)(() => {
3218
+ const [portalEl, setPortalEl] = (0, import_react23.useState)();
3219
+ (0, import_react23.useEffect)(() => {
3139
3220
  var _a, _b, _c;
3140
3221
  setPortalEl(
3141
3222
  iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
3142
3223
  );
3143
3224
  }, [iframe.enabled, ref.current]);
3144
- const getStyle = (0, import_react22.useCallback)(() => {
3225
+ const getStyle = (0, import_react23.useCallback)(() => {
3145
3226
  var _a, _b, _c;
3146
3227
  if (!ref.current) return;
3147
3228
  const rect = ref.current.getBoundingClientRect();
@@ -3161,11 +3242,11 @@ var DraggableComponent = ({
3161
3242
  };
3162
3243
  return style2;
3163
3244
  }, [ref.current]);
3164
- const [style, setStyle] = (0, import_react22.useState)();
3165
- const sync = (0, import_react22.useCallback)(() => {
3245
+ const [style, setStyle] = (0, import_react23.useState)();
3246
+ const sync = (0, import_react23.useCallback)(() => {
3166
3247
  setStyle(getStyle());
3167
3248
  }, [ref.current, iframe]);
3168
- (0, import_react22.useEffect)(() => {
3249
+ (0, import_react23.useEffect)(() => {
3169
3250
  if (ref.current) {
3170
3251
  const observer = new ResizeObserver(sync);
3171
3252
  observer.observe(ref.current);
@@ -3174,7 +3255,7 @@ var DraggableComponent = ({
3174
3255
  };
3175
3256
  }
3176
3257
  }, [ref.current]);
3177
- (0, import_react22.useEffect)(() => {
3258
+ (0, import_react23.useEffect)(() => {
3178
3259
  if (isSelected) {
3179
3260
  ctx == null ? void 0 : ctx.registerPath({
3180
3261
  index,
@@ -3182,14 +3263,14 @@ var DraggableComponent = ({
3182
3263
  });
3183
3264
  }
3184
3265
  }, [isSelected]);
3185
- const CustomActionBar = (0, import_react22.useMemo)(
3266
+ const CustomActionBar = (0, import_react23.useMemo)(
3186
3267
  () => overrides.actionBar || DefaultActionBar,
3187
3268
  [overrides.actionBar]
3188
3269
  );
3189
3270
  const permissions = getPermissions({
3190
3271
  item: selectedItem
3191
3272
  });
3192
- const onClick = (0, import_react22.useCallback)(
3273
+ const onClick = (0, import_react23.useCallback)(
3193
3274
  (e) => {
3194
3275
  e.stopPropagation();
3195
3276
  dispatch({
@@ -3201,7 +3282,7 @@ var DraggableComponent = ({
3201
3282
  },
3202
3283
  [index, zoneCompound, id]
3203
3284
  );
3204
- const onSelectParent = (0, import_react22.useCallback)(() => {
3285
+ const onSelectParent = (0, import_react23.useCallback)(() => {
3205
3286
  if (!(ctx == null ? void 0 : ctx.areaId)) {
3206
3287
  return;
3207
3288
  }
@@ -3219,23 +3300,23 @@ var DraggableComponent = ({
3219
3300
  }
3220
3301
  });
3221
3302
  }, [ctx, path]);
3222
- const onDuplicate = (0, import_react22.useCallback)(() => {
3303
+ const onDuplicate = (0, import_react23.useCallback)(() => {
3223
3304
  dispatch({
3224
3305
  type: "duplicate",
3225
3306
  sourceIndex: index,
3226
3307
  sourceZone: zoneCompound
3227
3308
  });
3228
3309
  }, [index, zoneCompound]);
3229
- const onDelete = (0, import_react22.useCallback)(() => {
3310
+ const onDelete = (0, import_react23.useCallback)(() => {
3230
3311
  dispatch({
3231
3312
  type: "remove",
3232
3313
  index,
3233
3314
  zone: zoneCompound
3234
3315
  });
3235
3316
  }, [index, zoneCompound]);
3236
- const [hover, setHover] = (0, import_react22.useState)(false);
3317
+ const [hover, setHover] = (0, import_react23.useState)(false);
3237
3318
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
3238
- (0, import_react22.useEffect)(() => {
3319
+ (0, import_react23.useEffect)(() => {
3239
3320
  if (!ref.current) {
3240
3321
  return;
3241
3322
  }
@@ -3285,7 +3366,7 @@ var DraggableComponent = ({
3285
3366
  thisIsDragging,
3286
3367
  inDroppableZone
3287
3368
  ]);
3288
- (0, import_react22.useEffect)(() => {
3369
+ (0, import_react23.useEffect)(() => {
3289
3370
  if (ref.current && disabled) {
3290
3371
  ref.current.setAttribute("data-puck-disabled", "");
3291
3372
  return () => {
@@ -3294,8 +3375,8 @@ var DraggableComponent = ({
3294
3375
  };
3295
3376
  }
3296
3377
  }, [disabled, ref]);
3297
- const [isVisible, setIsVisible] = (0, import_react22.useState)(false);
3298
- (0, import_react22.useEffect)(() => {
3378
+ const [isVisible, setIsVisible] = (0, import_react23.useState)(false);
3379
+ (0, import_react23.useEffect)(() => {
3299
3380
  sync();
3300
3381
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
3301
3382
  setIsVisible(true);
@@ -3303,7 +3384,7 @@ var DraggableComponent = ({
3303
3384
  setIsVisible(false);
3304
3385
  }
3305
3386
  }, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
3306
- const syncActionsPosition = (0, import_react22.useCallback)(
3387
+ const syncActionsPosition = (0, import_react23.useCallback)(
3307
3388
  (el) => {
3308
3389
  if (el) {
3309
3390
  const view = el.ownerDocument.defaultView;
@@ -3320,7 +3401,7 @@ var DraggableComponent = ({
3320
3401
  },
3321
3402
  [zoomConfig]
3322
3403
  );
3323
- (0, import_react22.useEffect)(() => {
3404
+ (0, import_react23.useEffect)(() => {
3324
3405
  if (userDragAxis) {
3325
3406
  setDragAxis(userDragAxis);
3326
3407
  return;
@@ -3334,8 +3415,8 @@ var DraggableComponent = ({
3334
3415
  }
3335
3416
  setDragAxis(autoDragAxis);
3336
3417
  }, [ref, userDragAxis, autoDragAxis]);
3337
- const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CornerLeftUp, { size: 16 }) });
3338
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3418
+ const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CornerLeftUp, { size: 16 }) });
3419
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3339
3420
  DropZoneProvider,
3340
3421
  {
3341
3422
  value: __spreadProps(__spreadValues({}, ctx), {
@@ -3349,7 +3430,7 @@ var DraggableComponent = ({
3349
3430
  }),
3350
3431
  children: [
3351
3432
  isVisible && (0, import_react_dom2.createPortal)(
3352
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3433
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3353
3434
  "div",
3354
3435
  {
3355
3436
  className: getClassName16({
@@ -3361,15 +3442,15 @@ var DraggableComponent = ({
3361
3442
  "data-puck-overlay": true,
3362
3443
  children: [
3363
3444
  debug,
3364
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Loader, {}) }),
3365
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3445
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader, {}) }),
3446
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3366
3447
  "div",
3367
3448
  {
3368
3449
  className: getClassName16("actionsOverlay"),
3369
3450
  style: {
3370
3451
  top: actionsOverlayTop / zoomConfig.zoom
3371
3452
  },
3372
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3453
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3373
3454
  "div",
3374
3455
  {
3375
3456
  className: getClassName16("actions"),
@@ -3381,14 +3462,14 @@ var DraggableComponent = ({
3381
3462
  paddingRight: actionsSide
3382
3463
  },
3383
3464
  ref: syncActionsPosition,
3384
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3465
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3385
3466
  CustomActionBar,
3386
3467
  {
3387
3468
  parentAction,
3388
3469
  label: DEBUG2 ? id : label,
3389
3470
  children: [
3390
- permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Copy, { size: 16 }) }),
3391
- permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Trash, { size: 16 }) })
3471
+ permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Copy, { size: 16 }) }),
3472
+ permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Trash, { size: 16 }) })
3392
3473
  ]
3393
3474
  }
3394
3475
  )
@@ -3396,7 +3477,7 @@ var DraggableComponent = ({
3396
3477
  )
3397
3478
  }
3398
3479
  ),
3399
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName16("overlay") })
3480
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName16("overlay") })
3400
3481
  ]
3401
3482
  }
3402
3483
  ),
@@ -3414,14 +3495,14 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
3414
3495
 
3415
3496
  // components/DropZone/lib/use-min-empty-height.ts
3416
3497
  init_react_import();
3417
- var import_react23 = require("react");
3498
+ var import_react24 = require("react");
3418
3499
  var useMinEmptyHeight = ({
3419
3500
  zoneCompound,
3420
3501
  userMinEmptyHeight,
3421
3502
  ref
3422
3503
  }) => {
3423
- const [prevHeight, setPrevHeight] = (0, import_react23.useState)(0);
3424
- const [isAnimating, setIsAnimating] = (0, import_react23.useState)(false);
3504
+ const [prevHeight, setPrevHeight] = (0, import_react24.useState)(0);
3505
+ const [isAnimating, setIsAnimating] = (0, import_react24.useState)(false);
3425
3506
  const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
3426
3507
  var _a, _b;
3427
3508
  return {
@@ -3429,7 +3510,7 @@ var useMinEmptyHeight = ({
3429
3510
  isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
3430
3511
  };
3431
3512
  });
3432
- (0, import_react23.useEffect)(() => {
3513
+ (0, import_react24.useEffect)(() => {
3433
3514
  if (draggedItem && ref.current) {
3434
3515
  if (isZone) {
3435
3516
  const rect = ref.current.getBoundingClientRect();
@@ -3463,15 +3544,15 @@ function assignRefs(refs, node) {
3463
3544
 
3464
3545
  // components/DropZone/lib/use-content-with-preview.ts
3465
3546
  init_react_import();
3466
- var import_react26 = require("react");
3547
+ var import_react27 = require("react");
3467
3548
 
3468
3549
  // lib/dnd/use-rendered-callback.ts
3469
3550
  init_react_import();
3470
- var import_react24 = require("@dnd-kit/react");
3471
- var import_react25 = require("react");
3551
+ var import_react25 = require("@dnd-kit/react");
3552
+ var import_react26 = require("react");
3472
3553
  function useRenderedCallback(callback, deps) {
3473
- const manager = (0, import_react24.useDragDropManager)();
3474
- return (0, import_react25.useCallback)(
3554
+ const manager = (0, import_react25.useDragDropManager)();
3555
+ return (0, import_react26.useCallback)(
3475
3556
  (...args) => __async(this, null, function* () {
3476
3557
  yield manager == null ? void 0 : manager.renderer.rendering;
3477
3558
  return callback(...args);
@@ -3501,7 +3582,7 @@ var useContentWithPreview = (content, zoneCompound) => {
3501
3582
  };
3502
3583
  }
3503
3584
  );
3504
- const [contentWithPreview, setContentWithPreview] = (0, import_react26.useState)(content);
3585
+ const [contentWithPreview, setContentWithPreview] = (0, import_react27.useState)(content);
3505
3586
  const updateContent = useRenderedCallback(
3506
3587
  (content2, preview2) => {
3507
3588
  if (preview2) {
@@ -3536,7 +3617,7 @@ var useContentWithPreview = (content, zoneCompound) => {
3536
3617
  },
3537
3618
  [draggedItemId, previewExists]
3538
3619
  );
3539
- (0, import_react26.useEffect)(() => {
3620
+ (0, import_react27.useEffect)(() => {
3540
3621
  updateContent(content, preview);
3541
3622
  }, [content, preview]);
3542
3623
  return contentWithPreview;
@@ -3544,16 +3625,16 @@ var useContentWithPreview = (content, zoneCompound) => {
3544
3625
 
3545
3626
  // components/DropZone/lib/use-drag-axis.ts
3546
3627
  init_react_import();
3547
- var import_react27 = require("react");
3628
+ var import_react28 = require("react");
3548
3629
  var GRID_DRAG_AXIS = "dynamic";
3549
3630
  var FLEX_ROW_DRAG_AXIS = "x";
3550
3631
  var DEFAULT_DRAG_AXIS = "y";
3551
3632
  var useDragAxis = (ref, collisionAxis) => {
3552
3633
  const { status } = useAppContext();
3553
- const [dragAxis, setDragAxis] = (0, import_react27.useState)(
3634
+ const [dragAxis, setDragAxis] = (0, import_react28.useState)(
3554
3635
  collisionAxis || DEFAULT_DRAG_AXIS
3555
3636
  );
3556
- const calculateDragAxis = (0, import_react27.useCallback)(() => {
3637
+ const calculateDragAxis = (0, import_react28.useCallback)(() => {
3557
3638
  if (ref.current) {
3558
3639
  const computedStyle = window.getComputedStyle(ref.current);
3559
3640
  if (computedStyle.display === "grid") {
@@ -3565,7 +3646,7 @@ var useDragAxis = (ref, collisionAxis) => {
3565
3646
  }
3566
3647
  }
3567
3648
  }, [ref.current]);
3568
- (0, import_react27.useEffect)(() => {
3649
+ (0, import_react28.useEffect)(() => {
3569
3650
  const onViewportChange = () => {
3570
3651
  calculateDragAxis();
3571
3652
  };
@@ -3574,17 +3655,18 @@ var useDragAxis = (ref, collisionAxis) => {
3574
3655
  window.removeEventListener("viewportchange", onViewportChange);
3575
3656
  };
3576
3657
  }, []);
3577
- (0, import_react27.useEffect)(calculateDragAxis, [status, collisionAxis]);
3658
+ (0, import_react28.useEffect)(calculateDragAxis, [status, collisionAxis]);
3578
3659
  return [dragAxis, calculateDragAxis];
3579
3660
  };
3580
3661
 
3581
3662
  // components/DropZone/index.tsx
3582
- var import_jsx_runtime21 = require("react/jsx-runtime");
3663
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3583
3664
  var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
3584
3665
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
3585
3666
  var RENDER_DEBUG = false;
3586
- var DropZoneEdit = (0, import_react28.forwardRef)(
3587
- function DropZoneEdit2({
3667
+ var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadValues({}, props));
3668
+ var DropZoneEdit = (0, import_react29.forwardRef)(
3669
+ function DropZoneEditInternal({
3588
3670
  zone,
3589
3671
  allow,
3590
3672
  disallow,
@@ -3594,7 +3676,7 @@ var DropZoneEdit = (0, import_react28.forwardRef)(
3594
3676
  collisionAxis
3595
3677
  }, userRef) {
3596
3678
  const appContext2 = useAppContext();
3597
- const ctx = (0, import_react28.useContext)(dropZoneContext);
3679
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
3598
3680
  const {
3599
3681
  // These all need setting via context
3600
3682
  data,
@@ -3632,12 +3714,12 @@ var DropZoneEdit = (0, import_react28.forwardRef)(
3632
3714
  };
3633
3715
  });
3634
3716
  const { itemSelector } = appContext2.state.ui;
3635
- (0, import_react28.useEffect)(() => {
3717
+ (0, import_react29.useEffect)(() => {
3636
3718
  if (areaId && registerZoneArea) {
3637
3719
  registerZoneArea(areaId);
3638
3720
  }
3639
3721
  }, [areaId]);
3640
- (0, import_react28.useEffect)(() => {
3722
+ (0, import_react29.useEffect)(() => {
3641
3723
  if (ctx == null ? void 0 : ctx.registerZone) {
3642
3724
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3643
3725
  }
@@ -3647,14 +3729,14 @@ var DropZoneEdit = (0, import_react28.forwardRef)(
3647
3729
  }
3648
3730
  };
3649
3731
  }, []);
3650
- const content = (0, import_react28.useMemo)(() => {
3732
+ const content = (0, import_react29.useMemo)(() => {
3651
3733
  if (areaId && zone !== rootDroppableId) {
3652
3734
  return setupZone(data, zoneCompound).zones[zoneCompound];
3653
3735
  }
3654
3736
  return data.content || [];
3655
3737
  }, [data, zoneCompound]);
3656
- const ref = (0, import_react28.useRef)(null);
3657
- const acceptsTarget = (0, import_react28.useCallback)(
3738
+ const ref = (0, import_react29.useRef)(null);
3739
+ const acceptsTarget = (0, import_react29.useCallback)(
3658
3740
  (componentType) => {
3659
3741
  if (!componentType) {
3660
3742
  return true;
@@ -3676,7 +3758,7 @@ var DropZoneEdit = (0, import_react28.forwardRef)(
3676
3758
  },
3677
3759
  [allow, disallow]
3678
3760
  );
3679
- (0, import_react28.useEffect)(() => {
3761
+ (0, import_react29.useEffect)(() => {
3680
3762
  if (registerLocalZone) {
3681
3763
  registerLocalZone(zoneCompound, acceptsTarget(draggedComponentType));
3682
3764
  }
@@ -3718,7 +3800,7 @@ var DropZoneEdit = (0, import_react28.forwardRef)(
3718
3800
  userMinEmptyHeight,
3719
3801
  ref
3720
3802
  });
3721
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3803
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3722
3804
  "div",
3723
3805
  {
3724
3806
  className: `${getClassName17({
@@ -3742,10 +3824,10 @@ var DropZoneEdit = (0, import_react28.forwardRef)(
3742
3824
  backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
3743
3825
  }),
3744
3826
  children: contentWithPreview.map((item, i) => {
3745
- var _a, _b, _c, _d, _e;
3827
+ var _a, _b, _c, _d, _e, _f, _g;
3746
3828
  const componentId = item.props.id;
3747
3829
  const puckProps = {
3748
- renderDropZone: DropZone,
3830
+ renderDropZone: DropZoneEditPure,
3749
3831
  isEditing: true,
3750
3832
  dragRef: null
3751
3833
  };
@@ -3755,27 +3837,27 @@ var DropZoneEdit = (0, import_react28.forwardRef)(
3755
3837
  // DEPRECATED
3756
3838
  });
3757
3839
  const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
3758
- let Render2 = config.components[item.type] && item.type !== "preview" ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
3840
+ let Render2 = config.components[item.type] && item.type !== "preview" ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
3759
3841
  "No configuration for ",
3760
3842
  item.type
3761
3843
  ] });
3762
3844
  const componentConfig = config.components[item.type];
3763
3845
  let componentType = item.type;
3764
3846
  let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
3765
- if (item.type === "preview" && preview) {
3847
+ if (item.type === "preview") {
3766
3848
  let Preview4 = function() {
3767
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
3849
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
3768
3850
  };
3769
3851
  var Preview3 = Preview4;
3770
- componentType = preview.componentType;
3771
- label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
3852
+ componentType = (_c = preview == null ? void 0 : preview.componentType) != null ? _c : "__preview";
3853
+ label = (_f = (_e = (_d = config.components[componentType]) == null ? void 0 : _d.label) != null ? _e : componentType) != null ? _f : "Preview";
3772
3854
  Render2 = Preview4;
3773
3855
  }
3774
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3856
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3775
3857
  DropZoneProvider,
3776
3858
  {
3777
3859
  value: __spreadProps(__spreadValues({}, ctx), { path: [...path, zoneCompound] }),
3778
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3860
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3779
3861
  DraggableComponent,
3780
3862
  {
3781
3863
  id: componentId,
@@ -3783,21 +3865,21 @@ var DropZoneEdit = (0, import_react28.forwardRef)(
3783
3865
  zoneCompound,
3784
3866
  depth: depth + 1,
3785
3867
  index: i,
3786
- isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
3868
+ isLoading: ((_g = appContext2.componentState[componentId]) == null ? void 0 : _g.loadingCount) > 0,
3787
3869
  isSelected,
3788
3870
  label,
3789
3871
  isEnabled,
3790
3872
  autoDragAxis: dragAxis,
3791
3873
  userDragAxis: collisionAxis,
3792
3874
  inDroppableZone: acceptsTarget(draggedComponentType),
3793
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3875
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3794
3876
  Render2,
3795
3877
  __spreadProps(__spreadValues({}, defaultedProps), {
3796
3878
  puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
3797
3879
  dragRef
3798
3880
  })
3799
3881
  })
3800
- ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Render2, __spreadValues({}, defaultedProps)) })
3882
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Render2, __spreadValues({}, defaultedProps)) })
3801
3883
  }
3802
3884
  )
3803
3885
  },
@@ -3808,13 +3890,14 @@ var DropZoneEdit = (0, import_react28.forwardRef)(
3808
3890
  );
3809
3891
  }
3810
3892
  );
3811
- var DropZoneRender = (0, import_react28.forwardRef)(
3812
- function DropZoneRender2({ className, style, zone }, ref) {
3813
- const ctx = (0, import_react28.useContext)(dropZoneContext);
3893
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRender, __spreadValues({}, props));
3894
+ var DropZoneRender = (0, import_react29.forwardRef)(
3895
+ function DropZoneRenderInternal({ className, style, zone }, ref) {
3896
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
3814
3897
  const { data, areaId = "root", config } = ctx || {};
3815
3898
  let zoneCompound = rootDroppableId;
3816
3899
  let content = (data == null ? void 0 : data.content) || [];
3817
- (0, import_react28.useEffect)(() => {
3900
+ (0, import_react29.useEffect)(() => {
3818
3901
  if (ctx == null ? void 0 : ctx.registerZone) {
3819
3902
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3820
3903
  }
@@ -3831,10 +3914,10 @@ var DropZoneRender = (0, import_react28.forwardRef)(
3831
3914
  zoneCompound = `${areaId}:${zone}`;
3832
3915
  content = setupZone(data, zoneCompound).zones[zoneCompound];
3833
3916
  }
3834
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, style, ref, children: content.map((item) => {
3917
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
3835
3918
  const Component = config.components[item.type];
3836
3919
  if (Component) {
3837
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3920
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3838
3921
  DropZoneProvider,
3839
3922
  {
3840
3923
  value: {
@@ -3844,10 +3927,12 @@ var DropZoneRender = (0, import_react28.forwardRef)(
3844
3927
  depth: 1,
3845
3928
  path: []
3846
3929
  },
3847
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3930
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3848
3931
  Component.render,
3849
3932
  __spreadProps(__spreadValues({}, item.props), {
3850
- puck: { renderDropZone: DropZoneRender2 }
3933
+ puck: {
3934
+ renderDropZone: DropZoneRenderPure
3935
+ }
3851
3936
  })
3852
3937
  )
3853
3938
  },
@@ -3858,13 +3943,13 @@ var DropZoneRender = (0, import_react28.forwardRef)(
3858
3943
  }) });
3859
3944
  }
3860
3945
  );
3861
- var DropZone = (0, import_react28.forwardRef)(
3946
+ var DropZone = (0, import_react29.forwardRef)(
3862
3947
  function DropZone2(props, ref) {
3863
- const ctx = (0, import_react28.useContext)(dropZoneContext);
3948
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
3864
3949
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
3865
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
3950
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
3866
3951
  }
3867
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3952
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3868
3953
  }
3869
3954
  );
3870
3955
 
@@ -3922,6 +4007,48 @@ var getFrame = () => {
3922
4007
  return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
3923
4008
  };
3924
4009
 
4010
+ // lib/global-position.ts
4011
+ init_react_import();
4012
+ var GlobalPosition = class {
4013
+ constructor(target, original) {
4014
+ this.scaleFactor = 1;
4015
+ this.frameEl = null;
4016
+ this.frameRect = null;
4017
+ var _a;
4018
+ this.target = target;
4019
+ this.original = original;
4020
+ this.frameEl = document.querySelector("iframe");
4021
+ if (this.frameEl) {
4022
+ this.frameRect = this.frameEl.getBoundingClientRect();
4023
+ this.scaleFactor = this.frameRect.width / (((_a = this.frameEl.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
4024
+ }
4025
+ }
4026
+ get x() {
4027
+ return this.original.x;
4028
+ }
4029
+ get y() {
4030
+ return this.original.y;
4031
+ }
4032
+ get global() {
4033
+ if (document !== this.target.ownerDocument && this.frameRect) {
4034
+ return {
4035
+ x: this.x * this.scaleFactor + this.frameRect.left,
4036
+ y: this.y * this.scaleFactor + this.frameRect.top
4037
+ };
4038
+ }
4039
+ return this.original;
4040
+ }
4041
+ get frame() {
4042
+ if (document === this.target.ownerDocument && this.frameRect) {
4043
+ return {
4044
+ x: (this.x - this.frameRect.left) / this.scaleFactor,
4045
+ y: (this.y - this.frameRect.top) / this.scaleFactor
4046
+ };
4047
+ }
4048
+ return this.original;
4049
+ }
4050
+ };
4051
+
3925
4052
  // lib/dnd/NestedDroppablePlugin.ts
3926
4053
  var depthSort = (candidates) => {
3927
4054
  return candidates.sort((a, b) => {
@@ -3951,10 +4078,12 @@ var getZoneId2 = (candidate) => {
3951
4078
  }
3952
4079
  return id;
3953
4080
  };
3954
- var getPointerCollisions = (position, manager, ownerDocument) => {
3955
- var _a;
4081
+ var getPointerCollisions = (position, manager) => {
3956
4082
  const candidates = [];
3957
- let elements = ownerDocument.elementsFromPoint(position.x, position.y);
4083
+ let elements = position.target.ownerDocument.elementsFromPoint(
4084
+ position.x,
4085
+ position.y
4086
+ );
3958
4087
  const previewFrame = elements.find(
3959
4088
  (el) => el.getAttribute("data-puck-preview")
3960
4089
  );
@@ -3963,17 +4092,9 @@ var getPointerCollisions = (position, manager, ownerDocument) => {
3963
4092
  elements = [drawer];
3964
4093
  }
3965
4094
  if (previewFrame) {
3966
- const iframe = previewFrame.querySelector("iframe");
3967
- if (iframe) {
3968
- const rect = iframe.getBoundingClientRect();
3969
- const frame = getFrame();
3970
- if (frame) {
3971
- const scaleFactor = rect.width / (((_a = iframe.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
3972
- elements = frame.elementsFromPoint(
3973
- (position.x - rect.left) / scaleFactor,
3974
- (position.y - rect.top) / scaleFactor
3975
- );
3976
- }
4095
+ const frame = getFrame();
4096
+ if (frame) {
4097
+ elements = frame.elementsFromPoint(position.frame.x, position.frame.y);
3977
4098
  }
3978
4099
  }
3979
4100
  if (elements) {
@@ -3990,9 +4111,9 @@ var getPointerCollisions = (position, manager, ownerDocument) => {
3990
4111
  }
3991
4112
  return candidates;
3992
4113
  };
3993
- var findDeepestCandidate = (position, manager, ownerDocument) => {
4114
+ var findDeepestCandidate = (position, manager) => {
3994
4115
  var _a;
3995
- const candidates = getPointerCollisions(position, manager, ownerDocument);
4116
+ const candidates = getPointerCollisions(position, manager);
3996
4117
  if (candidates.length > 0) {
3997
4118
  const sortedCandidates = depthSort(candidates);
3998
4119
  const draggable = manager.dragOperation.source;
@@ -4045,22 +4166,18 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
4045
4166
  }
4046
4167
  const cleanupEffect = (0, import_state.effects)(() => {
4047
4168
  const handleMove = (event) => {
4048
- const position = {
4169
+ const target = event.originalTarget || event.target;
4170
+ const position = new GlobalPosition(target, {
4049
4171
  x: event.clientX,
4050
4172
  y: event.clientY
4051
- };
4052
- const target = event.originalTarget || event.target;
4053
- const ownerDocument = target == null ? void 0 : target.ownerDocument;
4173
+ });
4054
4174
  const elements = document.elementsFromPoint(
4055
- event.clientX,
4056
- event.clientY
4175
+ position.global.x,
4176
+ position.global.y
4057
4177
  );
4058
4178
  const overEl = elements.some((el) => el.id === id);
4059
4179
  if (overEl) {
4060
- onChange(
4061
- findDeepestCandidate(position, manager, ownerDocument),
4062
- manager
4063
- );
4180
+ onChange(findDeepestCandidate(position, manager), manager);
4064
4181
  }
4065
4182
  };
4066
4183
  const handleMoveThrottled = throttle(handleMove, 50);
@@ -4391,6 +4508,11 @@ var reduceUi = (ui, action) => {
4391
4508
  itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
4392
4509
  });
4393
4510
  }
4511
+ if (action.type === "remove") {
4512
+ return __spreadProps(__spreadValues({}, ui), {
4513
+ itemSelector: null
4514
+ });
4515
+ }
4394
4516
  return ui;
4395
4517
  };
4396
4518
 
@@ -4641,6 +4763,9 @@ var _PointerSensor = class _PointerSensor extends import_abstract10.Sensor {
4641
4763
  }
4642
4764
  }
4643
4765
  handlePointerUp(event) {
4766
+ if (!this.source) {
4767
+ return;
4768
+ }
4644
4769
  event.preventDefault();
4645
4770
  event.stopPropagation();
4646
4771
  const { status } = this.manager.dragOperation;
@@ -4741,14 +4866,14 @@ function patchWindow(window2) {
4741
4866
 
4742
4867
  // components/DragDropContext/index.tsx
4743
4868
  var import_zustand3 = require("zustand");
4744
- var import_jsx_runtime22 = require("react/jsx-runtime");
4869
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4745
4870
  var DEBUG3 = false;
4746
- var dragListenerContext = (0, import_react30.createContext)({
4871
+ var dragListenerContext = (0, import_react31.createContext)({
4747
4872
  dragListeners: {}
4748
4873
  });
4749
4874
  function useDragListener(type, fn, deps = []) {
4750
- const { setDragListeners } = (0, import_react30.useContext)(dragListenerContext);
4751
- (0, import_react30.useEffect)(() => {
4875
+ const { setDragListeners } = (0, import_react31.useContext)(dragListenerContext);
4876
+ (0, import_react31.useEffect)(() => {
4752
4877
  if (setDragListeners) {
4753
4878
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
4754
4879
  [type]: [...old[type] || [], fn]
@@ -4758,8 +4883,8 @@ function useDragListener(type, fn, deps = []) {
4758
4883
  }
4759
4884
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4760
4885
  var useTempDisableFallback = (timeout3) => {
4761
- const lastFallbackDisable = (0, import_react30.useRef)(null);
4762
- return (0, import_react30.useCallback)((manager) => {
4886
+ const lastFallbackDisable = (0, import_react31.useRef)(null);
4887
+ return (0, import_react31.useCallback)((manager) => {
4763
4888
  collisionStore.setState({ fallbackEnabled: false });
4764
4889
  const fallbackId = generateId();
4765
4890
  lastFallbackDisable.current = fallbackId;
@@ -4776,11 +4901,11 @@ var DragDropContextClient = ({
4776
4901
  disableAutoScroll
4777
4902
  }) => {
4778
4903
  const { state, config, dispatch, resolveData } = useAppContext();
4779
- const id = (0, import_react30.useId)();
4904
+ const id = (0, import_react31.useId)();
4780
4905
  const { data } = state;
4781
- const debouncedParamsRef = (0, import_react30.useRef)(null);
4906
+ const debouncedParamsRef = (0, import_react31.useRef)(null);
4782
4907
  const tempDisableFallback = useTempDisableFallback(100);
4783
- const [zoneStore] = (0, import_react30.useState)(
4908
+ const [zoneStore] = (0, import_react31.useState)(
4784
4909
  () => (0, import_zustand3.createStore)(() => ({
4785
4910
  zoneDepthIndex: {},
4786
4911
  nextZoneDepthIndex: {},
@@ -4790,7 +4915,7 @@ var DragDropContextClient = ({
4790
4915
  previewIndex: {}
4791
4916
  }))
4792
4917
  );
4793
- const getChanged2 = (0, import_react30.useCallback)(
4918
+ const getChanged2 = (0, import_react31.useCallback)(
4794
4919
  (params, id2) => {
4795
4920
  const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
4796
4921
  const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
@@ -4811,7 +4936,7 @@ var DragDropContextClient = ({
4811
4936
  },
4812
4937
  [zoneStore]
4813
4938
  );
4814
- const setDeepestAndCollide = (0, import_react30.useCallback)(
4939
+ const setDeepestAndCollide = (0, import_react31.useCallback)(
4815
4940
  (params, manager) => {
4816
4941
  const { zoneChanged, areaChanged } = getChanged2(params, id);
4817
4942
  if (!zoneChanged && !areaChanged) return;
@@ -4835,7 +4960,7 @@ var DragDropContextClient = ({
4835
4960
  setDeepestDb.cancel();
4836
4961
  debouncedParamsRef.current = null;
4837
4962
  };
4838
- (0, import_react30.useEffect)(() => {
4963
+ (0, import_react31.useEffect)(() => {
4839
4964
  if (DEBUG3) {
4840
4965
  zoneStore.subscribe(
4841
4966
  (s) => {
@@ -4849,7 +4974,7 @@ var DragDropContextClient = ({
4849
4974
  );
4850
4975
  }
4851
4976
  }, []);
4852
- const [plugins] = (0, import_react30.useState)(() => [
4977
+ const [plugins] = (0, import_react31.useState)(() => [
4853
4978
  ...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
4854
4979
  createNestedDroppablePlugin(
4855
4980
  {
@@ -4896,7 +5021,7 @@ var DragDropContextClient = ({
4896
5021
  id
4897
5022
  )
4898
5023
  ]);
4899
- const [sensors] = (0, import_react30.useState)(() => [
5024
+ const [sensors] = (0, import_react31.useState)(() => [
4900
5025
  PointerSensor.configure({
4901
5026
  activationConstraints(event, source) {
4902
5027
  var _a;
@@ -4915,10 +5040,10 @@ var DragDropContextClient = ({
4915
5040
  }
4916
5041
  })
4917
5042
  ]);
4918
- const [dragListeners, setDragListeners] = (0, import_react30.useState)({});
4919
- const [pathData, setPathData] = (0, import_react30.useState)();
4920
- const dragMode = (0, import_react30.useRef)(null);
4921
- const registerPath = (0, import_react30.useCallback)(
5043
+ const [dragListeners, setDragListeners] = (0, import_react31.useState)({});
5044
+ const [pathData, setPathData] = (0, import_react31.useState)();
5045
+ const dragMode = (0, import_react31.useRef)(null);
5046
+ const registerPath = (0, import_react31.useCallback)(
4922
5047
  (selector) => {
4923
5048
  const item = getItem(selector, data);
4924
5049
  if (!item) {
@@ -4940,16 +5065,16 @@ var DragDropContextClient = ({
4940
5065
  },
4941
5066
  [data, setPathData]
4942
5067
  );
4943
- const initialSelector = (0, import_react30.useRef)(void 0);
4944
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5068
+ const initialSelector = (0, import_react31.useRef)(void 0);
5069
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4945
5070
  dragListenerContext.Provider,
4946
5071
  {
4947
5072
  value: {
4948
5073
  dragListeners,
4949
5074
  setDragListeners
4950
5075
  },
4951
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4952
- import_react29.DragDropProvider,
5076
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5077
+ import_react30.DragDropProvider,
4953
5078
  {
4954
5079
  plugins,
4955
5080
  sensors,
@@ -5126,7 +5251,7 @@ var DragDropContextClient = ({
5126
5251
  initialSelector.current = void 0;
5127
5252
  zoneStore.setState({ draggedItem: event.operation.source });
5128
5253
  },
5129
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5254
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5130
5255
  DropZoneProvider,
5131
5256
  {
5132
5257
  value: {
@@ -5155,11 +5280,11 @@ var DragDropContext = ({
5155
5280
  if (status === "LOADING") {
5156
5281
  return children;
5157
5282
  }
5158
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DragDropContextClient, { disableAutoScroll, children });
5283
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DragDropContextClient, { disableAutoScroll, children });
5159
5284
  };
5160
5285
 
5161
5286
  // components/Drawer/index.tsx
5162
- var import_jsx_runtime23 = require("react/jsx-runtime");
5287
+ var import_jsx_runtime24 = require("react/jsx-runtime");
5163
5288
  var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
5164
5289
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
5165
5290
  var DrawerItemInner = ({
@@ -5169,11 +5294,11 @@ var DrawerItemInner = ({
5169
5294
  dragRef,
5170
5295
  isDragDisabled
5171
5296
  }) => {
5172
- const CustomInner = (0, import_react31.useMemo)(
5173
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
5297
+ const CustomInner = (0, import_react32.useMemo)(
5298
+ () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
5174
5299
  [children]
5175
5300
  );
5176
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5301
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5177
5302
  "div",
5178
5303
  {
5179
5304
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -5181,9 +5306,9 @@ var DrawerItemInner = ({
5181
5306
  onMouseDown: (e) => e.preventDefault(),
5182
5307
  "data-testid": dragRef ? `drawer-item:${name}` : "",
5183
5308
  "data-puck-drawer-item": true,
5184
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
5185
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
5186
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DragIcon, {}) })
5309
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
5310
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
5311
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DragIcon, {}) })
5187
5312
  ] }) }) })
5188
5313
  }
5189
5314
  );
@@ -5200,9 +5325,9 @@ var DrawerItemDraggable = ({
5200
5325
  data: { type: "drawer", componentType: name },
5201
5326
  disabled: isDragDisabled
5202
5327
  });
5203
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName18("draggable"), children: [
5204
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DrawerItemInner, { name, label, children }) }),
5205
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5328
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("draggable"), children: [
5329
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DrawerItemInner, { name, label, children }) }),
5330
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5206
5331
  DrawerItemInner,
5207
5332
  {
5208
5333
  name,
@@ -5223,7 +5348,7 @@ var DrawerItem = ({
5223
5348
  isDragDisabled
5224
5349
  }) => {
5225
5350
  const resolvedId = id || name;
5226
- const [dynamicId, setDynamicId] = (0, import_react31.useState)(generateId(resolvedId));
5351
+ const [dynamicId, setDynamicId] = (0, import_react32.useState)(generateId(resolvedId));
5227
5352
  if (typeof index !== "undefined") {
5228
5353
  console.error(
5229
5354
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -5236,7 +5361,7 @@ var DrawerItem = ({
5236
5361
  },
5237
5362
  [resolvedId]
5238
5363
  );
5239
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5364
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5240
5365
  DrawerItemDraggable,
5241
5366
  {
5242
5367
  name,
@@ -5262,14 +5387,14 @@ var Drawer = ({
5262
5387
  "Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
5263
5388
  );
5264
5389
  }
5265
- const [id] = (0, import_react31.useState)(generateId());
5390
+ const id = (0, import_react32.useId)();
5266
5391
  const { ref } = useDroppableSafe({
5267
5392
  id,
5268
5393
  type: "void",
5269
5394
  collisionPriority: 0
5270
5395
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
5271
5396
  });
5272
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5397
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5273
5398
  "div",
5274
5399
  {
5275
5400
  className: getClassName18(),
@@ -5284,7 +5409,7 @@ Drawer.Item = DrawerItem;
5284
5409
 
5285
5410
  // components/Puck/index.tsx
5286
5411
  init_react_import();
5287
- var import_react47 = require("react");
5412
+ var import_react50 = require("react");
5288
5413
 
5289
5414
  // components/SidebarSection/index.tsx
5290
5415
  init_react_import();
@@ -5295,7 +5420,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
5295
5420
 
5296
5421
  // lib/use-breadcrumbs.ts
5297
5422
  init_react_import();
5298
- var import_react32 = require("react");
5423
+ var import_react33 = require("react");
5299
5424
  var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
5300
5425
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
5301
5426
  const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
@@ -5345,8 +5470,8 @@ var useBreadcrumbs = (renderCount) => {
5345
5470
  state: { data },
5346
5471
  selectedItem
5347
5472
  } = useAppContext();
5348
- const dzContext = (0, import_react32.useContext)(dropZoneContext);
5349
- return (0, import_react32.useMemo)(() => {
5473
+ const dzContext = (0, import_react33.useContext)(dropZoneContext);
5474
+ return (0, import_react33.useMemo)(() => {
5350
5475
  const breadcrumbs = convertPathDataToBreadcrumbs(
5351
5476
  selectedItem,
5352
5477
  dzContext == null ? void 0 : dzContext.pathData,
@@ -5360,7 +5485,7 @@ var useBreadcrumbs = (renderCount) => {
5360
5485
  };
5361
5486
 
5362
5487
  // components/SidebarSection/index.tsx
5363
- var import_jsx_runtime24 = require("react/jsx-runtime");
5488
+ var import_jsx_runtime25 = require("react/jsx-runtime");
5364
5489
  var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
5365
5490
  var SidebarSection = ({
5366
5491
  children,
@@ -5373,15 +5498,15 @@ var SidebarSection = ({
5373
5498
  }) => {
5374
5499
  const { setUi } = useAppContext();
5375
5500
  const breadcrumbs = useBreadcrumbs(1);
5376
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5501
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5377
5502
  "div",
5378
5503
  {
5379
5504
  className: getClassName19({ noBorderTop, noPadding }),
5380
5505
  style: { background },
5381
5506
  children: [
5382
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
5383
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
5384
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5507
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
5508
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
5509
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5385
5510
  "button",
5386
5511
  {
5387
5512
  type: "button",
@@ -5390,12 +5515,12 @@ var SidebarSection = ({
5390
5515
  children: breadcrumb.label
5391
5516
  }
5392
5517
  ),
5393
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChevronRight, { size: 16 })
5518
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronRight, { size: 16 })
5394
5519
  ] }, i)) : null,
5395
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
5520
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
5396
5521
  ] }) }),
5397
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName19("content"), children }),
5398
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Loader, { size: 32 }) })
5522
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("content"), children }),
5523
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Loader, { size: 32 }) })
5399
5524
  ]
5400
5525
  }
5401
5526
  );
@@ -5426,7 +5551,7 @@ init_react_import();
5426
5551
  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" };
5427
5552
 
5428
5553
  // components/MenuBar/index.tsx
5429
- var import_jsx_runtime25 = require("react/jsx-runtime");
5554
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5430
5555
  var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
5431
5556
  function MenuBar({
5432
5557
  appState,
@@ -5440,7 +5565,7 @@ function MenuBar({
5440
5565
  history: { back, forward, historyStore }
5441
5566
  } = useAppContext();
5442
5567
  const { hasFuture = false, hasPast = false } = historyStore || {};
5443
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5568
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5444
5569
  "div",
5445
5570
  {
5446
5571
  className: getClassName20({ menuOpen }),
@@ -5454,12 +5579,12 @@ function MenuBar({
5454
5579
  setMenuOpen(false);
5455
5580
  }
5456
5581
  },
5457
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName20("inner"), children: [
5458
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName20("history"), children: [
5459
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Undo2, { size: 21 }) }),
5460
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Redo2, { size: 21 }) })
5582
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20("inner"), children: [
5583
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20("history"), children: [
5584
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Undo2, { size: 21 }) }),
5585
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Redo2, { size: 21 }) })
5461
5586
  ] }),
5462
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: renderHeaderActions && renderHeaderActions({
5587
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: renderHeaderActions && renderHeaderActions({
5463
5588
  state: appState,
5464
5589
  dispatch
5465
5590
  }) })
@@ -5477,36 +5602,61 @@ init_react_import();
5477
5602
 
5478
5603
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
5479
5604
  init_react_import();
5480
- 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" };
5605
+ var styles_module_default16 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields--isLoading": "_PuckFields--isLoading_10bh7_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_10bh7_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_10bh7_25", "PuckFields-field": "_PuckFields-field_10bh7_32", "PuckFields--wrapFields": "_PuckFields--wrapFields_10bh7_36" };
5481
5606
 
5482
5607
  // components/Puck/components/Fields/index.tsx
5483
- var import_react34 = require("react");
5608
+ var import_react37 = require("react");
5609
+
5610
+ // lib/use-resolved-fields.ts
5611
+ init_react_import();
5612
+ var import_react36 = require("react");
5484
5613
 
5485
5614
  // lib/use-parent.ts
5486
5615
  init_react_import();
5487
- var import_react33 = require("react");
5488
- var useParent = (itemSelector) => {
5616
+ var import_react34 = require("react");
5617
+ var getParent = (itemSelector, pathData, data) => {
5489
5618
  var _a;
5490
- const { selectedItem, state } = useAppContext();
5491
- const { pathData } = (0, import_react33.useContext)(dropZoneContext) || {};
5492
- const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
5493
- const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
5619
+ if (!itemSelector) return null;
5620
+ const item = getItem(itemSelector, data);
5621
+ const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, data);
5494
5622
  const lastItem = breadcrumbs[breadcrumbs.length - 1];
5495
- const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, state.data)) != null ? _a : null : null;
5623
+ const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, data)) != null ? _a : null : null;
5496
5624
  return parent || null;
5497
5625
  };
5626
+ var useGetParent = () => {
5627
+ const { state } = useAppContext();
5628
+ const { pathData } = (0, import_react34.useContext)(dropZoneContext) || {};
5629
+ return (0, import_react34.useCallback)(
5630
+ () => getParent(state.ui.itemSelector, pathData, state.data),
5631
+ [state.ui.itemSelector, pathData, state.data]
5632
+ );
5633
+ };
5634
+ var useParent = () => {
5635
+ return useGetParent()();
5636
+ };
5498
5637
 
5499
- // components/Puck/components/Fields/index.tsx
5500
- var import_jsx_runtime26 = require("react/jsx-runtime");
5501
- var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
5638
+ // lib/use-on-value-change.ts
5639
+ init_react_import();
5640
+ var import_react35 = require("react");
5641
+ function useOnValueChange(value, onChange, compare = Object.is, deps = []) {
5642
+ const tracked = (0, import_react35.useRef)(value);
5643
+ (0, import_react35.useEffect)(() => {
5644
+ const oldValue = tracked.current;
5645
+ if (!compare(value, oldValue)) {
5646
+ tracked.current = value;
5647
+ onChange(value, oldValue);
5648
+ }
5649
+ }, [onChange, compare, value, ...deps]);
5650
+ }
5651
+
5652
+ // lib/selector-is.ts
5653
+ init_react_import();
5654
+ var selectorIs = (a, b) => (a == null ? void 0 : a.zone) === (b == null ? void 0 : b.zone) && (a == null ? void 0 : a.index) === (b == null ? void 0 : b.index);
5655
+
5656
+ // lib/use-resolved-fields.ts
5502
5657
  var defaultPageFields = {
5503
5658
  title: { type: "text" }
5504
5659
  };
5505
- var DefaultFields = ({
5506
- children
5507
- }) => {
5508
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
5509
- };
5510
5660
  var useResolvedFields = () => {
5511
5661
  var _a, _b;
5512
5662
  const { selectedItem, state, config } = useAppContext();
@@ -5514,20 +5664,21 @@ var useResolvedFields = () => {
5514
5664
  const { data } = state;
5515
5665
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
5516
5666
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
5517
- const defaultFields = (0, import_react34.useMemo)(
5667
+ const defaultFields = (0, import_react36.useMemo)(
5518
5668
  () => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
5519
5669
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
5520
5670
  );
5521
5671
  const rootProps = data.root.props || data.root;
5522
- const [lastSelectedData, setLastSelectedData] = (0, import_react34.useState)({});
5523
- const [resolvedFields, setResolvedFields] = (0, import_react34.useState)(defaultFields);
5524
- const [fieldsLoading, setFieldsLoading] = (0, import_react34.useState)(false);
5672
+ const [lastSelectedData, setLastSelectedData] = (0, import_react36.useState)({});
5673
+ const [resolvedFields, setResolvedFields] = (0, import_react36.useState)(defaultFields);
5674
+ const [fieldsLoading, setFieldsLoading] = (0, import_react36.useState)(false);
5675
+ const lastFields = (0, import_react36.useRef)(defaultFields);
5525
5676
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5526
5677
  const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
5527
5678
  const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
5528
5679
  const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
5529
5680
  const hasResolver = hasComponentResolver || hasRootResolver;
5530
- const resolveFields = (0, import_react34.useCallback)(
5681
+ const resolveFields = (0, import_react36.useCallback)(
5531
5682
  (..._0) => __async(void 0, [..._0], function* (fields = {}) {
5532
5683
  var _a2;
5533
5684
  const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
@@ -5539,7 +5690,7 @@ var useResolvedFields = () => {
5539
5690
  {
5540
5691
  changed,
5541
5692
  fields,
5542
- lastFields: resolvedFields,
5693
+ lastFields: lastFields.current,
5543
5694
  lastData,
5544
5695
  appState: state,
5545
5696
  parent
@@ -5550,7 +5701,7 @@ var useResolvedFields = () => {
5550
5701
  return yield config.root.resolveFields(componentData, {
5551
5702
  changed,
5552
5703
  fields,
5553
- lastFields: resolvedFields,
5704
+ lastFields: lastFields.current,
5554
5705
  lastData,
5555
5706
  appState: state,
5556
5707
  parent
@@ -5559,26 +5710,56 @@ var useResolvedFields = () => {
5559
5710
  return defaultResolveFields(componentData, {
5560
5711
  changed,
5561
5712
  fields,
5562
- lastFields: resolvedFields,
5713
+ lastFields: lastFields.current,
5563
5714
  lastData
5564
5715
  });
5565
5716
  }),
5566
- [data, config, componentData, selectedItem, resolvedFields, state]
5717
+ [data, config, componentData, selectedItem, state, parent]
5567
5718
  );
5568
- (0, import_react34.useEffect)(() => {
5569
- if (hasResolver) {
5570
- setFieldsLoading(true);
5571
- resolveFields(defaultFields).then((fields) => {
5572
- setResolvedFields(fields || {});
5573
- setFieldsLoading(false);
5574
- });
5575
- } else {
5576
- setResolvedFields(defaultFields);
5719
+ const triggerResolver = (0, import_react36.useCallback)(() => {
5720
+ var _a2, _b2;
5721
+ if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || ((_b2 = state.ui.itemSelector) == null ? void 0 : _b2.zone) === "default-zone" || parent) {
5722
+ if (hasResolver) {
5723
+ setFieldsLoading(true);
5724
+ resolveFields(defaultFields).then((fields) => {
5725
+ setResolvedFields(fields || {});
5726
+ lastFields.current = fields;
5727
+ setFieldsLoading(false);
5728
+ });
5729
+ return;
5730
+ }
5577
5731
  }
5578
- }, [data, defaultFields, selectedItem, hasResolver]);
5732
+ setResolvedFields(defaultFields);
5733
+ }, [defaultFields, state.ui.itemSelector, hasResolver, parent]);
5734
+ useOnValueChange(
5735
+ state.ui.itemSelector,
5736
+ () => {
5737
+ lastFields.current = defaultFields;
5738
+ },
5739
+ selectorIs
5740
+ );
5741
+ useOnValueChange(
5742
+ { data, parent, itemSelector: state.ui.itemSelector },
5743
+ () => {
5744
+ triggerResolver();
5745
+ },
5746
+ (a, b) => JSON.stringify(a) === JSON.stringify(b)
5747
+ );
5748
+ (0, import_react36.useEffect)(() => {
5749
+ triggerResolver();
5750
+ }, []);
5579
5751
  return [resolvedFields, fieldsLoading];
5580
5752
  };
5581
- var Fields = () => {
5753
+
5754
+ // components/Puck/components/Fields/index.tsx
5755
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5756
+ var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
5757
+ var DefaultFields = ({
5758
+ children
5759
+ }) => {
5760
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children });
5761
+ };
5762
+ var Fields = ({ wrapFields = true }) => {
5582
5763
  var _a, _b;
5583
5764
  const {
5584
5765
  selectedItem,
@@ -5596,16 +5777,16 @@ var Fields = () => {
5596
5777
  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;
5597
5778
  const isLoading = fieldsResolving || componentResolving;
5598
5779
  const rootProps = data.root.props || data.root;
5599
- const Wrapper = (0, import_react34.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
5600
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
5780
+ const Wrapper = (0, import_react37.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
5781
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5601
5782
  "form",
5602
5783
  {
5603
- className: getClassName21(),
5784
+ className: getClassName21({ wrapFields }),
5604
5785
  onSubmit: (e) => {
5605
5786
  e.preventDefault();
5606
5787
  },
5607
5788
  children: [
5608
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
5789
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
5609
5790
  const field = fields[fieldName];
5610
5791
  if (!(field == null ? void 0 : field.type)) return null;
5611
5792
  const onChange = (value, updatedUi) => {
@@ -5676,7 +5857,7 @@ var Fields = () => {
5676
5857
  item: selectedItem
5677
5858
  });
5678
5859
  const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
5679
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5860
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5680
5861
  AutoFieldPrivate,
5681
5862
  {
5682
5863
  field,
@@ -5685,16 +5866,15 @@ var Fields = () => {
5685
5866
  readOnly: !edit || readOnly[fieldName],
5686
5867
  value: selectedItem.props[fieldName],
5687
5868
  onChange
5688
- },
5689
- id
5690
- );
5869
+ }
5870
+ ) }, id);
5691
5871
  } else {
5692
5872
  const readOnly = data.root.readOnly || {};
5693
5873
  const { edit } = getPermissions({
5694
5874
  root: true
5695
5875
  });
5696
5876
  const id = `root_${field.type}_${fieldName}`;
5697
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5877
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5698
5878
  AutoFieldPrivate,
5699
5879
  {
5700
5880
  field,
@@ -5703,12 +5883,11 @@ var Fields = () => {
5703
5883
  readOnly: !edit || readOnly[fieldName],
5704
5884
  value: rootProps[fieldName],
5705
5885
  onChange
5706
- },
5707
- id
5708
- );
5886
+ }
5887
+ ) }, id);
5709
5888
  }
5710
5889
  }) }),
5711
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader, { size: 16 }) }) })
5890
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Loader, { size: 16 }) }) })
5712
5891
  ]
5713
5892
  }
5714
5893
  );
@@ -5719,7 +5898,7 @@ init_react_import();
5719
5898
 
5720
5899
  // lib/use-component-list.tsx
5721
5900
  init_react_import();
5722
- var import_react35 = require("react");
5901
+ var import_react38 = require("react");
5723
5902
 
5724
5903
  // components/ComponentList/index.tsx
5725
5904
  init_react_import();
@@ -5729,7 +5908,7 @@ init_react_import();
5729
5908
  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" };
5730
5909
 
5731
5910
  // components/ComponentList/index.tsx
5732
- var import_jsx_runtime27 = require("react/jsx-runtime");
5911
+ var import_jsx_runtime28 = require("react/jsx-runtime");
5733
5912
  var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
5734
5913
  var ComponentListItem = ({
5735
5914
  name,
@@ -5739,7 +5918,7 @@ var ComponentListItem = ({
5739
5918
  const canInsert = getPermissions({
5740
5919
  type: name
5741
5920
  }).insert;
5742
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
5921
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
5743
5922
  };
5744
5923
  var ComponentList = ({
5745
5924
  children,
@@ -5748,8 +5927,8 @@ var ComponentList = ({
5748
5927
  }) => {
5749
5928
  const { config, state, setUi } = useAppContext();
5750
5929
  const { expanded = true } = state.ui.componentList[id] || {};
5751
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
5752
- title && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5930
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
5931
+ title && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5753
5932
  "button",
5754
5933
  {
5755
5934
  type: "button",
@@ -5763,14 +5942,14 @@ var ComponentList = ({
5763
5942
  }),
5764
5943
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
5765
5944
  children: [
5766
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: title }),
5767
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDown, { size: 12 }) })
5945
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: title }),
5946
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronDown, { size: 12 }) })
5768
5947
  ]
5769
5948
  }
5770
5949
  ),
5771
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
5950
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
5772
5951
  var _a;
5773
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5952
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5774
5953
  ComponentListItem,
5775
5954
  {
5776
5955
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -5784,10 +5963,10 @@ var ComponentList = ({
5784
5963
  ComponentList.Item = ComponentListItem;
5785
5964
 
5786
5965
  // lib/use-component-list.tsx
5787
- var import_jsx_runtime28 = require("react/jsx-runtime");
5966
+ var import_jsx_runtime29 = require("react/jsx-runtime");
5788
5967
  var useComponentList = (config, ui) => {
5789
- const [componentList, setComponentList] = (0, import_react35.useState)();
5790
- (0, import_react35.useEffect)(() => {
5968
+ const [componentList, setComponentList] = (0, import_react38.useState)();
5969
+ (0, import_react38.useEffect)(() => {
5791
5970
  var _a, _b, _c;
5792
5971
  if (Object.keys(ui.componentList).length > 0) {
5793
5972
  const matchedComponents = [];
@@ -5797,7 +5976,7 @@ var useComponentList = (config, ui) => {
5797
5976
  if (category.visible === false || !category.components) {
5798
5977
  return null;
5799
5978
  }
5800
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5979
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5801
5980
  ComponentList,
5802
5981
  {
5803
5982
  id: categoryKey,
@@ -5806,7 +5985,7 @@ var useComponentList = (config, ui) => {
5806
5985
  var _a2;
5807
5986
  matchedComponents.push(componentName);
5808
5987
  const componentConf = config.components[componentName] || {};
5809
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5988
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5810
5989
  ComponentList.Item,
5811
5990
  {
5812
5991
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -5826,7 +6005,7 @@ var useComponentList = (config, ui) => {
5826
6005
  );
5827
6006
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
5828
6007
  _componentList.push(
5829
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6008
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5830
6009
  ComponentList,
5831
6010
  {
5832
6011
  id: "other",
@@ -5834,7 +6013,7 @@ var useComponentList = (config, ui) => {
5834
6013
  children: remainingComponents.map((componentName, i) => {
5835
6014
  var _a2;
5836
6015
  const componentConf = config.components[componentName] || {};
5837
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6016
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5838
6017
  ComponentList.Item,
5839
6018
  {
5840
6019
  name: componentName,
@@ -5856,25 +6035,25 @@ var useComponentList = (config, ui) => {
5856
6035
  };
5857
6036
 
5858
6037
  // components/Puck/components/Components/index.tsx
5859
- var import_react36 = require("react");
5860
- var import_jsx_runtime29 = require("react/jsx-runtime");
6038
+ var import_react39 = require("react");
6039
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5861
6040
  var Components = () => {
5862
6041
  const { config, state, overrides } = useAppContext();
5863
6042
  const componentList = useComponentList(config, state.ui);
5864
- const Wrapper = (0, import_react36.useMemo)(() => overrides.components || "div", [overrides]);
5865
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ComponentList, { id: "all" }) });
6043
+ const Wrapper = (0, import_react39.useMemo)(() => overrides.components || "div", [overrides]);
6044
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentList, { id: "all" }) });
5866
6045
  };
5867
6046
 
5868
6047
  // components/Puck/components/Preview/index.tsx
5869
6048
  init_react_import();
5870
- var import_react38 = require("react");
6049
+ var import_react41 = require("react");
5871
6050
 
5872
6051
  // components/AutoFrame/index.tsx
5873
6052
  init_react_import();
5874
- var import_react37 = require("react");
6053
+ var import_react40 = require("react");
5875
6054
  var import_object_hash = __toESM(require("object-hash"));
5876
6055
  var import_react_dom3 = require("react-dom");
5877
- var import_jsx_runtime30 = require("react/jsx-runtime");
6056
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5878
6057
  var styleSelector = 'style, link[rel="stylesheet"]';
5879
6058
  var collectStyles = (doc) => {
5880
6059
  const collected = [];
@@ -5917,7 +6096,7 @@ var CopyHostStyles = ({
5917
6096
  onStylesLoaded = () => null
5918
6097
  }) => {
5919
6098
  const { document: doc, window: win } = useFrame();
5920
- (0, import_react37.useEffect)(() => {
6099
+ (0, import_react40.useEffect)(() => {
5921
6100
  if (!win || !doc) {
5922
6101
  return () => {
5923
6102
  };
@@ -6074,10 +6253,10 @@ var CopyHostStyles = ({
6074
6253
  observer.disconnect();
6075
6254
  };
6076
6255
  }, []);
6077
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
6256
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
6078
6257
  };
6079
- var autoFrameContext = (0, import_react37.createContext)({});
6080
- var useFrame = () => (0, import_react37.useContext)(autoFrameContext);
6258
+ var autoFrameContext = (0, import_react40.createContext)({});
6259
+ var useFrame = () => (0, import_react40.useContext)(autoFrameContext);
6081
6260
  function AutoFrame(_a) {
6082
6261
  var _b = _a, {
6083
6262
  children,
@@ -6094,10 +6273,10 @@ function AutoFrame(_a) {
6094
6273
  "onStylesLoaded",
6095
6274
  "frameRef"
6096
6275
  ]);
6097
- const [loaded, setLoaded] = (0, import_react37.useState)(false);
6098
- const [ctx, setCtx] = (0, import_react37.useState)({});
6099
- const [mountTarget, setMountTarget] = (0, import_react37.useState)();
6100
- (0, import_react37.useEffect)(() => {
6276
+ const [loaded, setLoaded] = (0, import_react40.useState)(false);
6277
+ const [ctx, setCtx] = (0, import_react40.useState)({});
6278
+ const [mountTarget, setMountTarget] = (0, import_react40.useState)();
6279
+ (0, import_react40.useEffect)(() => {
6101
6280
  var _a2;
6102
6281
  if (frameRef.current) {
6103
6282
  setCtx({
@@ -6109,7 +6288,7 @@ function AutoFrame(_a) {
6109
6288
  );
6110
6289
  }
6111
6290
  }, [frameRef, loaded]);
6112
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6291
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6113
6292
  "iframe",
6114
6293
  __spreadProps(__spreadValues({}, props), {
6115
6294
  className,
@@ -6119,7 +6298,7 @@ function AutoFrame(_a) {
6119
6298
  onLoad: () => {
6120
6299
  setLoaded(true);
6121
6300
  },
6122
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CopyHostStyles, { debug, onStylesLoaded, children: (0, import_react_dom3.createPortal)(children, mountTarget) }) })
6301
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CopyHostStyles, { debug, onStylesLoaded, children: (0, import_react_dom3.createPortal)(children, mountTarget) }) })
6123
6302
  })
6124
6303
  );
6125
6304
  }
@@ -6132,7 +6311,7 @@ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPrev
6132
6311
 
6133
6312
  // components/Render/index.tsx
6134
6313
  init_react_import();
6135
- var import_jsx_runtime31 = require("react/jsx-runtime");
6314
+ var import_jsx_runtime32 = require("react/jsx-runtime");
6136
6315
  function Render({
6137
6316
  config,
6138
6317
  data
@@ -6145,7 +6324,7 @@ function Render({
6145
6324
  const rootProps = defaultedData.root.props || defaultedData.root;
6146
6325
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
6147
6326
  if ((_a = config.root) == null ? void 0 : _a.render) {
6148
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6327
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6149
6328
  DropZoneProvider,
6150
6329
  {
6151
6330
  value: {
@@ -6155,7 +6334,7 @@ function Render({
6155
6334
  depth: 0,
6156
6335
  path: []
6157
6336
  },
6158
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6337
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6159
6338
  config.root.render,
6160
6339
  __spreadProps(__spreadValues({}, rootProps), {
6161
6340
  puck: {
@@ -6165,13 +6344,13 @@ function Render({
6165
6344
  title,
6166
6345
  editMode: false,
6167
6346
  id: "puck-root",
6168
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DropZone, { zone: rootDroppableId })
6347
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
6169
6348
  })
6170
6349
  )
6171
6350
  }
6172
6351
  );
6173
6352
  }
6174
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6353
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6175
6354
  DropZoneProvider,
6176
6355
  {
6177
6356
  value: {
@@ -6181,17 +6360,17 @@ function Render({
6181
6360
  depth: 0,
6182
6361
  path: []
6183
6362
  },
6184
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DropZone, { zone: rootDroppableId })
6363
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
6185
6364
  }
6186
6365
  );
6187
6366
  }
6188
6367
 
6189
6368
  // components/Puck/components/Preview/index.tsx
6190
- var import_jsx_runtime32 = require("react/jsx-runtime");
6369
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6191
6370
  var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
6192
6371
  var useBubbleIframeEvents = (ref) => {
6193
6372
  const { status } = useAppContext();
6194
- (0, import_react38.useEffect)(() => {
6373
+ (0, import_react41.useEffect)(() => {
6195
6374
  var _a;
6196
6375
  if (ref.current && status === "READY") {
6197
6376
  const iframe = ref.current;
@@ -6230,20 +6409,20 @@ var useBubbleIframeEvents = (ref) => {
6230
6409
  };
6231
6410
  var Preview2 = ({ id = "puck-preview" }) => {
6232
6411
  const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
6233
- const Page = (0, import_react38.useCallback)(
6412
+ const Page = (0, import_react41.useCallback)(
6234
6413
  (pageProps) => {
6235
6414
  var _a, _b;
6236
6415
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
6237
6416
  id: "puck-root"
6238
- }, pageProps)) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: pageProps.children });
6417
+ }, pageProps)) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
6239
6418
  },
6240
6419
  [config.root]
6241
6420
  );
6242
- const Frame = (0, import_react38.useMemo)(() => overrides.iframe, [overrides]);
6421
+ const Frame = (0, import_react41.useMemo)(() => overrides.iframe, [overrides]);
6243
6422
  const rootProps = state.data.root.props || state.data.root;
6244
- const ref = (0, import_react38.useRef)(null);
6423
+ const ref = (0, import_react41.useRef)(null);
6245
6424
  useBubbleIframeEvents(ref);
6246
- const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6425
+ const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6247
6426
  Page,
6248
6427
  __spreadProps(__spreadValues({}, rootProps), {
6249
6428
  puck: {
@@ -6252,10 +6431,10 @@ var Preview2 = ({ id = "puck-preview" }) => {
6252
6431
  dragRef: null
6253
6432
  },
6254
6433
  editMode: true,
6255
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
6434
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
6256
6435
  })
6257
- ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Render, { data: state.data, config });
6258
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6436
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Render, { data: state.data, config });
6437
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6259
6438
  "div",
6260
6439
  {
6261
6440
  className: getClassName23(),
@@ -6264,7 +6443,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
6264
6443
  onClick: () => {
6265
6444
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
6266
6445
  },
6267
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6446
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6268
6447
  AutoFrame_default,
6269
6448
  {
6270
6449
  id: "preview-frame",
@@ -6274,14 +6453,14 @@ var Preview2 = ({ id = "puck-preview" }) => {
6274
6453
  setStatus("READY");
6275
6454
  },
6276
6455
  frameRef: ref,
6277
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
6456
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
6278
6457
  if (Frame) {
6279
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Frame, { document: document2, children: inner });
6458
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame, { document: document2, children: inner });
6280
6459
  }
6281
6460
  return inner;
6282
6461
  } })
6283
6462
  }
6284
- ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6463
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6285
6464
  "div",
6286
6465
  {
6287
6466
  id: "preview-frame",
@@ -6338,7 +6517,7 @@ var scrollIntoView = (el) => {
6338
6517
  };
6339
6518
 
6340
6519
  // components/LayerTree/index.tsx
6341
- var import_react39 = require("react");
6520
+ var import_react42 = require("react");
6342
6521
 
6343
6522
  // lib/is-child-of-zone.ts
6344
6523
  init_react_import();
@@ -6371,7 +6550,7 @@ var onScrollEnd = (frame, cb) => {
6371
6550
  };
6372
6551
 
6373
6552
  // components/LayerTree/index.tsx
6374
- var import_jsx_runtime33 = require("react/jsx-runtime");
6553
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6375
6554
  var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
6376
6555
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
6377
6556
  var LayerTree = ({
@@ -6384,15 +6563,15 @@ var LayerTree = ({
6384
6563
  label
6385
6564
  }) => {
6386
6565
  const zones = data.zones || {};
6387
- const ctx = (0, import_react39.useContext)(dropZoneContext);
6388
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6389
- label && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
6390
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Layers, { size: "16" }) }),
6566
+ const ctx = (0, import_react42.useContext)(dropZoneContext);
6567
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6568
+ label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
6569
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
6391
6570
  " ",
6392
6571
  label
6393
6572
  ] }),
6394
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("ul", { className: getClassName24(), children: [
6395
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
6573
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
6574
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
6396
6575
  zoneContent.map((item, i) => {
6397
6576
  var _a;
6398
6577
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
@@ -6405,7 +6584,7 @@ var LayerTree = ({
6405
6584
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
6406
6585
  const componentConfig = config.components[item.type];
6407
6586
  const label2 = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : item.type.toString();
6408
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6587
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6409
6588
  "li",
6410
6589
  {
6411
6590
  className: getClassNameLayer({
@@ -6415,7 +6594,7 @@ var LayerTree = ({
6415
6594
  childIsSelected
6416
6595
  }),
6417
6596
  children: [
6418
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6597
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6419
6598
  "button",
6420
6599
  {
6421
6600
  type: "button",
@@ -6454,22 +6633,22 @@ var LayerTree = ({
6454
6633
  setHoveringComponent(null);
6455
6634
  },
6456
6635
  children: [
6457
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6636
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6458
6637
  "div",
6459
6638
  {
6460
6639
  className: getClassNameLayer("chevron"),
6461
6640
  title: isSelected ? "Collapse" : "Expand",
6462
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChevronDown, { size: "12" })
6641
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
6463
6642
  }
6464
6643
  ),
6465
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassNameLayer("title"), children: [
6466
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LayoutGrid, { size: "16" }) }),
6467
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
6644
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
6645
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayoutGrid, { size: "16" }) }),
6646
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
6468
6647
  ] })
6469
6648
  ]
6470
6649
  }
6471
6650
  ) }),
6472
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6651
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6473
6652
  LayerTree,
6474
6653
  {
6475
6654
  config,
@@ -6491,13 +6670,13 @@ var LayerTree = ({
6491
6670
  };
6492
6671
 
6493
6672
  // components/Puck/components/Outline/index.tsx
6494
- var import_react40 = require("react");
6495
- var import_jsx_runtime34 = require("react/jsx-runtime");
6673
+ var import_react43 = require("react");
6674
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6496
6675
  var Outline = () => {
6497
6676
  const { dispatch, state, overrides, config } = useAppContext();
6498
6677
  const { data, ui } = state;
6499
6678
  const { itemSelector } = ui;
6500
- const setItemSelector = (0, import_react40.useCallback)(
6679
+ const setItemSelector = (0, import_react43.useCallback)(
6501
6680
  (newItemSelector) => {
6502
6681
  dispatch({
6503
6682
  type: "setUi",
@@ -6506,9 +6685,9 @@ var Outline = () => {
6506
6685
  },
6507
6686
  []
6508
6687
  );
6509
- const Wrapper = (0, import_react40.useMemo)(() => overrides.outline || "div", [overrides]);
6510
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6511
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6688
+ const Wrapper = (0, import_react43.useMemo)(() => overrides.outline || "div", [overrides]);
6689
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
6690
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6512
6691
  LayerTree,
6513
6692
  {
6514
6693
  config,
@@ -6521,7 +6700,7 @@ var Outline = () => {
6521
6700
  ),
6522
6701
  Object.entries(findZonesForArea(data, "root")).map(
6523
6702
  ([zoneKey, zone]) => {
6524
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6703
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6525
6704
  LayerTree,
6526
6705
  {
6527
6706
  config,
@@ -6620,19 +6799,19 @@ function usePuckHistory({
6620
6799
 
6621
6800
  // lib/use-history-store.ts
6622
6801
  init_react_import();
6623
- var import_react41 = require("react");
6802
+ var import_react44 = require("react");
6624
6803
  var import_use_debounce3 = require("use-debounce");
6625
6804
  var EMPTY_HISTORY_INDEX = 0;
6626
6805
  function useHistoryStore(initialHistory) {
6627
6806
  var _a, _b;
6628
- const [histories, setHistories] = (0, import_react41.useState)(
6807
+ const [histories, setHistories] = (0, import_react44.useState)(
6629
6808
  (_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
6630
6809
  );
6631
6810
  const updateHistories = (histories2) => {
6632
6811
  setHistories(histories2);
6633
6812
  setIndex(histories2.length - 1);
6634
6813
  };
6635
- const [index, setIndex] = (0, import_react41.useState)(
6814
+ const [index, setIndex] = (0, import_react44.useState)(
6636
6815
  (_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
6637
6816
  );
6638
6817
  const hasPast = index > EMPTY_HISTORY_INDEX;
@@ -6792,22 +6971,22 @@ var getBox = function getBox2(el) {
6792
6971
  };
6793
6972
 
6794
6973
  // components/Puck/components/Canvas/index.tsx
6795
- var import_react43 = require("react");
6974
+ var import_react46 = require("react");
6796
6975
 
6797
6976
  // components/ViewportControls/index.tsx
6798
6977
  init_react_import();
6799
- var import_react42 = require("react");
6978
+ var import_react45 = require("react");
6800
6979
 
6801
6980
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
6802
6981
  init_react_import();
6803
6982
  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" };
6804
6983
 
6805
6984
  // components/ViewportControls/index.tsx
6806
- var import_jsx_runtime35 = require("react/jsx-runtime");
6985
+ var import_jsx_runtime36 = require("react/jsx-runtime");
6807
6986
  var icons = {
6808
- Smartphone: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Smartphone, { size: 16 }),
6809
- Tablet: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Tablet, { size: 16 }),
6810
- Monitor: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Monitor, { size: 16 })
6987
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
6988
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
6989
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
6811
6990
  };
6812
6991
  var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
6813
6992
  var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
@@ -6819,11 +6998,11 @@ var ViewportButton = ({
6819
6998
  onClick
6820
6999
  }) => {
6821
7000
  const { state } = useAppContext();
6822
- const [isActive, setIsActive] = (0, import_react42.useState)(false);
6823
- (0, import_react42.useEffect)(() => {
7001
+ const [isActive, setIsActive] = (0, import_react45.useState)(false);
7002
+ (0, import_react45.useEffect)(() => {
6824
7003
  setIsActive(width === state.ui.viewports.current.width);
6825
7004
  }, [width, state.ui.viewports.current.width]);
6826
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7005
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6827
7006
  IconButton,
6828
7007
  {
6829
7008
  title,
@@ -6832,7 +7011,7 @@ var ViewportButton = ({
6832
7011
  e.stopPropagation();
6833
7012
  onClick({ width, height });
6834
7013
  },
6835
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: getClassNameButton("inner"), children })
7014
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
6836
7015
  }
6837
7016
  ) });
6838
7017
  };
@@ -6856,7 +7035,7 @@ var ViewportControls = ({
6856
7035
  const defaultsContainAutoZoom = defaultZoomOptions.find(
6857
7036
  (option) => option.value === autoZoom
6858
7037
  );
6859
- const zoomOptions = (0, import_react42.useMemo)(
7038
+ const zoomOptions = (0, import_react45.useMemo)(
6860
7039
  () => [
6861
7040
  ...defaultZoomOptions,
6862
7041
  ...defaultsContainAutoZoom ? [] : [
@@ -6868,8 +7047,8 @@ var ViewportControls = ({
6868
7047
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
6869
7048
  [autoZoom]
6870
7049
  );
6871
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25(), children: [
6872
- viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7050
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
7051
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6873
7052
  ViewportButton,
6874
7053
  {
6875
7054
  height: viewport.height,
@@ -6880,8 +7059,8 @@ var ViewportControls = ({
6880
7059
  },
6881
7060
  i
6882
7061
  )),
6883
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("divider") }),
6884
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7062
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
7063
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6885
7064
  IconButton,
6886
7065
  {
6887
7066
  title: "Zoom viewport out",
@@ -6895,10 +7074,10 @@ var ViewportControls = ({
6895
7074
  )].value
6896
7075
  );
6897
7076
  },
6898
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ZoomOut, { size: 16 })
7077
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
6899
7078
  }
6900
7079
  ),
6901
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7080
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6902
7081
  IconButton,
6903
7082
  {
6904
7083
  title: "Zoom viewport in",
@@ -6912,11 +7091,11 @@ var ViewportControls = ({
6912
7091
  )].value
6913
7092
  );
6914
7093
  },
6915
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ZoomIn, { size: 16 })
7094
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
6916
7095
  }
6917
7096
  ),
6918
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("divider") }),
6919
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7097
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
7098
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6920
7099
  "select",
6921
7100
  {
6922
7101
  className: getClassName25("zoomSelect"),
@@ -6924,7 +7103,7 @@ var ViewportControls = ({
6924
7103
  onChange: (e) => {
6925
7104
  onZoom(parseFloat(e.currentTarget.value));
6926
7105
  },
6927
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7106
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6928
7107
  "option",
6929
7108
  {
6930
7109
  value: option.value,
@@ -6972,24 +7151,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
6972
7151
  };
6973
7152
 
6974
7153
  // components/Puck/components/Canvas/index.tsx
6975
- var import_jsx_runtime36 = require("react/jsx-runtime");
7154
+ var import_jsx_runtime37 = require("react/jsx-runtime");
6976
7155
  var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
6977
7156
  var ZOOM_ON_CHANGE = true;
6978
7157
  var Canvas = () => {
6979
7158
  const { status, iframe } = useAppContext();
6980
7159
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
6981
7160
  const { ui } = state;
6982
- const frameRef = (0, import_react43.useRef)(null);
6983
- const [showTransition, setShowTransition] = (0, import_react43.useState)(false);
6984
- const defaultRender = (0, import_react43.useMemo)(() => {
6985
- const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
7161
+ const frameRef = (0, import_react46.useRef)(null);
7162
+ const [showTransition, setShowTransition] = (0, import_react46.useState)(false);
7163
+ const defaultRender = (0, import_react46.useMemo)(() => {
7164
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
6986
7165
  return PuckDefault;
6987
7166
  }, []);
6988
- const CustomPreview = (0, import_react43.useMemo)(
7167
+ const CustomPreview = (0, import_react46.useMemo)(
6989
7168
  () => overrides.preview || defaultRender,
6990
7169
  [overrides]
6991
7170
  );
6992
- const getFrameDimensions = (0, import_react43.useCallback)(() => {
7171
+ const getFrameDimensions = (0, import_react46.useCallback)(() => {
6993
7172
  if (frameRef.current) {
6994
7173
  const frame = frameRef.current;
6995
7174
  const box = getBox(frame);
@@ -6997,7 +7176,7 @@ var Canvas = () => {
6997
7176
  }
6998
7177
  return { width: 0, height: 0 };
6999
7178
  }, [frameRef]);
7000
- const resetAutoZoom = (0, import_react43.useCallback)(
7179
+ const resetAutoZoom = (0, import_react46.useCallback)(
7001
7180
  (ui2 = state.ui) => {
7002
7181
  if (frameRef.current) {
7003
7182
  setZoomConfig(
@@ -7007,11 +7186,11 @@ var Canvas = () => {
7007
7186
  },
7008
7187
  [frameRef, zoomConfig, state.ui]
7009
7188
  );
7010
- (0, import_react43.useEffect)(() => {
7189
+ (0, import_react46.useEffect)(() => {
7011
7190
  setShowTransition(false);
7012
7191
  resetAutoZoom();
7013
7192
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
7014
- (0, import_react43.useEffect)(() => {
7193
+ (0, import_react46.useEffect)(() => {
7015
7194
  const { height: frameHeight } = getFrameDimensions();
7016
7195
  if (ui.viewports.current.height === "auto") {
7017
7196
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -7019,13 +7198,13 @@ var Canvas = () => {
7019
7198
  }));
7020
7199
  }
7021
7200
  }, [zoomConfig.zoom]);
7022
- (0, import_react43.useEffect)(() => {
7201
+ (0, import_react46.useEffect)(() => {
7023
7202
  if (ZOOM_ON_CHANGE) {
7024
7203
  setShowTransition(true);
7025
7204
  resetAutoZoom(ui);
7026
7205
  }
7027
7206
  }, [ui.viewports.current.width]);
7028
- (0, import_react43.useEffect)(() => {
7207
+ (0, import_react46.useEffect)(() => {
7029
7208
  const cb = () => {
7030
7209
  setShowTransition(false);
7031
7210
  resetAutoZoom();
@@ -7035,13 +7214,13 @@ var Canvas = () => {
7035
7214
  window.removeEventListener("resize", cb);
7036
7215
  };
7037
7216
  }, []);
7038
- const [showLoader, setShowLoader] = (0, import_react43.useState)(false);
7039
- (0, import_react43.useEffect)(() => {
7217
+ const [showLoader, setShowLoader] = (0, import_react46.useState)(false);
7218
+ (0, import_react46.useEffect)(() => {
7040
7219
  setTimeout(() => {
7041
7220
  setShowLoader(true);
7042
7221
  }, 500);
7043
7222
  }, []);
7044
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
7223
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7045
7224
  "div",
7046
7225
  {
7047
7226
  className: getClassName26({
@@ -7054,7 +7233,7 @@ var Canvas = () => {
7054
7233
  recordHistory: true
7055
7234
  }),
7056
7235
  children: [
7057
- ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7236
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7058
7237
  ViewportControls,
7059
7238
  {
7060
7239
  autoZoom: zoomConfig.autoZoom,
@@ -7080,8 +7259,8 @@ var Canvas = () => {
7080
7259
  }
7081
7260
  }
7082
7261
  ) }),
7083
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
7084
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7262
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
7263
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7085
7264
  "div",
7086
7265
  {
7087
7266
  className: getClassName26("root"),
@@ -7102,10 +7281,10 @@ var Canvas = () => {
7102
7281
  })
7103
7282
  );
7104
7283
  },
7105
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Preview2, {}) })
7284
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview2, {}) })
7106
7285
  }
7107
7286
  ),
7108
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Loader, { size: 24 }) })
7287
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Loader, { size: 24 }) })
7109
7288
  ] })
7110
7289
  ]
7111
7290
  }
@@ -7114,7 +7293,7 @@ var Canvas = () => {
7114
7293
 
7115
7294
  // lib/use-loaded-overrides.ts
7116
7295
  init_react_import();
7117
- var import_react44 = require("react");
7296
+ var import_react47 = require("react");
7118
7297
 
7119
7298
  // lib/load-overrides.ts
7120
7299
  init_react_import();
@@ -7153,26 +7332,26 @@ var useLoadedOverrides = ({
7153
7332
  overrides,
7154
7333
  plugins
7155
7334
  }) => {
7156
- return (0, import_react44.useMemo)(() => {
7335
+ return (0, import_react47.useMemo)(() => {
7157
7336
  return loadOverrides({ overrides, plugins });
7158
7337
  }, [plugins, overrides]);
7159
7338
  };
7160
7339
 
7161
7340
  // components/DefaultOverride/index.tsx
7162
7341
  init_react_import();
7163
- var import_jsx_runtime37 = require("react/jsx-runtime");
7164
- var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
7342
+ var import_jsx_runtime38 = require("react/jsx-runtime");
7343
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children });
7165
7344
 
7166
7345
  // lib/use-inject-css.ts
7167
7346
  init_react_import();
7168
- var import_react45 = require("react");
7347
+ var import_react48 = require("react");
7169
7348
  var styles = ``;
7170
7349
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7171
- const [el, setEl] = (0, import_react45.useState)();
7172
- (0, import_react45.useEffect)(() => {
7350
+ const [el, setEl] = (0, import_react48.useState)();
7351
+ (0, import_react48.useEffect)(() => {
7173
7352
  setEl(document.createElement("style"));
7174
7353
  }, []);
7175
- (0, import_react45.useEffect)(() => {
7354
+ (0, import_react48.useEffect)(() => {
7176
7355
  var _a;
7177
7356
  if (!el || typeof window === "undefined") {
7178
7357
  return;
@@ -7192,10 +7371,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
7192
7371
 
7193
7372
  // lib/use-preview-mode-hotkeys.ts
7194
7373
  init_react_import();
7195
- var import_react46 = require("react");
7374
+ var import_react49 = require("react");
7196
7375
  var import_react_hotkeys_hook2 = require("react-hotkeys-hook");
7197
7376
  var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
7198
- const toggleInteractive = (0, import_react46.useCallback)(() => {
7377
+ const toggleInteractive = (0, import_react49.useCallback)(() => {
7199
7378
  dispatch({
7200
7379
  type: "setUi",
7201
7380
  ui: (ui) => ({
@@ -7218,7 +7397,7 @@ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
7218
7397
  };
7219
7398
 
7220
7399
  // components/Puck/index.tsx
7221
- var import_jsx_runtime38 = require("react/jsx-runtime");
7400
+ var import_jsx_runtime39 = require("react/jsx-runtime");
7222
7401
  var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
7223
7402
  var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
7224
7403
  function Puck({
@@ -7247,7 +7426,7 @@ function Puck({
7247
7426
  waitForStyles: true
7248
7427
  }, _iframe);
7249
7428
  useInjectGlobalCss(iframe.enabled);
7250
- const [generatedAppState] = (0, import_react47.useState)(() => {
7429
+ const [generatedAppState] = (0, import_react50.useState)(() => {
7251
7430
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
7252
7431
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
7253
7432
  let clientUiState = {};
@@ -7319,14 +7498,14 @@ function Puck({
7319
7498
  histories,
7320
7499
  index: initialHistoryIndex
7321
7500
  });
7322
- const [reducer] = (0, import_react47.useState)(
7501
+ const [reducer] = (0, import_react50.useState)(
7323
7502
  () => createReducer({
7324
7503
  config,
7325
7504
  record: historyStore.record,
7326
7505
  onAction
7327
7506
  })
7328
7507
  );
7329
- const [appState, dispatch] = (0, import_react47.useReducer)(
7508
+ const [appState, dispatch] = (0, import_react50.useReducer)(
7330
7509
  reducer,
7331
7510
  flushZones(initialAppState)
7332
7511
  );
@@ -7337,14 +7516,14 @@ function Puck({
7337
7516
  historyStore,
7338
7517
  iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
7339
7518
  });
7340
- const [menuOpen, setMenuOpen] = (0, import_react47.useState)(false);
7519
+ const [menuOpen, setMenuOpen] = (0, import_react50.useState)(false);
7341
7520
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
7342
7521
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
7343
- (0, import_react47.useEffect)(() => {
7522
+ (0, import_react50.useEffect)(() => {
7344
7523
  if (onChange) onChange(data);
7345
7524
  }, [data]);
7346
7525
  const rootProps = data.root.props || data.root;
7347
- const toggleSidebars = (0, import_react47.useCallback)(
7526
+ const toggleSidebars = (0, import_react50.useCallback)(
7348
7527
  (sidebar) => {
7349
7528
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
7350
7529
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -7358,7 +7537,7 @@ function Puck({
7358
7537
  },
7359
7538
  [dispatch, leftSideBarVisible, rightSideBarVisible]
7360
7539
  );
7361
- (0, import_react47.useEffect)(() => {
7540
+ (0, import_react50.useEffect)(() => {
7362
7541
  if (!window.matchMedia("(min-width: 638px)").matches) {
7363
7542
  dispatch({
7364
7543
  type: "setUi",
@@ -7381,7 +7560,7 @@ function Puck({
7381
7560
  window.removeEventListener("resize", handleResize);
7382
7561
  };
7383
7562
  }, []);
7384
- const defaultHeaderRender = (0, import_react47.useMemo)(() => {
7563
+ const defaultHeaderRender = (0, import_react50.useMemo)(() => {
7385
7564
  if (renderHeader) {
7386
7565
  console.warn(
7387
7566
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -7389,20 +7568,20 @@ function Puck({
7389
7568
  const RenderHeader = (_a2) => {
7390
7569
  var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
7391
7570
  const Comp = renderHeader;
7392
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7571
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7393
7572
  };
7394
7573
  return RenderHeader;
7395
7574
  }
7396
7575
  return DefaultOverride;
7397
7576
  }, [renderHeader]);
7398
- const defaultHeaderActionsRender = (0, import_react47.useMemo)(() => {
7577
+ const defaultHeaderActionsRender = (0, import_react50.useMemo)(() => {
7399
7578
  if (renderHeaderActions) {
7400
7579
  console.warn(
7401
7580
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
7402
7581
  );
7403
7582
  const RenderHeader = (props) => {
7404
7583
  const Comp = renderHeaderActions;
7405
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7584
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7406
7585
  };
7407
7586
  return RenderHeader;
7408
7587
  }
@@ -7412,27 +7591,27 @@ function Puck({
7412
7591
  overrides,
7413
7592
  plugins
7414
7593
  });
7415
- const CustomPuck = (0, import_react47.useMemo)(
7594
+ const CustomPuck = (0, import_react50.useMemo)(
7416
7595
  () => loadedOverrides.puck || DefaultOverride,
7417
7596
  [loadedOverrides]
7418
7597
  );
7419
- const CustomHeader = (0, import_react47.useMemo)(
7598
+ const CustomHeader = (0, import_react50.useMemo)(
7420
7599
  () => loadedOverrides.header || defaultHeaderRender,
7421
7600
  [loadedOverrides]
7422
7601
  );
7423
- const CustomHeaderActions = (0, import_react47.useMemo)(
7602
+ const CustomHeaderActions = (0, import_react50.useMemo)(
7424
7603
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
7425
7604
  [loadedOverrides]
7426
7605
  );
7427
- const [mounted, setMounted] = (0, import_react47.useState)(false);
7428
- (0, import_react47.useEffect)(() => {
7606
+ const [mounted, setMounted] = (0, import_react50.useState)(false);
7607
+ (0, import_react50.useEffect)(() => {
7429
7608
  setMounted(true);
7430
7609
  }, []);
7431
7610
  const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
7432
7611
  const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
7433
7612
  usePreviewModeHotkeys(dispatch, iframe.enabled);
7434
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
7435
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7613
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
7614
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7436
7615
  AppProvider,
7437
7616
  {
7438
7617
  value: {
@@ -7454,7 +7633,7 @@ function Puck({
7454
7633
  getPermissions: () => ({}),
7455
7634
  refreshPermissions: () => null
7456
7635
  },
7457
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7636
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7458
7637
  "div",
7459
7638
  {
7460
7639
  className: getLayoutClassName({
@@ -7463,60 +7642,60 @@ function Puck({
7463
7642
  mounted,
7464
7643
  rightSideBarVisible
7465
7644
  }),
7466
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("inner"), children: [
7467
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7645
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("inner"), children: [
7646
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7468
7647
  CustomHeader,
7469
7648
  {
7470
- actions: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7649
+ actions: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7471
7650
  Button,
7472
7651
  {
7473
7652
  onClick: () => {
7474
7653
  onPublish && onPublish(data);
7475
7654
  },
7476
- icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
7655
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
7477
7656
  children: "Publish"
7478
7657
  }
7479
7658
  ) }) }),
7480
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
7481
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
7482
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7659
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
7660
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
7661
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7483
7662
  "div",
7484
7663
  {
7485
7664
  className: getLayoutClassName("leftSideBarToggle"),
7486
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7665
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7487
7666
  IconButton,
7488
7667
  {
7489
7668
  onClick: () => {
7490
7669
  toggleSidebars("left");
7491
7670
  },
7492
7671
  title: "Toggle left sidebar",
7493
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
7672
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelLeft, { focusable: "false" })
7494
7673
  }
7495
7674
  )
7496
7675
  }
7497
7676
  ),
7498
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7677
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7499
7678
  "div",
7500
7679
  {
7501
7680
  className: getLayoutClassName("rightSideBarToggle"),
7502
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7681
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7503
7682
  IconButton,
7504
7683
  {
7505
7684
  onClick: () => {
7506
7685
  toggleSidebars("right");
7507
7686
  },
7508
7687
  title: "Toggle right sidebar",
7509
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
7688
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelRight, { focusable: "false" })
7510
7689
  }
7511
7690
  )
7512
7691
  }
7513
7692
  )
7514
7693
  ] }),
7515
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading, { rank: "2", size: "xs", children: [
7694
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Heading, { rank: "2", size: "xs", children: [
7516
7695
  headerTitle || rootProps.title || "Page",
7517
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
7696
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
7518
7697
  " ",
7519
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7698
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7520
7699
  "code",
7521
7700
  {
7522
7701
  className: getLayoutClassName("headerPath"),
@@ -7525,31 +7704,31 @@ function Puck({
7525
7704
  )
7526
7705
  ] })
7527
7706
  ] }) }),
7528
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
7529
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7707
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
7708
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7530
7709
  IconButton,
7531
7710
  {
7532
7711
  onClick: () => {
7533
7712
  return setMenuOpen(!menuOpen);
7534
7713
  },
7535
7714
  title: "Toggle menu bar",
7536
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { focusable: "false" })
7715
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronDown, { focusable: "false" })
7537
7716
  }
7538
7717
  ) }),
7539
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7718
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7540
7719
  MenuBar,
7541
7720
  {
7542
7721
  appState,
7543
7722
  dispatch,
7544
7723
  onPublish,
7545
7724
  menuOpen,
7546
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7725
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7547
7726
  Button,
7548
7727
  {
7549
7728
  onClick: () => {
7550
7729
  onPublish && onPublish(data);
7551
7730
  },
7552
- icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
7731
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
7553
7732
  children: "Publish"
7554
7733
  }
7555
7734
  ) }),
@@ -7560,19 +7739,19 @@ function Puck({
7560
7739
  ] }) })
7561
7740
  }
7562
7741
  ),
7563
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
7564
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Components, {}) }),
7565
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Outline, {}) })
7742
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
7743
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Components, {}) }),
7744
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Outline, {}) })
7566
7745
  ] }),
7567
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Canvas, {}),
7568
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7746
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Canvas, {}),
7747
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7569
7748
  SidebarSection,
7570
7749
  {
7571
7750
  noPadding: true,
7572
7751
  noBorderTop: true,
7573
7752
  showBreadcrumbs: true,
7574
7753
  title: selectedItem ? selectedComponentLabel : "Page",
7575
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {})
7754
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Fields, {})
7576
7755
  }
7577
7756
  ) })
7578
7757
  ] })
@@ -7580,7 +7759,7 @@ function Puck({
7580
7759
  ) }) })
7581
7760
  }
7582
7761
  ),
7583
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
7762
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
7584
7763
  ] });
7585
7764
  }
7586
7765
  Puck.Components = Components;