@measured/puck 0.14.0-canary.3df6d96 → 0.14.0-canary.4c77ac5

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -8084,7 +8084,7 @@ var require_react_dom_development = __commonJS({
8084
8084
  var HostPortal = 4;
8085
8085
  var HostComponent = 5;
8086
8086
  var HostText = 6;
8087
- var Fragment13 = 7;
8087
+ var Fragment14 = 7;
8088
8088
  var Mode = 8;
8089
8089
  var ContextConsumer = 9;
8090
8090
  var ContextProvider = 10;
@@ -8264,8 +8264,8 @@ var require_react_dom_development = __commonJS({
8264
8264
  if (propertyInfo !== null) {
8265
8265
  return !propertyInfo.acceptsBooleans;
8266
8266
  } else {
8267
- var prefix2 = name.toLowerCase().slice(0, 5);
8268
- return prefix2 !== "data-" && prefix2 !== "aria-";
8267
+ var prefix3 = name.toLowerCase().slice(0, 5);
8268
+ return prefix3 !== "data-" && prefix3 !== "aria-";
8269
8269
  }
8270
8270
  }
8271
8271
  default:
@@ -8937,18 +8937,18 @@ var require_react_dom_development = __commonJS({
8937
8937
  }
8938
8938
  }
8939
8939
  var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
8940
- var prefix;
8940
+ var prefix2;
8941
8941
  function describeBuiltInComponentFrame(name, source, ownerFn) {
8942
8942
  {
8943
- if (prefix === void 0) {
8943
+ if (prefix2 === void 0) {
8944
8944
  try {
8945
8945
  throw Error();
8946
8946
  } catch (x) {
8947
8947
  var match = x.stack.trim().match(/\n( *(at )?)/);
8948
- prefix = match && match[1] || "";
8948
+ prefix2 = match && match[1] || "";
8949
8949
  }
8950
8950
  }
8951
- return "\n" + prefix + name;
8951
+ return "\n" + prefix2 + name;
8952
8952
  }
8953
8953
  }
8954
8954
  var reentry = false;
@@ -9240,7 +9240,7 @@ var require_react_dom_development = __commonJS({
9240
9240
  return "DehydratedFragment";
9241
9241
  case ForwardRef:
9242
9242
  return getWrappedName$1(type, type.render, "ForwardRef");
9243
- case Fragment13:
9243
+ case Fragment14:
9244
9244
  return "Fragment";
9245
9245
  case HostComponent:
9246
9246
  return type;
@@ -10033,13 +10033,13 @@ var require_react_dom_development = __commonJS({
10033
10033
  strokeOpacity: true,
10034
10034
  strokeWidth: true
10035
10035
  };
10036
- function prefixKey(prefix2, key) {
10037
- return prefix2 + key.charAt(0).toUpperCase() + key.substring(1);
10036
+ function prefixKey(prefix3, key) {
10037
+ return prefix3 + key.charAt(0).toUpperCase() + key.substring(1);
10038
10038
  }
10039
10039
  var prefixes = ["Webkit", "ms", "Moz", "O"];
10040
10040
  Object.keys(isUnitlessNumber).forEach(function(prop) {
10041
- prefixes.forEach(function(prefix2) {
10042
- isUnitlessNumber[prefixKey(prefix2, prop)] = isUnitlessNumber[prop];
10041
+ prefixes.forEach(function(prefix3) {
10042
+ isUnitlessNumber[prefixKey(prefix3, prop)] = isUnitlessNumber[prop];
10043
10043
  });
10044
10044
  });
10045
10045
  function dangerousStyleValue(name, value, isCustomProperty) {
@@ -18911,7 +18911,7 @@ var require_react_dom_development = __commonJS({
18911
18911
  }
18912
18912
  }
18913
18913
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
18914
- if (current2 === null || current2.tag !== Fragment13) {
18914
+ if (current2 === null || current2.tag !== Fragment14) {
18915
18915
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
18916
18916
  created.return = returnFiber;
18917
18917
  return created;
@@ -19314,7 +19314,7 @@ var require_react_dom_development = __commonJS({
19314
19314
  if (child.key === key) {
19315
19315
  var elementType = element.type;
19316
19316
  if (elementType === REACT_FRAGMENT_TYPE) {
19317
- if (child.tag === Fragment13) {
19317
+ if (child.tag === Fragment14) {
19318
19318
  deleteRemainingChildren(returnFiber, child.sibling);
19319
19319
  var existing = useFiber(child, element.props.children);
19320
19320
  existing.return = returnFiber;
@@ -23489,7 +23489,7 @@ var require_react_dom_development = __commonJS({
23489
23489
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
23490
23490
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
23491
23491
  }
23492
- case Fragment13:
23492
+ case Fragment14:
23493
23493
  return updateFragment(current2, workInProgress2, renderLanes2);
23494
23494
  case Mode:
23495
23495
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -23762,7 +23762,7 @@ var require_react_dom_development = __commonJS({
23762
23762
  case SimpleMemoComponent:
23763
23763
  case FunctionComponent:
23764
23764
  case ForwardRef:
23765
- case Fragment13:
23765
+ case Fragment14:
23766
23766
  case Mode:
23767
23767
  case Profiler:
23768
23768
  case ContextConsumer:
@@ -28021,7 +28021,7 @@ var require_react_dom_development = __commonJS({
28021
28021
  return fiber;
28022
28022
  }
28023
28023
  function createFiberFromFragment(elements, mode, lanes, key) {
28024
- var fiber = createFiber(Fragment13, elements, key, mode);
28024
+ var fiber = createFiber(Fragment14, elements, key, mode);
28025
28025
  fiber.lanes = lanes;
28026
28026
  return fiber;
28027
28027
  }
@@ -29264,7 +29264,7 @@ var Button = ({
29264
29264
 
29265
29265
  // components/Drawer/index.tsx
29266
29266
  init_react_import();
29267
- var import_dnd2 = require("@hello-pangea/dnd");
29267
+ var import_dnd2 = require("@measured/dnd");
29268
29268
 
29269
29269
  // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
29270
29270
  init_react_import();
@@ -29272,7 +29272,7 @@ var styles_module_default = { "Drawer": "_Drawer_6zh0b_1", "DrawerItem-default":
29272
29272
 
29273
29273
  // components/Draggable/index.tsx
29274
29274
  init_react_import();
29275
- var import_dnd = require("@hello-pangea/dnd");
29275
+ var import_dnd = require("@measured/dnd");
29276
29276
  var import_jsx_runtime2 = require("react/jsx-runtime");
29277
29277
  var Draggable = ({
29278
29278
  className,
@@ -29382,6 +29382,7 @@ var DrawerItem = ({
29382
29382
  name,
29383
29383
  children,
29384
29384
  id,
29385
+ label,
29385
29386
  index
29386
29387
  }) => {
29387
29388
  const ctx = (0, import_react3.useContext)(drawerContext);
@@ -29391,7 +29392,7 @@ var DrawerItem = ({
29391
29392
  [children]
29392
29393
  );
29393
29394
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29394
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("name"), children: name }),
29395
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("name"), children: label != null ? label : name }),
29395
29396
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DragIcon, {}) })
29396
29397
  ] }) }) }) });
29397
29398
  };
@@ -29422,12 +29423,12 @@ var import_react9 = require("react");
29422
29423
 
29423
29424
  // components/DraggableComponent/index.tsx
29424
29425
  init_react_import();
29425
- var import_react6 = require("react");
29426
- var import_dnd3 = require("@hello-pangea/dnd");
29426
+ var import_react7 = require("react");
29427
+ var import_dnd3 = require("@measured/dnd");
29427
29428
 
29428
29429
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
29429
29430
  init_react_import();
29430
- var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_1vpvt_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_1vpvt_10", "DraggableComponent-contents": "_DraggableComponent-contents_1vpvt_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_1vpvt_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1vpvt_42", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1vpvt_58", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_1vpvt_64", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1vpvt_69", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_1vpvt_74", "DraggableComponent-actions": "_DraggableComponent-actions_1vpvt_100", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_1vpvt_125", "DraggableComponent-action": "_DraggableComponent-action_1vpvt_100" };
29431
+ var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_175tf_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_175tf_11", "DraggableComponent-contents": "_DraggableComponent-contents_175tf_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_175tf_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_175tf_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_175tf_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_175tf_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_175tf_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_175tf_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_175tf_97", "DraggableComponent-actions": "_DraggableComponent-actions_175tf_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_175tf_127", "DraggableComponent-action": "_DraggableComponent-action_175tf_97" };
29431
29432
 
29432
29433
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
29433
29434
  init_react_import();
@@ -29579,6 +29580,14 @@ var Lock = createLucideIcon("Lock", [
29579
29580
  ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
29580
29581
  ]);
29581
29582
 
29583
+ // ../../node_modules/lucide-react/dist/esm/icons/monitor.js
29584
+ init_react_import();
29585
+ var Monitor = createLucideIcon("Monitor", [
29586
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
29587
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
29588
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
29589
+ ]);
29590
+
29582
29591
  // ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
29583
29592
  init_react_import();
29584
29593
  var MoreVertical = createLucideIcon("MoreVertical", [
@@ -29629,6 +29638,20 @@ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
29629
29638
  ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
29630
29639
  ]);
29631
29640
 
29641
+ // ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
29642
+ init_react_import();
29643
+ var Smartphone = createLucideIcon("Smartphone", [
29644
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
29645
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
29646
+ ]);
29647
+
29648
+ // ../../node_modules/lucide-react/dist/esm/icons/tablet.js
29649
+ init_react_import();
29650
+ var Tablet = createLucideIcon("Tablet", [
29651
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
29652
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
29653
+ ]);
29654
+
29632
29655
  // ../../node_modules/lucide-react/dist/esm/icons/trash.js
29633
29656
  init_react_import();
29634
29657
  var Trash = createLucideIcon("Trash", [
@@ -29652,6 +29675,23 @@ var Unlock = createLucideIcon("Unlock", [
29652
29675
  ["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
29653
29676
  ]);
29654
29677
 
29678
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
29679
+ init_react_import();
29680
+ var ZoomIn = createLucideIcon("ZoomIn", [
29681
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29682
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29683
+ ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
29684
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29685
+ ]);
29686
+
29687
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
29688
+ init_react_import();
29689
+ var ZoomOut = createLucideIcon("ZoomOut", [
29690
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29691
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29692
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29693
+ ]);
29694
+
29655
29695
  // lib/use-modifier-held.ts
29656
29696
  init_react_import();
29657
29697
  var import_react5 = require("react");
@@ -29680,8 +29720,118 @@ var useModifierHeld = (modifier) => {
29680
29720
 
29681
29721
  // components/DraggableComponent/index.tsx
29682
29722
  var import_react_spinners2 = require("react-spinners");
29723
+
29724
+ // components/Puck/context.tsx
29725
+ init_react_import();
29726
+ var import_react6 = require("react");
29727
+
29728
+ // lib/get-item.ts
29729
+ init_react_import();
29730
+
29731
+ // lib/root-droppable-id.ts
29732
+ init_react_import();
29733
+ var rootDroppableId = "default-zone";
29734
+
29735
+ // lib/setup-zone.ts
29736
+ init_react_import();
29737
+ var setupZone = (data, zoneKey) => {
29738
+ if (zoneKey === rootDroppableId) {
29739
+ return data;
29740
+ }
29741
+ const newData = __spreadValues({}, data);
29742
+ newData.zones = data.zones || {};
29743
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29744
+ return newData;
29745
+ };
29746
+
29747
+ // lib/get-item.ts
29748
+ var getItem = (selector, data, dynamicProps = {}) => {
29749
+ if (!selector.zone || selector.zone === rootDroppableId) {
29750
+ const item2 = data.content[selector.index];
29751
+ return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29752
+ }
29753
+ const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29754
+ return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
29755
+ };
29756
+
29757
+ // components/ViewportControls/default-viewports.ts
29758
+ init_react_import();
29759
+ var defaultViewports = [
29760
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
29761
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
29762
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
29763
+ ];
29764
+
29765
+ // components/Puck/context.tsx
29683
29766
  var import_jsx_runtime5 = require("react/jsx-runtime");
29767
+ var defaultAppState = {
29768
+ data: { content: [], root: { props: { title: "" } } },
29769
+ ui: {
29770
+ leftSideBarVisible: true,
29771
+ rightSideBarVisible: true,
29772
+ arrayState: {},
29773
+ itemSelector: null,
29774
+ componentList: {},
29775
+ isDragging: false,
29776
+ viewports: {
29777
+ current: {
29778
+ width: defaultViewports[0].width,
29779
+ height: defaultViewports[0].height || "auto"
29780
+ },
29781
+ options: [],
29782
+ controlsVisible: true
29783
+ }
29784
+ }
29785
+ };
29786
+ var defaultContext = {
29787
+ state: defaultAppState,
29788
+ dispatch: () => null,
29789
+ config: { components: {} },
29790
+ componentState: {},
29791
+ resolveData: () => {
29792
+ },
29793
+ plugins: [],
29794
+ overrides: {},
29795
+ history: {},
29796
+ viewports: defaultViewports,
29797
+ zoomConfig: {
29798
+ autoZoom: 0,
29799
+ rootHeight: 0,
29800
+ zoom: 1
29801
+ },
29802
+ setZoomConfig: () => null
29803
+ };
29804
+ var appContext = (0, import_react6.createContext)(defaultContext);
29805
+ var AppProvider = ({
29806
+ children,
29807
+ value
29808
+ }) => {
29809
+ const [zoomConfig, setZoomConfig] = (0, import_react6.useState)(defaultContext.zoomConfig);
29810
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(appContext.Provider, { value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig }), children });
29811
+ };
29812
+ function useAppContext() {
29813
+ const mainContext = (0, import_react6.useContext)(appContext);
29814
+ const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29815
+ return __spreadProps(__spreadValues({}, mainContext), {
29816
+ // Helpers
29817
+ selectedItem,
29818
+ setUi: (ui, recordHistory) => {
29819
+ return mainContext.dispatch({
29820
+ type: "setUi",
29821
+ ui,
29822
+ recordHistory
29823
+ });
29824
+ }
29825
+ });
29826
+ }
29827
+
29828
+ // components/DraggableComponent/index.tsx
29829
+ var import_jsx_runtime6 = require("react/jsx-runtime");
29684
29830
  var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_module_default3);
29831
+ var space = 8;
29832
+ var actionsOverlayTop = space * 6.5;
29833
+ var actionsTop = -(actionsOverlayTop - 8);
29834
+ var actionsRight = space;
29685
29835
  var DraggableComponent = ({
29686
29836
  children,
29687
29837
  id,
@@ -29704,15 +29854,16 @@ var DraggableComponent = ({
29704
29854
  indicativeHover = false,
29705
29855
  style
29706
29856
  }) => {
29857
+ const { zoomConfig } = useAppContext();
29707
29858
  const isModifierHeld = useModifierHeld("Alt");
29708
- (0, import_react6.useEffect)(onMount, []);
29709
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
29859
+ (0, import_react7.useEffect)(onMount, []);
29860
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
29710
29861
  import_dnd3.Draggable,
29711
29862
  {
29712
29863
  draggableId: id,
29713
29864
  index,
29714
29865
  isDragDisabled,
29715
- children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
29866
+ children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
29716
29867
  "div",
29717
29868
  __spreadProps(__spreadValues(__spreadValues({
29718
29869
  ref: provided.innerRef
@@ -29735,13 +29886,34 @@ var DraggableComponent = ({
29735
29886
  onClick,
29736
29887
  children: [
29737
29888
  debug,
29738
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29739
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("overlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName4("actions"), children: [
29740
- label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29741
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Copy, { size: 16 }) }),
29742
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Trash, { size: 16 }) })
29743
- ] }) }),
29744
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("contents"), children })
29889
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29890
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
29891
+ "div",
29892
+ {
29893
+ className: getClassName4("actionsOverlay"),
29894
+ style: {
29895
+ top: actionsOverlayTop / zoomConfig.zoom
29896
+ },
29897
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
29898
+ "div",
29899
+ {
29900
+ className: getClassName4("actions"),
29901
+ style: {
29902
+ transform: `scale(${1 / zoomConfig.zoom}`,
29903
+ top: actionsTop / zoomConfig.zoom,
29904
+ right: actionsRight / zoomConfig.zoom
29905
+ },
29906
+ children: [
29907
+ label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29908
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Copy, { size: 16 }) }),
29909
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Trash, { size: 16 }) })
29910
+ ]
29911
+ }
29912
+ )
29913
+ }
29914
+ ),
29915
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName4("overlay") }),
29916
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName4("contents"), children })
29745
29917
  ]
29746
29918
  })
29747
29919
  )
@@ -29751,44 +29923,15 @@ var DraggableComponent = ({
29751
29923
  };
29752
29924
 
29753
29925
  // components/DropZone/index.tsx
29754
- var import_dnd4 = require("@hello-pangea/dnd");
29755
-
29756
- // lib/get-item.ts
29757
- init_react_import();
29758
-
29759
- // lib/root-droppable-id.ts
29760
- init_react_import();
29761
- var rootDroppableId = "default-zone";
29762
-
29763
- // lib/setup-zone.ts
29764
- init_react_import();
29765
- var setupZone = (data, zoneKey) => {
29766
- if (zoneKey === rootDroppableId) {
29767
- return data;
29768
- }
29769
- const newData = __spreadValues({}, data);
29770
- newData.zones = data.zones || {};
29771
- newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29772
- return newData;
29773
- };
29774
-
29775
- // lib/get-item.ts
29776
- var getItem = (selector, data, dynamicProps = {}) => {
29777
- if (!selector.zone || selector.zone === rootDroppableId) {
29778
- const item2 = data.content[selector.index];
29779
- return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29780
- }
29781
- const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29782
- return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
29783
- };
29926
+ var import_dnd4 = require("@measured/dnd");
29784
29927
 
29785
29928
  // css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
29786
29929
  init_react_import();
29787
- var styles_module_default4 = { "DropZone": "_DropZone_utidm_1", "DropZone--zoomEnabled": "_DropZone--zoomEnabled_utidm_10", "DropZone-renderWrapper": "_DropZone-renderWrapper_utidm_14", "DropZone-content": "_DropZone-content_utidm_18", "DropZone--userIsDragging": "_DropZone--userIsDragging_utidm_23", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_utidm_27", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_utidm_28", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_utidm_34", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_utidm_35", "DropZone--isDisabled": "_DropZone--isDisabled_utidm_36", "DropZone--isRootZone": "_DropZone--isRootZone_utidm_37", "DropZone--hasChildren": "_DropZone--hasChildren_utidm_43", "DropZone--isDestination": "_DropZone--isDestination_utidm_48", "DropZone-item": "_DropZone-item_utidm_56", "DropZone-hitbox": "_DropZone-hitbox_utidm_60" };
29930
+ var styles_module_default4 = { "DropZone": "_DropZone_jtf9d_1", "DropZone-content": "_DropZone-content_jtf9d_10", "DropZone--userIsDragging": "_DropZone--userIsDragging_jtf9d_15", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_jtf9d_19", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_jtf9d_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_jtf9d_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_jtf9d_27", "DropZone--isDisabled": "_DropZone--isDisabled_jtf9d_28", "DropZone--isRootZone": "_DropZone--isRootZone_jtf9d_29", "DropZone--hasChildren": "_DropZone--hasChildren_jtf9d_30", "DropZone--isDestination": "_DropZone--isDestination_jtf9d_40", "DropZone-item": "_DropZone-item_jtf9d_48", "DropZone-hitbox": "_DropZone-hitbox_jtf9d_52" };
29788
29931
 
29789
29932
  // components/DropZone/context.tsx
29790
29933
  init_react_import();
29791
- var import_react7 = require("react");
29934
+ var import_react8 = require("react");
29792
29935
  var import_use_debounce = require("use-debounce");
29793
29936
 
29794
29937
  // lib/get-zone-id.ts
@@ -29804,30 +29947,30 @@ var getZoneId = (zoneCompound) => {
29804
29947
  };
29805
29948
 
29806
29949
  // components/DropZone/context.tsx
29807
- var import_jsx_runtime6 = require("react/jsx-runtime");
29808
- var dropZoneContext = (0, import_react7.createContext)(null);
29950
+ var import_jsx_runtime7 = require("react/jsx-runtime");
29951
+ var dropZoneContext = (0, import_react8.createContext)(null);
29809
29952
  var DropZoneProvider = ({
29810
29953
  children,
29811
29954
  value
29812
29955
  }) => {
29813
- const [hoveringArea, setHoveringArea] = (0, import_react7.useState)(null);
29814
- const [hoveringZone, setHoveringZone] = (0, import_react7.useState)(
29956
+ const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
29957
+ const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
29815
29958
  rootDroppableId
29816
29959
  );
29817
- const [hoveringComponent, setHoveringComponent] = (0, import_react7.useState)();
29960
+ const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
29818
29961
  const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
29819
- const [areasWithZones, setAreasWithZones] = (0, import_react7.useState)(
29962
+ const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
29820
29963
  {}
29821
29964
  );
29822
- const [activeZones, setActiveZones] = (0, import_react7.useState)({});
29965
+ const [activeZones, setActiveZones] = (0, import_react8.useState)({});
29823
29966
  const { dispatch = null } = value ? value : {};
29824
- const registerZoneArea = (0, import_react7.useCallback)(
29967
+ const registerZoneArea = (0, import_react8.useCallback)(
29825
29968
  (area) => {
29826
29969
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
29827
29970
  },
29828
29971
  [setAreasWithZones]
29829
29972
  );
29830
- const registerZone = (0, import_react7.useCallback)(
29973
+ const registerZone = (0, import_react8.useCallback)(
29831
29974
  (zoneCompound) => {
29832
29975
  if (!dispatch) {
29833
29976
  return;
@@ -29840,7 +29983,7 @@ var DropZoneProvider = ({
29840
29983
  },
29841
29984
  [setActiveZones, dispatch]
29842
29985
  );
29843
- const unregisterZone = (0, import_react7.useCallback)(
29986
+ const unregisterZone = (0, import_react8.useCallback)(
29844
29987
  (zoneCompound) => {
29845
29988
  if (!dispatch) {
29846
29989
  return;
@@ -29855,8 +29998,8 @@ var DropZoneProvider = ({
29855
29998
  },
29856
29999
  [setActiveZones, dispatch]
29857
30000
  );
29858
- const [pathData, setPathData] = (0, import_react7.useState)();
29859
- const registerPath = (0, import_react7.useCallback)(
30001
+ const [pathData, setPathData] = (0, import_react8.useState)();
30002
+ const registerPath = (0, import_react8.useCallback)(
29860
30003
  (selector) => {
29861
30004
  if (!(value == null ? void 0 : value.data)) {
29862
30005
  return;
@@ -29881,7 +30024,8 @@ var DropZoneProvider = ({
29881
30024
  },
29882
30025
  [value, setPathData]
29883
30026
  );
29884
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
30027
+ const [zoneWillDrag, setZoneWillDrag] = (0, import_react8.useState)("");
30028
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29885
30029
  dropZoneContext.Provider,
29886
30030
  {
29887
30031
  value: __spreadValues({
@@ -29897,57 +30041,17 @@ var DropZoneProvider = ({
29897
30041
  unregisterZone,
29898
30042
  activeZones,
29899
30043
  registerPath,
29900
- pathData
30044
+ pathData,
30045
+ zoneWillDrag,
30046
+ setZoneWillDrag
29901
30047
  }, value),
29902
30048
  children
29903
30049
  }
29904
30050
  ) });
29905
30051
  };
29906
30052
 
29907
- // components/Puck/context.tsx
29908
- init_react_import();
29909
- var import_react8 = require("react");
29910
- var defaultAppState = {
29911
- data: { content: [], root: { props: { title: "" } } },
29912
- ui: {
29913
- leftSideBarVisible: true,
29914
- rightSideBarVisible: true,
29915
- arrayState: {},
29916
- itemSelector: null,
29917
- componentList: {},
29918
- isDragging: false
29919
- }
29920
- };
29921
- var appContext = (0, import_react8.createContext)({
29922
- state: defaultAppState,
29923
- dispatch: () => null,
29924
- config: { components: {} },
29925
- componentState: {},
29926
- resolveData: () => {
29927
- },
29928
- plugins: [],
29929
- overrides: {},
29930
- history: {}
29931
- });
29932
- var AppProvider = appContext.Provider;
29933
- function useAppContext() {
29934
- const mainContext = (0, import_react8.useContext)(appContext);
29935
- const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29936
- return __spreadProps(__spreadValues({}, mainContext), {
29937
- // Helpers
29938
- selectedItem,
29939
- setUi: (ui, recordHistory) => {
29940
- return mainContext.dispatch({
29941
- type: "setUi",
29942
- ui,
29943
- recordHistory
29944
- });
29945
- }
29946
- });
29947
- }
29948
-
29949
30053
  // components/DropZone/index.tsx
29950
- var import_jsx_runtime7 = require("react/jsx-runtime");
30054
+ var import_jsx_runtime8 = require("react/jsx-runtime");
29951
30055
  var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
29952
30056
  function DropZoneEdit({ zone, allow, disallow, style }) {
29953
30057
  var _a;
@@ -29966,7 +30070,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29966
30070
  registerZoneArea,
29967
30071
  areasWithZones,
29968
30072
  hoveringComponent,
29969
- disableZoom = false
30073
+ zoneWillDrag,
30074
+ setZoneWillDrag = () => null
29970
30075
  } = ctx || {};
29971
30076
  let content = data.content || [];
29972
30077
  let zoneCompound = rootDroppableId;
@@ -29996,12 +30101,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29996
30101
  const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
29997
30102
  const [zoneArea] = getZoneId(zoneCompound);
29998
30103
  const [draggedSourceArea] = getZoneId(draggedSourceId);
29999
- const [userWillDrag, setUserWillDrag] = (0, import_react9.useState)(false);
30104
+ const userWillDrag = zoneWillDrag === zone;
30000
30105
  const userIsDragging = !!draggedItem;
30001
30106
  const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
30002
30107
  const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
30003
30108
  if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
30004
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "DropZone requires context to work." });
30109
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "DropZone requires context to work." });
30005
30110
  }
30006
30111
  const {
30007
30112
  hoveringArea = "root",
@@ -30038,7 +30143,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30038
30143
  }
30039
30144
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
30040
30145
  const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
30041
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30146
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30042
30147
  "div",
30043
30148
  {
30044
30149
  className: getClassName5({
@@ -30050,17 +30155,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30050
30155
  isDestination: draggedDestinationId === zoneCompound,
30051
30156
  isDisabled: !isEnabled,
30052
30157
  isAreaSelected,
30053
- hasChildren: content.length > 0,
30054
- zoomEnabled: !disableZoom
30158
+ hasChildren: content.length > 0
30055
30159
  }),
30056
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30160
+ onMouseUp: () => {
30161
+ setZoneWillDrag("");
30162
+ },
30163
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30057
30164
  import_dnd4.Droppable,
30058
30165
  {
30059
30166
  droppableId: zoneCompound,
30060
30167
  direction: "vertical",
30061
30168
  isDropDisabled: !isEnabled,
30062
30169
  children: (provided, snapshot) => {
30063
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30170
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30064
30171
  "div",
30065
30172
  __spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
30066
30173
  className: getClassName5("content"),
@@ -30074,7 +30181,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30074
30181
  },
30075
30182
  children: [
30076
30183
  content.map((item, i) => {
30077
- var _a2, _b;
30184
+ var _a2, _b, _c;
30078
30185
  const componentId = item.props.id;
30079
30186
  const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
30080
30187
  puck: { renderDropZone: DropZone },
@@ -30085,33 +30192,33 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30085
30192
  "draggable-"
30086
30193
  )[1] === componentId;
30087
30194
  const containsZone = areasWithZones ? areasWithZones[componentId] : false;
30088
- const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
30195
+ const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
30089
30196
  "No configuration for ",
30090
30197
  item.type
30091
30198
  ] });
30092
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30199
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30093
30200
  "div",
30094
30201
  {
30095
30202
  className: getClassName5("item"),
30096
30203
  style: { zIndex: isDragging ? 1 : void 0 },
30097
30204
  children: [
30098
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30205
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30099
30206
  DropZoneProvider,
30100
30207
  {
30101
30208
  value: __spreadProps(__spreadValues({}, ctx), {
30102
30209
  areaId: componentId
30103
30210
  }),
30104
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30211
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30105
30212
  DraggableComponent,
30106
30213
  {
30107
- label: item.type.toString(),
30214
+ label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
30108
30215
  id: `draggable-${componentId}`,
30109
30216
  index: i,
30110
30217
  isSelected,
30111
30218
  isLocked: userIsDragging,
30112
30219
  forceHover: hoveringComponent === componentId && !userIsDragging,
30113
30220
  indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
30114
- isLoading: (_b = appContext2.componentState[componentId]) == null ? void 0 : _b.loading,
30221
+ isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
30115
30222
  onMount: () => {
30116
30223
  ctx.registerPath({
30117
30224
  index: i,
@@ -30127,11 +30234,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30127
30234
  },
30128
30235
  onMouseDown: (e) => {
30129
30236
  e.stopPropagation();
30130
- setUserWillDrag(true);
30131
- },
30132
- onMouseUp: (e) => {
30133
- e.stopPropagation();
30134
- setUserWillDrag(false);
30237
+ setZoneWillDrag(zone);
30135
30238
  },
30136
30239
  onMouseOver: (e) => {
30137
30240
  e.stopPropagation();
@@ -30172,12 +30275,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30172
30275
  style: {
30173
30276
  pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
30174
30277
  },
30175
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30278
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30176
30279
  }
30177
30280
  )
30178
30281
  }
30179
30282
  ),
30180
- userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30283
+ userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30181
30284
  "div",
30182
30285
  {
30183
30286
  className: getClassName5("hitbox"),
@@ -30194,7 +30297,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30194
30297
  );
30195
30298
  }),
30196
30299
  provided == null ? void 0 : provided.placeholder,
30197
- (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30300
+ (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30198
30301
  "div",
30199
30302
  {
30200
30303
  "data-puck-placeholder": true,
@@ -30226,14 +30329,14 @@ function DropZoneRender({ zone }) {
30226
30329
  zoneCompound = `${areaId}:${zone}`;
30227
30330
  content = setupZone(data, zoneCompound).zones[zoneCompound];
30228
30331
  }
30229
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: content.map((item) => {
30332
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: content.map((item) => {
30230
30333
  const Component = config.components[item.type];
30231
30334
  if (Component) {
30232
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30335
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30233
30336
  DropZoneProvider,
30234
30337
  {
30235
30338
  value: { data, config, areaId: item.props.id },
30236
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30339
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30237
30340
  Component.render,
30238
30341
  __spreadProps(__spreadValues({}, item.props), {
30239
30342
  puck: { renderDropZone: DropZone }
@@ -30249,9 +30352,9 @@ function DropZoneRender({ zone }) {
30249
30352
  function DropZone(props) {
30250
30353
  const ctx = (0, import_react9.useContext)(dropZoneContext);
30251
30354
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
30252
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneEdit, __spreadValues({}, props));
30355
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropZoneEdit, __spreadValues({}, props));
30253
30356
  }
30254
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneRender, __spreadValues({}, props));
30357
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropZoneRender, __spreadValues({}, props));
30255
30358
  }
30256
30359
 
30257
30360
  // components/IconButton/index.ts
@@ -30263,11 +30366,11 @@ var import_react10 = require("react");
30263
30366
 
30264
30367
  // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
30265
30368
  init_react_import();
30266
- var IconButton_module_default = { "IconButton": "_IconButton_1xqlg_1", "IconButton-title": "_IconButton-title_1xqlg_33" };
30369
+ var IconButton_module_default = { "IconButton": "_IconButton_swpni_1", "IconButton--disabled": "_IconButton--disabled_swpni_20", "IconButton-title": "_IconButton-title_swpni_33" };
30267
30370
 
30268
30371
  // components/IconButton/IconButton.tsx
30269
30372
  var import_react_spinners3 = require("react-spinners");
30270
- var import_jsx_runtime8 = require("react/jsx-runtime");
30373
+ var import_jsx_runtime9 = require("react/jsx-runtime");
30271
30374
  var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
30272
30375
  var IconButton = ({
30273
30376
  children,
@@ -30283,7 +30386,7 @@ var IconButton = ({
30283
30386
  }) => {
30284
30387
  const [loading, setLoading] = (0, import_react10.useState)(false);
30285
30388
  const ElementType = href ? "a" : "button";
30286
- const el = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30389
+ const el = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30287
30390
  ElementType,
30288
30391
  {
30289
30392
  className: getClassName6({
@@ -30308,11 +30411,11 @@ var IconButton = ({
30308
30411
  href,
30309
30412
  title,
30310
30413
  children: [
30311
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: getClassName6("title"), children: title }),
30414
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: getClassName6("title"), children: title }),
30312
30415
  children,
30313
- loading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
30416
+ loading && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
30314
30417
  "\xA0\xA0",
30315
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30418
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30316
30419
  ] })
30317
30420
  ]
30318
30421
  }
@@ -30322,8 +30425,8 @@ var IconButton = ({
30322
30425
 
30323
30426
  // components/Puck/index.tsx
30324
30427
  init_react_import();
30325
- var import_react26 = require("react");
30326
- var import_dnd7 = require("@hello-pangea/dnd");
30428
+ var import_react28 = require("react");
30429
+ var import_dnd7 = require("@measured/dnd");
30327
30430
 
30328
30431
  // lib/use-placeholder-style.ts
30329
30432
  init_react_import();
@@ -30332,16 +30435,17 @@ var usePlaceholderStyle = () => {
30332
30435
  const queryAttr = "data-rfd-drag-handle-draggable-id";
30333
30436
  const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
30334
30437
  const onDragStartOrUpdate = (draggedItem) => {
30335
- var _a;
30438
+ var _a, _b, _c;
30336
30439
  const draggableId = draggedItem.draggableId;
30337
30440
  const destinationIndex = (draggedItem.destination || draggedItem.source).index;
30338
30441
  const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
30339
30442
  const domQuery = `[${queryAttr}='${draggableId}']`;
30340
- const draggedDOM = document.querySelector(domQuery);
30443
+ const iframe = document.querySelector(`#preview-iframe`);
30444
+ const draggedDOM = document.querySelector(domQuery) || ((_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.document.querySelector(domQuery));
30341
30445
  if (!draggedDOM) {
30342
30446
  return;
30343
30447
  }
30344
- const targetListElement = document.querySelector(
30448
+ const targetListElement = (_b = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _b.document.querySelector(
30345
30449
  `[data-rfd-droppable-id='${droppableId}']`
30346
30450
  );
30347
30451
  const { clientHeight } = draggedDOM;
@@ -30349,7 +30453,7 @@ var usePlaceholderStyle = () => {
30349
30453
  return;
30350
30454
  }
30351
30455
  let clientY = 0;
30352
- const isSameDroppable = draggedItem.source.droppableId === ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
30456
+ const isSameDroppable = draggedItem.source.droppableId === ((_c = draggedItem.destination) == null ? void 0 : _c.droppableId);
30353
30457
  if (destinationIndex > 0) {
30354
30458
  const end = destinationIndex > draggedItem.source.index && isSameDroppable ? destinationIndex + 1 : destinationIndex;
30355
30459
  const children = Array.from(targetListElement.children).filter(
@@ -30388,11 +30492,11 @@ init_react_import();
30388
30492
  var styles_module_default6 = { "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" };
30389
30493
 
30390
30494
  // components/Heading/index.tsx
30391
- var import_jsx_runtime9 = require("react/jsx-runtime");
30495
+ var import_jsx_runtime10 = require("react/jsx-runtime");
30392
30496
  var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
30393
30497
  var Heading = ({ children, rank, size = "m" }) => {
30394
30498
  const Tag = rank ? `h${rank}` : "span";
30395
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30499
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
30396
30500
  Tag,
30397
30501
  {
30398
30502
  className: getClassName7({
@@ -30471,7 +30575,7 @@ var useBreadcrumbs = (renderCount) => {
30471
30575
 
30472
30576
  // components/SidebarSection/index.tsx
30473
30577
  var import_react_spinners4 = require("react-spinners");
30474
- var import_jsx_runtime10 = require("react/jsx-runtime");
30578
+ var import_jsx_runtime11 = require("react/jsx-runtime");
30475
30579
  var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
30476
30580
  var SidebarSection = ({
30477
30581
  children,
@@ -30484,15 +30588,15 @@ var SidebarSection = ({
30484
30588
  }) => {
30485
30589
  const { setUi } = useAppContext();
30486
30590
  const breadcrumbs = useBreadcrumbs(1);
30487
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30591
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
30488
30592
  "div",
30489
30593
  {
30490
30594
  className: getClassName8({ noBorderTop, noPadding }),
30491
30595
  style: { background },
30492
30596
  children: [
30493
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30494
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30495
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
30597
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30598
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30599
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
30496
30600
  "button",
30497
30601
  {
30498
30602
  className: getClassName8("breadcrumbLabel"),
@@ -30500,12 +30604,12 @@ var SidebarSection = ({
30500
30604
  children: breadcrumb.label
30501
30605
  }
30502
30606
  ),
30503
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChevronRight, { size: 16 })
30607
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChevronRight, { size: 16 })
30504
30608
  ] }, i)) : null,
30505
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
30609
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
30506
30610
  ] }) }),
30507
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("content"), children }),
30508
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
30611
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("content"), children }),
30612
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
30509
30613
  ]
30510
30614
  }
30511
30615
  );
@@ -31087,7 +31191,7 @@ init_react_import();
31087
31191
  var styles_module_default7 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
31088
31192
 
31089
31193
  // components/MenuBar/index.tsx
31090
- var import_jsx_runtime11 = require("react/jsx-runtime");
31194
+ var import_jsx_runtime12 = require("react/jsx-runtime");
31091
31195
  var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
31092
31196
  var MenuBar = ({
31093
31197
  appState,
@@ -31102,7 +31206,7 @@ var MenuBar = ({
31102
31206
  history: { back, forward, historyStore }
31103
31207
  } = useAppContext();
31104
31208
  const { hasFuture = false, hasPast = false } = historyStore || {};
31105
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31209
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31106
31210
  "div",
31107
31211
  {
31108
31212
  className: getClassName9({ menuOpen }),
@@ -31116,16 +31220,16 @@ var MenuBar = ({
31116
31220
  setMenuOpen(false);
31117
31221
  }
31118
31222
  },
31119
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("inner"), children: [
31120
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("history"), children: [
31121
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31223
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName9("inner"), children: [
31224
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName9("history"), children: [
31225
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31122
31226
  ChevronLeft,
31123
31227
  {
31124
31228
  size: 21,
31125
31229
  stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
31126
31230
  }
31127
31231
  ) }),
31128
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31232
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31129
31233
  ChevronRight,
31130
31234
  {
31131
31235
  size: 21,
@@ -31133,17 +31237,17 @@ var MenuBar = ({
31133
31237
  }
31134
31238
  ) })
31135
31239
  ] }),
31136
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: renderHeaderActions && renderHeaderActions({
31240
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: renderHeaderActions && renderHeaderActions({
31137
31241
  state: appState,
31138
31242
  dispatch
31139
31243
  }) }),
31140
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31244
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31141
31245
  Button,
31142
31246
  {
31143
31247
  onClick: () => {
31144
31248
  onPublish && onPublish(data);
31145
31249
  },
31146
- icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Globe, { size: "14px" }),
31250
+ icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Globe, { size: "14px" }),
31147
31251
  children: "Publish"
31148
31252
  }
31149
31253
  ) })
@@ -31154,7 +31258,7 @@ var MenuBar = ({
31154
31258
 
31155
31259
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
31156
31260
  init_react_import();
31157
- var styles_module_default8 = { "Puck": "_Puck_1mnww_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_1mnww_36", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_1mnww_42", "Puck-header": "_Puck-header_1mnww_96", "Puck-headerInner": "_Puck-headerInner_1mnww_105", "Puck-headerToggle": "_Puck-headerToggle_1mnww_115", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_1mnww_122", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_1mnww_123", "Puck-headerTitle": "_Puck-headerTitle_1mnww_127", "Puck-headerPath": "_Puck-headerPath_1mnww_131", "Puck-headerTools": "_Puck-headerTools_1mnww_138", "Puck-menuButton": "_Puck-menuButton_1mnww_144", "Puck--menuOpen": "_Puck--menuOpen_1mnww_149", "Puck-leftSideBar": "_Puck-leftSideBar_1mnww_123", "Puck-frame": "_Puck-frame_1mnww_168", "Puck-root": "_Puck-root_1mnww_176", "Puck-rightSideBar": "_Puck-rightSideBar_1mnww_122" };
31261
+ var styles_module_default8 = { "Puck": "_Puck_3qn7l_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_3qn7l_36", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_3qn7l_42", "Puck-header": "_Puck-header_3qn7l_96", "Puck-headerInner": "_Puck-headerInner_3qn7l_105", "Puck-headerToggle": "_Puck-headerToggle_3qn7l_115", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_3qn7l_122", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_3qn7l_123", "Puck-headerTitle": "_Puck-headerTitle_3qn7l_127", "Puck-headerPath": "_Puck-headerPath_3qn7l_131", "Puck-headerTools": "_Puck-headerTools_3qn7l_138", "Puck-menuButton": "_Puck-menuButton_3qn7l_144", "Puck--menuOpen": "_Puck--menuOpen_3qn7l_149", "Puck-leftSideBar": "_Puck-leftSideBar_3qn7l_123", "Puck-frame": "_Puck-frame_3qn7l_168", "Puck-root": "_Puck-root_3qn7l_179", "Puck-rightSideBar": "_Puck-rightSideBar_3qn7l_122", "Puck-canvas": "_Puck-canvas_3qn7l_211", "Puck-canvasControls": "_Puck-canvasControls_3qn7l_226" };
31158
31262
 
31159
31263
  // components/Puck/components/Fields/index.tsx
31160
31264
  init_react_import();
@@ -31181,10 +31285,10 @@ init_react_import();
31181
31285
  var styles_module_default10 = { "ArrayField": "_ArrayField_1txra_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1txra_13", "ArrayField-addButton": "_ArrayField-addButton_1txra_17", "ArrayField--hasItems": "_ArrayField--hasItems_1txra_32", "ArrayFieldItem": "_ArrayFieldItem_1txra_61", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1txra_69", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1txra_74", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1txra_84", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_1txra_108", "ArrayFieldItem-body": "_ArrayFieldItem-body_1txra_142", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1txra_150", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1txra_157", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1txra_163" };
31182
31286
 
31183
31287
  // components/InputOrGroup/fields/ArrayField/index.tsx
31184
- var import_dnd5 = require("@hello-pangea/dnd");
31185
- var import_dnd6 = require("@hello-pangea/dnd");
31288
+ var import_dnd5 = require("@measured/dnd");
31289
+ var import_dnd6 = require("@measured/dnd");
31186
31290
  var import_react14 = require("react");
31187
- var import_jsx_runtime12 = require("react/jsx-runtime");
31291
+ var import_jsx_runtime13 = require("react/jsx-runtime");
31188
31292
  var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
31189
31293
  var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
31190
31294
  var ArrayField = ({
@@ -31254,14 +31358,14 @@ var ArrayField = ({
31254
31358
  if (field.type !== "array" || !field.arrayFields) {
31255
31359
  return null;
31256
31360
  }
31257
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31361
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31258
31362
  FieldLabelInternal,
31259
31363
  {
31260
31364
  label: label || name,
31261
- icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(List, { size: 16 }),
31365
+ icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(List, { size: 16 }),
31262
31366
  el: "div",
31263
31367
  readOnly,
31264
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31368
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31265
31369
  import_dnd6.DragDropContext,
31266
31370
  {
31267
31371
  onDragEnd: (event) => {
@@ -31288,8 +31392,8 @@ var ArrayField = ({
31288
31392
  });
31289
31393
  }
31290
31394
  },
31291
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dnd5.Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31292
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31395
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dnd5.Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31396
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
31293
31397
  "div",
31294
31398
  __spreadProps(__spreadValues({}, provided.droppableProps), {
31295
31399
  ref: provided.innerRef,
@@ -31309,7 +31413,7 @@ var ArrayField = ({
31309
31413
  localState.arrayState.items.map((item, i) => {
31310
31414
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
31311
31415
  const data = Array.from(localState.value || [])[i] || {};
31312
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31416
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31313
31417
  Draggable,
31314
31418
  {
31315
31419
  id: _arrayId,
@@ -31320,8 +31424,8 @@ var ArrayField = ({
31320
31424
  readOnly
31321
31425
  }),
31322
31426
  isDragDisabled: readOnly || !hovering,
31323
- children: () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
31324
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31427
+ children: () => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
31428
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
31325
31429
  "div",
31326
31430
  {
31327
31431
  onClick: () => {
@@ -31342,10 +31446,11 @@ var ArrayField = ({
31342
31446
  className: getClassNameItem2("summary"),
31343
31447
  children: [
31344
31448
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
31345
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31346
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31449
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31450
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31347
31451
  IconButton,
31348
31452
  {
31453
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
31349
31454
  onClick: (e) => {
31350
31455
  e.stopPropagation();
31351
31456
  const existingValue = [
@@ -31364,20 +31469,20 @@ var ArrayField = ({
31364
31469
  );
31365
31470
  },
31366
31471
  title: "Delete",
31367
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Trash, { size: 16 })
31472
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Trash, { size: 16 })
31368
31473
  }
31369
31474
  ) }) }),
31370
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DragIcon, {}) })
31475
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DragIcon, {}) })
31371
31476
  ] })
31372
31477
  ]
31373
31478
  }
31374
31479
  ),
31375
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
31480
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
31376
31481
  (fieldName) => {
31377
31482
  const subField = field.arrayFields[fieldName];
31378
31483
  const subFieldName = `${name}[${i}].${fieldName}`;
31379
31484
  const wildcardFieldName = `${name}[*].${fieldName}`;
31380
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31485
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31381
31486
  InputOrGroup,
31382
31487
  {
31383
31488
  name: subFieldName,
@@ -31406,10 +31511,11 @@ var ArrayField = ({
31406
31511
  );
31407
31512
  }),
31408
31513
  provided.placeholder,
31409
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31514
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31410
31515
  "button",
31411
31516
  {
31412
31517
  className: getClassName10("addButton"),
31518
+ disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
31413
31519
  onClick: () => {
31414
31520
  const existingValue = value || [];
31415
31521
  const newValue = [
@@ -31419,7 +31525,7 @@ var ArrayField = ({
31419
31525
  const newArrayState = regenerateArrayState(newValue);
31420
31526
  onChange(newValue, mapArrayStateToUi(newArrayState));
31421
31527
  },
31422
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: "21" })
31528
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Plus, { size: 21 })
31423
31529
  }
31424
31530
  )
31425
31531
  ]
@@ -31434,7 +31540,7 @@ var ArrayField = ({
31434
31540
 
31435
31541
  // components/InputOrGroup/fields/DefaultField/index.tsx
31436
31542
  init_react_import();
31437
- var import_jsx_runtime13 = require("react/jsx-runtime");
31543
+ var import_jsx_runtime14 = require("react/jsx-runtime");
31438
31544
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
31439
31545
  var DefaultField = ({
31440
31546
  field,
@@ -31445,16 +31551,16 @@ var DefaultField = ({
31445
31551
  label,
31446
31552
  id
31447
31553
  }) => {
31448
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31554
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31449
31555
  FieldLabelInternal,
31450
31556
  {
31451
31557
  label: label || name,
31452
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
31453
- field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Type, { size: 16 }),
31454
- field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Hash, { size: 16 })
31558
+ icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
31559
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Type, { size: 16 }),
31560
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Hash, { size: 16 })
31455
31561
  ] }),
31456
31562
  readOnly,
31457
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31563
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31458
31564
  "input",
31459
31565
  {
31460
31566
  className: getClassName11("input"),
@@ -31490,7 +31596,7 @@ var import_react16 = require("react");
31490
31596
 
31491
31597
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
31492
31598
  init_react_import();
31493
- var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_q3l5a_1", "ExternalInput-button": "_ExternalInput-button_q3l5a_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_q3l5a_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_q3l5a_32", "ExternalInputModal": "_ExternalInputModal_q3l5a_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_q3l5a_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_q3l5a_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_q3l5a_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_q3l5a_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_q3l5a_128", "ExternalInputModal-table": "_ExternalInputModal-table_q3l5a_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_q3l5a_144", "ExternalInputModal-th": "_ExternalInputModal-th_q3l5a_144", "ExternalInputModal-td": "_ExternalInputModal-td_q3l5a_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_q3l5a_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_q3l5a_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_q3l5a_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_q3l5a_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_q3l5a_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_q3l5a_222", "ExternalInputModal-search": "_ExternalInputModal-search_q3l5a_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_q3l5a_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_q3l5a_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_q3l5a_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_q3l5a_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_q3l5a_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_q3l5a_325" };
31599
+ var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_19obq_1", "ExternalInput-button": "_ExternalInput-button_19obq_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_19obq_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_19obq_32", "ExternalInputModal": "_ExternalInputModal_19obq_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_19obq_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_19obq_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_19obq_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_19obq_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_19obq_128", "ExternalInputModal-table": "_ExternalInputModal-table_19obq_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_19obq_144", "ExternalInputModal-th": "_ExternalInputModal-th_19obq_144", "ExternalInputModal-td": "_ExternalInputModal-td_19obq_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_19obq_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_19obq_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_19obq_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_19obq_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_19obq_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_19obq_222", "ExternalInputModal-search": "_ExternalInputModal-search_19obq_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_19obq_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_19obq_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_19obq_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_19obq_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_19obq_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_19obq_325" };
31494
31600
 
31495
31601
  // components/Modal/index.tsx
31496
31602
  init_react_import();
@@ -31498,11 +31604,11 @@ var import_react15 = require("react");
31498
31604
 
31499
31605
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
31500
31606
  init_react_import();
31501
- var styles_module_default12 = { "Modal": "_Modal_zud0i_1", "Modal--isOpen": "_Modal--isOpen_zud0i_15", "Modal-inner": "_Modal-inner_zud0i_19" };
31607
+ var styles_module_default12 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
31502
31608
 
31503
31609
  // components/Modal/index.tsx
31504
31610
  var import_react_dom = __toESM(require_react_dom());
31505
- var import_jsx_runtime14 = require("react/jsx-runtime");
31611
+ var import_jsx_runtime15 = require("react/jsx-runtime");
31506
31612
  var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
31507
31613
  var Modal = ({
31508
31614
  children,
@@ -31514,10 +31620,10 @@ var Modal = ({
31514
31620
  setRootEl(document.getElementById("puck-portal-root"));
31515
31621
  }, []);
31516
31622
  if (!rootEl) {
31517
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", {});
31623
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", {});
31518
31624
  }
31519
31625
  return (0, import_react_dom.createPortal)(
31520
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31626
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31521
31627
  "div",
31522
31628
  {
31523
31629
  className: getClassName12("inner"),
@@ -31531,7 +31637,7 @@ var Modal = ({
31531
31637
 
31532
31638
  // components/ExternalInput/index.tsx
31533
31639
  var import_react_spinners5 = require("react-spinners");
31534
- var import_jsx_runtime15 = require("react/jsx-runtime");
31640
+ var import_jsx_runtime16 = require("react/jsx-runtime");
31535
31641
  var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
31536
31642
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
31537
31643
  var dataCache = {};
@@ -31584,7 +31690,7 @@ var ExternalInput = ({
31584
31690
  (0, import_react16.useEffect)(() => {
31585
31691
  search(searchQuery, filters);
31586
31692
  }, []);
31587
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31693
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
31588
31694
  "div",
31589
31695
  {
31590
31696
  className: getClassName13({
@@ -31593,30 +31699,30 @@ var ExternalInput = ({
31593
31699
  }),
31594
31700
  id,
31595
31701
  children: [
31596
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassName13("actions"), children: [
31597
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31702
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassName13("actions"), children: [
31703
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31598
31704
  "button",
31599
31705
  {
31600
31706
  onClick: () => setOpen(true),
31601
31707
  className: getClassName13("button"),
31602
- children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31603
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: "16" }),
31604
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: field.placeholder })
31708
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
31709
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { size: "16" }),
31710
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: field.placeholder })
31605
31711
  ] })
31606
31712
  }
31607
31713
  ),
31608
- value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31714
+ value && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31609
31715
  "button",
31610
31716
  {
31611
31717
  className: getClassName13("detachButton"),
31612
31718
  onClick: () => {
31613
31719
  onChange(null);
31614
31720
  },
31615
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Unlock, { size: 16 })
31721
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Unlock, { size: 16 })
31616
31722
  }
31617
31723
  )
31618
31724
  ] }),
31619
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31725
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
31620
31726
  "form",
31621
31727
  {
31622
31728
  className: getClassNameModal({
@@ -31630,11 +31736,11 @@ var ExternalInput = ({
31630
31736
  search(searchQuery, filters);
31631
31737
  },
31632
31738
  children: [
31633
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
31634
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
31635
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31636
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
31637
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31739
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
31740
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: getClassNameModal("search"), children: [
31741
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31742
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Search, { size: "18" }) }),
31743
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31638
31744
  "input",
31639
31745
  {
31640
31746
  className: getClassNameModal("searchInput"),
@@ -31649,9 +31755,9 @@ var ExternalInput = ({
31649
31755
  }
31650
31756
  )
31651
31757
  ] }),
31652
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
31653
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
31654
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31758
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
31759
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
31760
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31655
31761
  IconButton,
31656
31762
  {
31657
31763
  title: "Toggle filters",
@@ -31660,15 +31766,15 @@ var ExternalInput = ({
31660
31766
  e.stopPropagation();
31661
31767
  setFiltersToggled(!filtersToggled);
31662
31768
  },
31663
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlidersHorizontal, { size: 20 })
31769
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SlidersHorizontal, { size: 20 })
31664
31770
  }
31665
31771
  ) })
31666
31772
  ] })
31667
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
31668
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("grid"), children: [
31669
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
31773
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
31774
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("grid"), children: [
31775
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
31670
31776
  const filterField = filterFields[fieldName];
31671
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31777
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31672
31778
  InputOrGroup,
31673
31779
  {
31674
31780
  field: filterField,
@@ -31685,9 +31791,9 @@ var ExternalInput = ({
31685
31791
  fieldName
31686
31792
  );
31687
31793
  }) }),
31688
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31689
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
31690
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31794
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31795
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("table", { className: getClassNameModal("table"), children: [
31796
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31691
31797
  "th",
31692
31798
  {
31693
31799
  className: getClassNameModal("th"),
@@ -31696,8 +31802,8 @@ var ExternalInput = ({
31696
31802
  },
31697
31803
  key
31698
31804
  )) }) }),
31699
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
31700
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31805
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
31806
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31701
31807
  "tr",
31702
31808
  {
31703
31809
  style: { whiteSpace: "nowrap" },
@@ -31706,16 +31812,16 @@ var ExternalInput = ({
31706
31812
  onChange(mapProp(data[i]));
31707
31813
  setOpen(false);
31708
31814
  },
31709
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31815
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31710
31816
  },
31711
31817
  i
31712
31818
  );
31713
31819
  }) })
31714
31820
  ] }),
31715
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
31821
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
31716
31822
  ] })
31717
31823
  ] }),
31718
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("footer"), children: [
31824
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("footer"), children: [
31719
31825
  mappedData.length,
31720
31826
  " result",
31721
31827
  mappedData.length === 1 ? "" : "s"
@@ -31729,7 +31835,7 @@ var ExternalInput = ({
31729
31835
  };
31730
31836
 
31731
31837
  // components/InputOrGroup/fields/ExternalField/index.tsx
31732
- var import_jsx_runtime16 = require("react/jsx-runtime");
31838
+ var import_jsx_runtime17 = require("react/jsx-runtime");
31733
31839
  var ExternalField = ({
31734
31840
  field,
31735
31841
  onChange,
@@ -31751,13 +31857,13 @@ var ExternalField = ({
31751
31857
  if (field.type !== "external") {
31752
31858
  return null;
31753
31859
  }
31754
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31860
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31755
31861
  FieldLabelInternal,
31756
31862
  {
31757
31863
  label: label || name,
31758
- icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { size: 16 }),
31864
+ icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Link, { size: 16 }),
31759
31865
  el: "div",
31760
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31866
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31761
31867
  ExternalInput,
31762
31868
  {
31763
31869
  name,
@@ -31783,7 +31889,7 @@ var ExternalField = ({
31783
31889
 
31784
31890
  // components/InputOrGroup/fields/RadioField/index.tsx
31785
31891
  init_react_import();
31786
- var import_jsx_runtime17 = require("react/jsx-runtime");
31892
+ var import_jsx_runtime18 = require("react/jsx-runtime");
31787
31893
  var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
31788
31894
  var RadioField = ({
31789
31895
  field,
@@ -31797,19 +31903,19 @@ var RadioField = ({
31797
31903
  if (field.type !== "radio" || !field.options) {
31798
31904
  return null;
31799
31905
  }
31800
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31906
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31801
31907
  FieldLabelInternal,
31802
31908
  {
31803
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CheckCircle, { size: 16 }),
31909
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CheckCircle, { size: 16 }),
31804
31910
  label: label || name,
31805
31911
  readOnly,
31806
31912
  el: "div",
31807
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
31913
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31808
31914
  "label",
31809
31915
  {
31810
31916
  className: getClassName14("radio"),
31811
31917
  children: [
31812
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31918
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31813
31919
  "input",
31814
31920
  {
31815
31921
  type: "radio",
@@ -31827,7 +31933,7 @@ var RadioField = ({
31827
31933
  defaultChecked: value === option.value
31828
31934
  }
31829
31935
  ),
31830
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
31936
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
31831
31937
  ]
31832
31938
  },
31833
31939
  option.label + option.value
@@ -31838,7 +31944,7 @@ var RadioField = ({
31838
31944
 
31839
31945
  // components/InputOrGroup/fields/SelectField/index.tsx
31840
31946
  init_react_import();
31841
- var import_jsx_runtime18 = require("react/jsx-runtime");
31947
+ var import_jsx_runtime19 = require("react/jsx-runtime");
31842
31948
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
31843
31949
  var SelectField = ({
31844
31950
  field,
@@ -31852,13 +31958,13 @@ var SelectField = ({
31852
31958
  if (field.type !== "select" || !field.options) {
31853
31959
  return null;
31854
31960
  }
31855
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31961
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31856
31962
  FieldLabelInternal,
31857
31963
  {
31858
31964
  label: label || name,
31859
- icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDown, { size: 16 }),
31965
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDown, { size: 16 }),
31860
31966
  readOnly,
31861
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31967
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31862
31968
  "select",
31863
31969
  {
31864
31970
  id,
@@ -31872,7 +31978,7 @@ var SelectField = ({
31872
31978
  onChange(e.currentTarget.value);
31873
31979
  },
31874
31980
  value,
31875
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31981
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31876
31982
  "option",
31877
31983
  {
31878
31984
  label: option.label,
@@ -31888,7 +31994,7 @@ var SelectField = ({
31888
31994
 
31889
31995
  // components/InputOrGroup/fields/TextareaField/index.tsx
31890
31996
  init_react_import();
31891
- var import_jsx_runtime19 = require("react/jsx-runtime");
31997
+ var import_jsx_runtime20 = require("react/jsx-runtime");
31892
31998
  var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
31893
31999
  var TextareaField = ({
31894
32000
  onChange,
@@ -31898,13 +32004,13 @@ var TextareaField = ({
31898
32004
  label,
31899
32005
  id
31900
32006
  }) => {
31901
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32007
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31902
32008
  FieldLabelInternal,
31903
32009
  {
31904
32010
  label: label || name,
31905
- icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Type, { size: 16 }),
32011
+ icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Type, { size: 16 }),
31906
32012
  readOnly,
31907
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32013
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31908
32014
  "textarea",
31909
32015
  {
31910
32016
  id,
@@ -31933,7 +32039,7 @@ init_react_import();
31933
32039
  var styles_module_default13 = { "ObjectField": "_ObjectField_15j63_5", "ObjectField-fieldset": "_ObjectField-fieldset_15j63_13" };
31934
32040
 
31935
32041
  // components/InputOrGroup/fields/ObjectField/index.tsx
31936
- var import_jsx_runtime20 = require("react/jsx-runtime");
32042
+ var import_jsx_runtime21 = require("react/jsx-runtime");
31937
32043
  var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
31938
32044
  var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
31939
32045
  var ObjectField = ({
@@ -31950,18 +32056,18 @@ var ObjectField = ({
31950
32056
  return null;
31951
32057
  }
31952
32058
  const data = value || {};
31953
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32059
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31954
32060
  FieldLabelInternal,
31955
32061
  {
31956
32062
  label: label || name,
31957
- icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MoreVertical, { size: 16 }),
32063
+ icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MoreVertical, { size: 16 }),
31958
32064
  el: "div",
31959
32065
  readOnly,
31960
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
32066
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
31961
32067
  const subField = field.objectFields[fieldName];
31962
32068
  const subFieldName = `${name}.${fieldName}`;
31963
32069
  const wildcardFieldName = `${name}.${fieldName}`;
31964
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32070
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31965
32071
  InputOrGroup,
31966
32072
  {
31967
32073
  name: subFieldName,
@@ -31988,7 +32094,7 @@ var ObjectField = ({
31988
32094
  };
31989
32095
 
31990
32096
  // components/InputOrGroup/index.tsx
31991
- var import_jsx_runtime21 = require("react/jsx-runtime");
32097
+ var import_jsx_runtime22 = require("react/jsx-runtime");
31992
32098
  var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
31993
32099
  var FieldLabel = ({
31994
32100
  children,
@@ -31999,11 +32105,11 @@ var FieldLabel = ({
31999
32105
  className
32000
32106
  }) => {
32001
32107
  const El = el;
32002
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(El, { className, children: [
32003
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassName18("label"), children: [
32004
- icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {}),
32108
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(El, { className, children: [
32109
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("label"), children: [
32110
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, {}),
32005
32111
  label,
32006
- readOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Lock, { size: "12" }) })
32112
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Lock, { size: "12" }) })
32007
32113
  ] }),
32008
32114
  children
32009
32115
  ] });
@@ -32020,7 +32126,7 @@ var FieldLabelInternal = ({
32020
32126
  () => overrides.fieldLabel || FieldLabel,
32021
32127
  [overrides]
32022
32128
  );
32023
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
32129
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32024
32130
  Wrapper,
32025
32131
  {
32026
32132
  label,
@@ -32060,7 +32166,7 @@ var InputOrGroup = (_a) => {
32060
32166
  if (!field.render) {
32061
32167
  return null;
32062
32168
  }
32063
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32169
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32064
32170
  field,
32065
32171
  name,
32066
32172
  readOnly
@@ -32089,7 +32195,7 @@ var InputOrGroup = (_a) => {
32089
32195
  const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
32090
32196
  const children = defaultFields[field.type](mergedProps);
32091
32197
  const Render2 = render[field.type];
32092
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32198
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32093
32199
  };
32094
32200
 
32095
32201
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
@@ -32098,7 +32204,7 @@ var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields
32098
32204
 
32099
32205
  // components/Puck/components/Fields/index.tsx
32100
32206
  var import_react19 = require("react");
32101
- var import_jsx_runtime22 = require("react/jsx-runtime");
32207
+ var import_jsx_runtime23 = require("react/jsx-runtime");
32102
32208
  var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
32103
32209
  var defaultPageFields = {
32104
32210
  title: { type: "text" }
@@ -32107,9 +32213,9 @@ var DefaultFields = ({
32107
32213
  children,
32108
32214
  isLoading
32109
32215
  }) => {
32110
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName19(), children: [
32216
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19(), children: [
32111
32217
  children,
32112
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
32218
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
32113
32219
  ] });
32114
32220
  };
32115
32221
  var Fields = () => {
@@ -32130,14 +32236,14 @@ var Fields = () => {
32130
32236
  const isLoading = selectedItem ? (_c = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _c.loading : (_d = componentState["puck-root"]) == null ? void 0 : _d.loading;
32131
32237
  const rootProps = data.root.props || data.root;
32132
32238
  const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32133
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32239
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32134
32240
  "form",
32135
32241
  {
32136
32242
  className: getClassName19(),
32137
32243
  onSubmit: (e) => {
32138
32244
  e.preventDefault();
32139
32245
  },
32140
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32246
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32141
32247
  const field = fields[fieldName];
32142
32248
  const onChange = (value, updatedUi) => {
32143
32249
  var _a2, _b2;
@@ -32203,7 +32309,7 @@ var Fields = () => {
32203
32309
  };
32204
32310
  if (selectedItem && itemSelector) {
32205
32311
  const { readOnly = {} } = selectedItem;
32206
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32312
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32207
32313
  InputOrGroup,
32208
32314
  {
32209
32315
  field,
@@ -32219,7 +32325,7 @@ var Fields = () => {
32219
32325
  );
32220
32326
  } else {
32221
32327
  const { readOnly = {} } = data.root;
32222
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32328
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32223
32329
  InputOrGroup,
32224
32330
  {
32225
32331
  field,
@@ -32254,14 +32360,15 @@ init_react_import();
32254
32360
  var styles_module_default15 = { "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" };
32255
32361
 
32256
32362
  // components/ComponentList/index.tsx
32257
- var import_jsx_runtime23 = require("react/jsx-runtime");
32363
+ var import_jsx_runtime24 = require("react/jsx-runtime");
32258
32364
  var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
32259
32365
  var ComponentListItem = ({
32260
32366
  name,
32367
+ label,
32261
32368
  index
32262
32369
  }) => {
32263
32370
  const { overrides } = useAppContext();
32264
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer.Item, { name, index, children: overrides.componentItem });
32371
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
32265
32372
  };
32266
32373
  var ComponentList = ({
32267
32374
  children,
@@ -32270,8 +32377,8 @@ var ComponentList = ({
32270
32377
  }) => {
32271
32378
  const { config, state, setUi } = useAppContext();
32272
32379
  const { expanded = true } = state.ui.componentList[id] || {};
32273
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32274
- title && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
32380
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32381
+ title && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
32275
32382
  "button",
32276
32383
  {
32277
32384
  className: getClassName20("title"),
@@ -32284,15 +32391,17 @@ var ComponentList = ({
32284
32391
  }),
32285
32392
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
32286
32393
  children: [
32287
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: title }),
32288
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChevronDown, { size: 12 }) })
32394
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: title }),
32395
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChevronDown, { size: 12 }) })
32289
32396
  ]
32290
32397
  }
32291
32398
  ),
32292
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
32293
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32399
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
32400
+ var _a;
32401
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32294
32402
  ComponentListItem,
32295
32403
  {
32404
+ label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
32296
32405
  name: componentKey,
32297
32406
  index: i
32298
32407
  },
@@ -32304,7 +32413,7 @@ var ComponentList = ({
32304
32413
  ComponentList.Item = ComponentListItem;
32305
32414
 
32306
32415
  // lib/use-component-list.tsx
32307
- var import_jsx_runtime24 = require("react/jsx-runtime");
32416
+ var import_jsx_runtime25 = require("react/jsx-runtime");
32308
32417
  var useComponentList = (config, ui) => {
32309
32418
  const [componentList, setComponentList] = (0, import_react20.useState)();
32310
32419
  (0, import_react20.useEffect)(() => {
@@ -32317,16 +32426,18 @@ var useComponentList = (config, ui) => {
32317
32426
  if (category.visible === false || !category.components) {
32318
32427
  return null;
32319
32428
  }
32320
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32429
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32321
32430
  ComponentList,
32322
32431
  {
32323
32432
  id: categoryKey,
32324
32433
  title: category.title || categoryKey,
32325
32434
  children: category.components.map((componentName, i) => {
32435
+ var _a2;
32326
32436
  matchedComponents.push(componentName);
32327
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32437
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32328
32438
  ComponentList.Item,
32329
32439
  {
32440
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32330
32441
  name: componentName,
32331
32442
  index: i
32332
32443
  },
@@ -32343,16 +32454,18 @@ var useComponentList = (config, ui) => {
32343
32454
  );
32344
32455
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
32345
32456
  _componentList.push(
32346
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32457
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32347
32458
  ComponentList,
32348
32459
  {
32349
32460
  id: "other",
32350
32461
  title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
32351
32462
  children: remainingComponents.map((componentName, i) => {
32352
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32463
+ var _a2;
32464
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32353
32465
  ComponentList.Item,
32354
32466
  {
32355
32467
  name: componentName,
32468
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32356
32469
  index: i
32357
32470
  },
32358
32471
  componentName
@@ -32365,24 +32478,32 @@ var useComponentList = (config, ui) => {
32365
32478
  }
32366
32479
  setComponentList(_componentList);
32367
32480
  }
32368
- }, [config.categories, ui.componentList]);
32481
+ }, [config.categories, config.components, ui.componentList]);
32369
32482
  return componentList;
32370
32483
  };
32371
32484
 
32372
32485
  // components/Puck/components/Components/index.tsx
32373
32486
  var import_react21 = require("react");
32374
- var import_jsx_runtime25 = require("react/jsx-runtime");
32487
+ var import_jsx_runtime26 = require("react/jsx-runtime");
32375
32488
  var Components = () => {
32376
32489
  const { config, state, overrides } = useAppContext();
32377
32490
  const componentList = useComponentList(config, state.ui);
32378
32491
  const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
32379
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComponentList, { id: "all" }) });
32492
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ComponentList, { id: "all" }) });
32380
32493
  };
32381
32494
 
32382
32495
  // components/Puck/components/Preview/index.tsx
32383
32496
  init_react_import();
32384
32497
  var import_react22 = require("react");
32385
- var import_jsx_runtime26 = require("react/jsx-runtime");
32498
+ var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
32499
+
32500
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
32501
+ init_react_import();
32502
+ var styles_module_default16 = { "PuckPreview": "_PuckPreview_29rm6_1", "PuckPreview-iframe": "_PuckPreview-iframe_29rm6_5" };
32503
+
32504
+ // components/Puck/components/Preview/index.tsx
32505
+ var import_jsx_runtime27 = require("react/jsx-runtime");
32506
+ var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
32386
32507
  var Preview = ({ id = "puck-preview" }) => {
32387
32508
  const { config, dispatch, state } = useAppContext();
32388
32509
  const Page = (0, import_react22.useCallback)(
@@ -32393,16 +32514,25 @@ var Preview = ({ id = "puck-preview" }) => {
32393
32514
  [config.root]
32394
32515
  );
32395
32516
  const rootProps = state.data.root.props || state.data.root;
32396
- const { disableZoom = false } = (0, import_react22.useContext)(dropZoneContext) || {};
32397
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32517
+ const ref = (0, import_react22.useRef)(null);
32518
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32398
32519
  "div",
32399
32520
  {
32521
+ className: getClassName21(),
32400
32522
  id,
32401
32523
  onClick: () => {
32402
32524
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
32403
32525
  },
32404
- style: { zoom: disableZoom ? 1 : 0.75 },
32405
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZone, { zone: rootDroppableId }) }))
32526
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32527
+ import_auto_frame_component.default,
32528
+ {
32529
+ id: "preview-iframe",
32530
+ className: getClassName21("iframe"),
32531
+ "data-rfd-iframe": true,
32532
+ ref,
32533
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZone, { zone: rootDroppableId }) }))
32534
+ }
32535
+ )
32406
32536
  }
32407
32537
  );
32408
32538
  };
@@ -32436,7 +32566,7 @@ init_react_import();
32436
32566
 
32437
32567
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
32438
32568
  init_react_import();
32439
- var styles_module_default16 = { "LayerTree": "_LayerTree_1pgw8_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1pgw8_11", "LayerTree-helper": "_LayerTree-helper_1pgw8_17", "Layer": "_Layer_1pgw8_1", "Layer-inner": "_Layer-inner_1pgw8_29", "Layer--containsZone": "_Layer--containsZone_1pgw8_35", "Layer-clickable": "_Layer-clickable_1pgw8_39", "Layer--isSelected": "_Layer--isSelected_1pgw8_61", "Layer-chevron": "_Layer-chevron_1pgw8_77", "Layer--childIsSelected": "_Layer--childIsSelected_1pgw8_78", "Layer-zones": "_Layer-zones_1pgw8_82", "Layer-title": "_Layer-title_1pgw8_96", "Layer-name": "_Layer-name_1pgw8_105", "Layer-icon": "_Layer-icon_1pgw8_111", "Layer-zoneIcon": "_Layer-zoneIcon_1pgw8_116" };
32569
+ var styles_module_default17 = { "LayerTree": "_LayerTree_1pgw8_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1pgw8_11", "LayerTree-helper": "_LayerTree-helper_1pgw8_17", "Layer": "_Layer_1pgw8_1", "Layer-inner": "_Layer-inner_1pgw8_29", "Layer--containsZone": "_Layer--containsZone_1pgw8_35", "Layer-clickable": "_Layer-clickable_1pgw8_39", "Layer--isSelected": "_Layer--isSelected_1pgw8_61", "Layer-chevron": "_Layer-chevron_1pgw8_77", "Layer--childIsSelected": "_Layer--childIsSelected_1pgw8_78", "Layer-zones": "_Layer-zones_1pgw8_82", "Layer-title": "_Layer-title_1pgw8_96", "Layer-name": "_Layer-name_1pgw8_105", "Layer-icon": "_Layer-icon_1pgw8_111", "Layer-zoneIcon": "_Layer-zoneIcon_1pgw8_116" };
32440
32570
 
32441
32571
  // lib/scroll-into-view.ts
32442
32572
  init_react_import();
@@ -32464,11 +32594,12 @@ var isChildOfZone = (item, maybeChild, ctx) => {
32464
32594
  };
32465
32595
 
32466
32596
  // components/LayerTree/index.tsx
32467
- var import_jsx_runtime27 = require("react/jsx-runtime");
32468
- var getClassName21 = get_class_name_factory_default("LayerTree", styles_module_default16);
32469
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default16);
32597
+ var import_jsx_runtime28 = require("react/jsx-runtime");
32598
+ var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
32599
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
32470
32600
  var LayerTree = ({
32471
32601
  data,
32602
+ config,
32472
32603
  zoneContent,
32473
32604
  itemSelector,
32474
32605
  setItemSelector,
@@ -32477,15 +32608,16 @@ var LayerTree = ({
32477
32608
  }) => {
32478
32609
  const zones = data.zones || {};
32479
32610
  const ctx = (0, import_react23.useContext)(dropZoneContext);
32480
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
32481
- label && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName21("zoneTitle"), children: [
32482
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Layers, { size: "16" }) }),
32611
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
32612
+ label && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
32613
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Layers, { size: "16" }) }),
32483
32614
  " ",
32484
32615
  label
32485
32616
  ] }),
32486
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("ul", { className: getClassName21(), children: [
32487
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("helper"), children: "No items" }),
32617
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("ul", { className: getClassName22(), children: [
32618
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
32488
32619
  zoneContent.map((item, i) => {
32620
+ var _a;
32489
32621
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
32490
32622
  const zonesForItem = findZonesForArea(data, item.props.id);
32491
32623
  const containsZone = Object.keys(zonesForItem).length > 0;
@@ -32499,7 +32631,7 @@ var LayerTree = ({
32499
32631
  const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
32500
32632
  const isHovering = hoveringComponent === item.props.id;
32501
32633
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
32502
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32634
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
32503
32635
  "li",
32504
32636
  {
32505
32637
  className: getClassNameLayer({
@@ -32509,7 +32641,7 @@ var LayerTree = ({
32509
32641
  childIsSelected
32510
32642
  }),
32511
32643
  children: [
32512
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32644
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
32513
32645
  "button",
32514
32646
  {
32515
32647
  className: getClassNameLayer("clickable"),
@@ -32523,8 +32655,14 @@ var LayerTree = ({
32523
32655
  zone
32524
32656
  });
32525
32657
  const id = zoneContent[i].props.id;
32658
+ const iframe = document.querySelector("#preview-iframe");
32659
+ if (!(iframe == null ? void 0 : iframe.contentDocument)) {
32660
+ throw new Error(
32661
+ `Preview iframe could not be found when trying to scroll to item ${id}`
32662
+ );
32663
+ }
32526
32664
  scrollIntoView(
32527
- document.querySelector(
32665
+ iframe.contentDocument.querySelector(
32528
32666
  `[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
32529
32667
  )
32530
32668
  );
@@ -32540,24 +32678,25 @@ var LayerTree = ({
32540
32678
  setHoveringComponent(null);
32541
32679
  },
32542
32680
  children: [
32543
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32681
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32544
32682
  "div",
32545
32683
  {
32546
32684
  className: getClassNameLayer("chevron"),
32547
32685
  title: isSelected ? "Collapse" : "Expand",
32548
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDown, { size: "12" })
32686
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronDown, { size: "12" })
32549
32687
  }
32550
32688
  ),
32551
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassNameLayer("title"), children: [
32552
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LayoutGrid, { size: "16" }) }),
32553
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
32689
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassNameLayer("title"), children: [
32690
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LayoutGrid, { size: "16" }) }),
32691
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
32554
32692
  ] })
32555
32693
  ]
32556
32694
  }
32557
32695
  ) }),
32558
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32696
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32559
32697
  LayerTree,
32560
32698
  {
32699
+ config,
32561
32700
  data,
32562
32701
  zoneContent: zones[zoneKey],
32563
32702
  setItemSelector,
@@ -32577,9 +32716,9 @@ var LayerTree = ({
32577
32716
 
32578
32717
  // components/Puck/components/Outline/index.tsx
32579
32718
  var import_react24 = require("react");
32580
- var import_jsx_runtime28 = require("react/jsx-runtime");
32719
+ var import_jsx_runtime29 = require("react/jsx-runtime");
32581
32720
  var Outline = () => {
32582
- const { dispatch, state, overrides } = useAppContext();
32721
+ const { dispatch, state, overrides, config } = useAppContext();
32583
32722
  const { data, ui } = state;
32584
32723
  const { itemSelector } = ui;
32585
32724
  const setItemSelector = (0, import_react24.useCallback)(
@@ -32592,10 +32731,11 @@ var Outline = () => {
32592
32731
  []
32593
32732
  );
32594
32733
  const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
32595
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
32596
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32734
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
32735
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32597
32736
  LayerTree,
32598
32737
  {
32738
+ config,
32599
32739
  data,
32600
32740
  label: areaContainsZones(data, "root") ? rootDroppableId : "",
32601
32741
  zoneContent: data.content,
@@ -32605,9 +32745,10 @@ var Outline = () => {
32605
32745
  ),
32606
32746
  Object.entries(findZonesForArea(data, "root")).map(
32607
32747
  ([zoneKey, zone]) => {
32608
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32748
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32609
32749
  LayerTree,
32610
32750
  {
32751
+ config,
32611
32752
  data,
32612
32753
  label: zoneKey,
32613
32754
  zone: zoneKey,
@@ -32731,14 +32872,421 @@ function useHistoryStore() {
32731
32872
  };
32732
32873
  }
32733
32874
 
32875
+ // components/Puck/components/Canvas/index.tsx
32876
+ init_react_import();
32877
+
32878
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
32879
+ init_react_import();
32880
+
32881
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
32882
+ init_react_import();
32883
+ var isProduction = process.env.NODE_ENV === "production";
32884
+ var prefix = "Invariant failed";
32885
+ function invariant(condition, message) {
32886
+ if (condition) {
32887
+ return;
32888
+ }
32889
+ if (isProduction) {
32890
+ throw new Error(prefix);
32891
+ }
32892
+ var provided = typeof message === "function" ? message() : message;
32893
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
32894
+ throw new Error(value);
32895
+ }
32896
+
32897
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
32898
+ var getRect = function getRect2(_ref) {
32899
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
32900
+ var width = right - left;
32901
+ var height = bottom - top;
32902
+ var rect = {
32903
+ top,
32904
+ right,
32905
+ bottom,
32906
+ left,
32907
+ width,
32908
+ height,
32909
+ x: left,
32910
+ y: top,
32911
+ center: {
32912
+ x: (right + left) / 2,
32913
+ y: (bottom + top) / 2
32914
+ }
32915
+ };
32916
+ return rect;
32917
+ };
32918
+ var expand = function expand2(target, expandBy) {
32919
+ return {
32920
+ top: target.top - expandBy.top,
32921
+ left: target.left - expandBy.left,
32922
+ bottom: target.bottom + expandBy.bottom,
32923
+ right: target.right + expandBy.right
32924
+ };
32925
+ };
32926
+ var shrink = function shrink2(target, shrinkBy) {
32927
+ return {
32928
+ top: target.top + shrinkBy.top,
32929
+ left: target.left + shrinkBy.left,
32930
+ bottom: target.bottom - shrinkBy.bottom,
32931
+ right: target.right - shrinkBy.right
32932
+ };
32933
+ };
32934
+ var noSpacing = {
32935
+ top: 0,
32936
+ right: 0,
32937
+ bottom: 0,
32938
+ left: 0
32939
+ };
32940
+ var createBox = function createBox2(_ref2) {
32941
+ var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
32942
+ var marginBox = getRect(expand(borderBox, margin));
32943
+ var paddingBox = getRect(shrink(borderBox, border));
32944
+ var contentBox = getRect(shrink(paddingBox, padding));
32945
+ return {
32946
+ marginBox,
32947
+ borderBox: getRect(borderBox),
32948
+ paddingBox,
32949
+ contentBox,
32950
+ margin,
32951
+ border,
32952
+ padding
32953
+ };
32954
+ };
32955
+ var parse = function parse2(raw) {
32956
+ var value = raw.slice(0, -2);
32957
+ var suffix = raw.slice(-2);
32958
+ if (suffix !== "px") {
32959
+ return 0;
32960
+ }
32961
+ var result = Number(value);
32962
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
32963
+ return result;
32964
+ };
32965
+ var calculateBox = function calculateBox2(borderBox, styles) {
32966
+ var margin = {
32967
+ top: parse(styles.marginTop),
32968
+ right: parse(styles.marginRight),
32969
+ bottom: parse(styles.marginBottom),
32970
+ left: parse(styles.marginLeft)
32971
+ };
32972
+ var padding = {
32973
+ top: parse(styles.paddingTop),
32974
+ right: parse(styles.paddingRight),
32975
+ bottom: parse(styles.paddingBottom),
32976
+ left: parse(styles.paddingLeft)
32977
+ };
32978
+ var border = {
32979
+ top: parse(styles.borderTopWidth),
32980
+ right: parse(styles.borderRightWidth),
32981
+ bottom: parse(styles.borderBottomWidth),
32982
+ left: parse(styles.borderLeftWidth)
32983
+ };
32984
+ return createBox({
32985
+ borderBox,
32986
+ margin,
32987
+ padding,
32988
+ border
32989
+ });
32990
+ };
32991
+ var getBox = function getBox2(el) {
32992
+ var borderBox = el.getBoundingClientRect();
32993
+ var styles = window.getComputedStyle(el);
32994
+ return calculateBox(borderBox, styles);
32995
+ };
32996
+
32997
+ // components/Puck/components/Canvas/index.tsx
32998
+ var import_react27 = require("react");
32999
+
33000
+ // components/ViewportControls/index.tsx
33001
+ init_react_import();
33002
+ var import_react26 = require("react");
33003
+
33004
+ // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
33005
+ init_react_import();
33006
+ var styles_module_default18 = { "ViewportControls": "_ViewportControls_14bhf_1", "ViewportControls-divider": "_ViewportControls-divider_14bhf_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_14bhf_21", "ViewportButton--isActive": "_ViewportButton--isActive_14bhf_33", "ViewportButton-inner": "_ViewportButton-inner_14bhf_33" };
33007
+
33008
+ // components/ViewportControls/index.tsx
33009
+ var import_jsx_runtime30 = require("react/jsx-runtime");
33010
+ var icons = {
33011
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Smartphone, { size: 16 }),
33012
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Tablet, { size: 16 }),
33013
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Monitor, { size: 16 })
33014
+ };
33015
+ var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
33016
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
33017
+ var ViewportButton = ({
33018
+ children,
33019
+ height = "auto",
33020
+ title,
33021
+ width,
33022
+ onClick
33023
+ }) => {
33024
+ const { state } = useAppContext();
33025
+ const isActive = width === state.ui.viewports.current.width;
33026
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33027
+ IconButton,
33028
+ {
33029
+ title,
33030
+ disabled: isActive,
33031
+ onClick: (e) => {
33032
+ e.stopPropagation();
33033
+ onClick({ width, height });
33034
+ },
33035
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: getClassNameButton("inner"), children })
33036
+ }
33037
+ ) });
33038
+ };
33039
+ var defaultZoomOptions = [
33040
+ { label: "25%", value: 0.25 },
33041
+ { label: "50%", value: 0.5 },
33042
+ { label: "75%", value: 0.75 },
33043
+ { label: "100%", value: 1 },
33044
+ { label: "125%", value: 1.25 },
33045
+ { label: "150%", value: 1.5 },
33046
+ { label: "200%", value: 2 }
33047
+ ];
33048
+ var ViewportControls = ({
33049
+ autoZoom,
33050
+ zoom,
33051
+ onViewportChange,
33052
+ onZoom
33053
+ }) => {
33054
+ const { state, viewports } = useAppContext();
33055
+ const viewport = state.ui.viewports.current;
33056
+ const defaultsContainAutoZoom = defaultZoomOptions.find(
33057
+ (option) => option.value === autoZoom
33058
+ );
33059
+ const zoomOptions = (0, import_react26.useMemo)(
33060
+ () => [
33061
+ ...defaultZoomOptions,
33062
+ ...defaultsContainAutoZoom ? [] : [
33063
+ {
33064
+ value: autoZoom,
33065
+ label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
33066
+ }
33067
+ ]
33068
+ ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
33069
+ [autoZoom]
33070
+ );
33071
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName23(), children: [
33072
+ viewports.map((viewport2, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33073
+ ViewportButton,
33074
+ {
33075
+ height: viewport2.height,
33076
+ width: viewport2.width,
33077
+ title: viewport2.label ? `Switch to ${viewport2.label} viewport` : "Switch viewport",
33078
+ onClick: onViewportChange,
33079
+ children: typeof viewport2.icon === "string" ? icons[viewport2.icon] || viewport2.icon : viewport2.icon || icons.Smartphone
33080
+ },
33081
+ i
33082
+ )),
33083
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName23("divider") }),
33084
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33085
+ IconButton,
33086
+ {
33087
+ title: "Zoom viewport out",
33088
+ disabled: zoom <= zoomOptions[0].value,
33089
+ onClick: (e) => {
33090
+ e.stopPropagation();
33091
+ onZoom(
33092
+ zoomOptions[Math.max(
33093
+ zoomOptions.findIndex((option) => option.value === zoom) - 1,
33094
+ 0
33095
+ )].value
33096
+ );
33097
+ },
33098
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ZoomOut, { size: 16 })
33099
+ }
33100
+ ),
33101
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33102
+ IconButton,
33103
+ {
33104
+ title: "Zoom viewport in",
33105
+ disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
33106
+ onClick: (e) => {
33107
+ e.stopPropagation();
33108
+ onZoom(
33109
+ zoomOptions[Math.min(
33110
+ zoomOptions.findIndex((option) => option.value === zoom) + 1,
33111
+ zoomOptions.length - 1
33112
+ )].value
33113
+ );
33114
+ },
33115
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ZoomIn, { size: 16 })
33116
+ }
33117
+ ),
33118
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName23("divider") }),
33119
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33120
+ "select",
33121
+ {
33122
+ className: getClassName23("zoomSelect"),
33123
+ value: zoom.toString(),
33124
+ onChange: (e) => {
33125
+ onZoom(parseFloat(e.currentTarget.value));
33126
+ },
33127
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33128
+ "option",
33129
+ {
33130
+ value: option.value,
33131
+ label: option.label
33132
+ },
33133
+ option.label
33134
+ ))
33135
+ }
33136
+ )
33137
+ ] });
33138
+ };
33139
+
33140
+ // lib/get-zoom-config.ts
33141
+ init_react_import();
33142
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
33143
+ var getZoomConfig = (uiViewport, frame, zoom) => {
33144
+ const box = getBox(frame);
33145
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
33146
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
33147
+ let rootHeight = 0;
33148
+ let autoZoom = 1;
33149
+ if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
33150
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
33151
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
33152
+ zoom = widthZoom;
33153
+ if (widthZoom < heightZoom) {
33154
+ rootHeight = viewportHeight / zoom;
33155
+ } else {
33156
+ rootHeight = viewportHeight;
33157
+ zoom = heightZoom;
33158
+ }
33159
+ autoZoom = zoom;
33160
+ } else {
33161
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
33162
+ autoZoom = 1;
33163
+ zoom = 1;
33164
+ rootHeight = viewportHeight;
33165
+ }
33166
+ }
33167
+ return { autoZoom, rootHeight, zoom };
33168
+ };
33169
+
33170
+ // components/Puck/components/Canvas/index.tsx
33171
+ var import_jsx_runtime31 = require("react/jsx-runtime");
33172
+ var getClassName24 = get_class_name_factory_default("Puck", styles_module_default8);
33173
+ var ZOOM_ON_CHANGE = true;
33174
+ var Canvas = () => {
33175
+ const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
33176
+ const { ui } = state;
33177
+ const frameRef = (0, import_react27.useRef)(null);
33178
+ const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
33179
+ const defaultRender = (0, import_react27.useMemo)(() => {
33180
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
33181
+ return PuckDefault;
33182
+ }, []);
33183
+ const CustomPreview = (0, import_react27.useMemo)(
33184
+ () => overrides.preview || defaultRender,
33185
+ [overrides]
33186
+ );
33187
+ const getFrameDimensions = (0, import_react27.useCallback)(() => {
33188
+ if (frameRef.current) {
33189
+ const frame = frameRef.current;
33190
+ const box = getBox(frame);
33191
+ return { width: box.contentBox.width, height: box.contentBox.height };
33192
+ }
33193
+ return { width: 0, height: 0 };
33194
+ }, [frameRef]);
33195
+ const resetAutoZoom = (0, import_react27.useCallback)(
33196
+ (ui2 = state.ui) => {
33197
+ if (frameRef.current) {
33198
+ setZoomConfig(
33199
+ getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
33200
+ );
33201
+ }
33202
+ },
33203
+ [frameRef, zoomConfig, state.ui]
33204
+ );
33205
+ (0, import_react27.useEffect)(() => {
33206
+ setShowTransition(false);
33207
+ resetAutoZoom();
33208
+ }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
33209
+ (0, import_react27.useEffect)(() => {
33210
+ const { height: frameHeight } = getFrameDimensions();
33211
+ if (ui.viewports.current.height === "auto") {
33212
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
33213
+ rootHeight: frameHeight / zoomConfig.zoom
33214
+ }));
33215
+ }
33216
+ }, [zoomConfig.zoom]);
33217
+ (0, import_react27.useEffect)(() => {
33218
+ const observer = new ResizeObserver(() => {
33219
+ setShowTransition(false);
33220
+ resetAutoZoom();
33221
+ });
33222
+ if (document.body) {
33223
+ observer.observe(document.body);
33224
+ }
33225
+ return () => {
33226
+ observer.disconnect();
33227
+ };
33228
+ }, []);
33229
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
33230
+ "div",
33231
+ {
33232
+ className: getClassName24("canvas"),
33233
+ onClick: () => dispatch({
33234
+ type: "setUi",
33235
+ ui: { itemSelector: null },
33236
+ recordHistory: true
33237
+ }),
33238
+ children: [
33239
+ ui.viewports.controlsVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName24("canvasControls"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
33240
+ ViewportControls,
33241
+ {
33242
+ autoZoom: zoomConfig.autoZoom,
33243
+ zoom: zoomConfig.zoom,
33244
+ onViewportChange: (viewport) => {
33245
+ setShowTransition(true);
33246
+ const uiViewport = __spreadProps(__spreadValues({}, viewport), {
33247
+ height: viewport.height || "auto",
33248
+ zoom: zoomConfig.zoom
33249
+ });
33250
+ const newUi = __spreadProps(__spreadValues({}, ui), {
33251
+ viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
33252
+ });
33253
+ setUi(newUi);
33254
+ if (ZOOM_ON_CHANGE) {
33255
+ resetAutoZoom(newUi);
33256
+ }
33257
+ },
33258
+ onZoom: (zoom) => {
33259
+ setShowTransition(true);
33260
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
33261
+ }
33262
+ }
33263
+ ) }),
33264
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName24("frame"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
33265
+ "div",
33266
+ {
33267
+ className: getClassName24("root"),
33268
+ style: {
33269
+ width: ui.viewports.current.width,
33270
+ height: zoomConfig.rootHeight,
33271
+ transform: `scale(${zoomConfig.zoom})`,
33272
+ transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : ""
33273
+ },
33274
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Preview, {}) })
33275
+ }
33276
+ ) })
33277
+ ]
33278
+ }
33279
+ );
33280
+ };
33281
+
32734
33282
  // components/Puck/index.tsx
32735
- var import_jsx_runtime29 = require("react/jsx-runtime");
32736
- var getClassName22 = get_class_name_factory_default("Puck", styles_module_default8);
33283
+ var import_jsx_runtime32 = require("react/jsx-runtime");
33284
+ var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
32737
33285
  function Puck({
32738
33286
  children,
32739
33287
  config,
32740
33288
  data: initialData = { content: [], root: { props: { title: "" } } },
32741
- ui: initialUi = defaultAppState.ui,
33289
+ ui: initialUi,
32742
33290
  onChange,
32743
33291
  onPublish,
32744
33292
  plugins = [],
@@ -32746,32 +33294,58 @@ function Puck({
32746
33294
  renderHeader,
32747
33295
  renderHeaderActions,
32748
33296
  headerTitle,
32749
- headerPath
33297
+ headerPath,
33298
+ viewports = defaultViewports
32750
33299
  }) {
33300
+ var _a;
32751
33301
  const historyStore = useHistoryStore();
32752
- const [reducer] = (0, import_react26.useState)(
33302
+ const [reducer] = (0, import_react28.useState)(
32753
33303
  () => createReducer({ config, record: historyStore.record })
32754
33304
  );
32755
- const [initialAppState] = (0, import_react26.useState)(() => __spreadProps(__spreadValues({}, defaultAppState), {
32756
- data: initialData,
32757
- ui: __spreadProps(__spreadValues(__spreadValues({}, defaultAppState.ui), initialUi), {
32758
- // Store categories under componentList on state to allow render functions and plugins to modify
32759
- componentList: config.categories ? Object.entries(config.categories).reduce(
32760
- (acc, [categoryName, category]) => {
32761
- return __spreadProps(__spreadValues({}, acc), {
32762
- [categoryName]: {
32763
- title: category.title,
32764
- components: category.components,
32765
- expanded: category.defaultExpanded,
32766
- visible: category.visible
32767
- }
32768
- });
32769
- },
32770
- {}
32771
- ) : {}
32772
- })
32773
- }));
32774
- const [appState, dispatch] = (0, import_react26.useReducer)(
33305
+ const [initialAppState] = (0, import_react28.useState)(() => {
33306
+ var _a2, _b, _c, _d;
33307
+ const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
33308
+ let clientUiState = {};
33309
+ if (typeof window !== "undefined") {
33310
+ const viewportWidth = window.innerWidth;
33311
+ const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
33312
+ key,
33313
+ diff: Math.abs(viewportWidth - value.width)
33314
+ })).sort((a, b) => a.diff > b.diff ? 1 : -1);
33315
+ const closestViewport = viewportDifferences[0].key;
33316
+ clientUiState = __spreadProps(__spreadValues({}, window.matchMedia("(min-width: 638px)").matches ? {} : {
33317
+ leftSideBarVisible: false,
33318
+ rightSideBarVisible: false
33319
+ }), {
33320
+ viewports: __spreadProps(__spreadValues({}, initial.viewports), {
33321
+ current: __spreadProps(__spreadValues({}, initial.viewports.current), {
33322
+ height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
33323
+ width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
33324
+ })
33325
+ })
33326
+ });
33327
+ }
33328
+ return __spreadProps(__spreadValues({}, defaultAppState), {
33329
+ data: initialData,
33330
+ ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
33331
+ // Store categories under componentList on state to allow render functions and plugins to modify
33332
+ componentList: config.categories ? Object.entries(config.categories).reduce(
33333
+ (acc, [categoryName, category]) => {
33334
+ return __spreadProps(__spreadValues({}, acc), {
33335
+ [categoryName]: {
33336
+ title: category.title,
33337
+ components: category.components,
33338
+ expanded: category.defaultExpanded,
33339
+ visible: category.visible
33340
+ }
33341
+ });
33342
+ },
33343
+ {}
33344
+ ) : {}
33345
+ })
33346
+ });
33347
+ });
33348
+ const [appState, dispatch] = (0, import_react28.useReducer)(
32775
33349
  reducer,
32776
33350
  flushZones(initialAppState)
32777
33351
  );
@@ -32782,9 +33356,9 @@ function Puck({
32782
33356
  config,
32783
33357
  dispatch
32784
33358
  );
32785
- const [menuOpen, setMenuOpen] = (0, import_react26.useState)(false);
33359
+ const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
32786
33360
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
32787
- const setItemSelector = (0, import_react26.useCallback)(
33361
+ const setItemSelector = (0, import_react28.useCallback)(
32788
33362
  (newItemSelector) => {
32789
33363
  if (newItemSelector === itemSelector)
32790
33364
  return;
@@ -32797,21 +33371,21 @@ function Puck({
32797
33371
  [itemSelector]
32798
33372
  );
32799
33373
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
32800
- (0, import_react26.useEffect)(() => {
33374
+ (0, import_react28.useEffect)(() => {
32801
33375
  if (onChange)
32802
33376
  onChange(data);
32803
33377
  }, [data]);
32804
33378
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
32805
- const [draggedItem, setDraggedItem] = (0, import_react26.useState)();
33379
+ const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
32806
33380
  const rootProps = data.root.props || data.root;
32807
- (0, import_react26.useEffect)(() => {
33381
+ (0, import_react28.useEffect)(() => {
32808
33382
  if (Object.keys(data.root).length > 0 && !data.root.props) {
32809
33383
  console.error(
32810
33384
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
32811
33385
  );
32812
33386
  }
32813
33387
  }, []);
32814
- const toggleSidebars = (0, import_react26.useCallback)(
33388
+ const toggleSidebars = (0, import_react28.useCallback)(
32815
33389
  (sidebar) => {
32816
33390
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
32817
33391
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -32825,7 +33399,7 @@ function Puck({
32825
33399
  },
32826
33400
  [dispatch, leftSideBarVisible, rightSideBarVisible]
32827
33401
  );
32828
- (0, import_react26.useEffect)(() => {
33402
+ (0, import_react28.useEffect)(() => {
32829
33403
  if (!window.matchMedia("(min-width: 638px)").matches) {
32830
33404
  dispatch({
32831
33405
  type: "setUi",
@@ -32848,59 +33422,54 @@ function Puck({
32848
33422
  window.removeEventListener("resize", handleResize);
32849
33423
  };
32850
33424
  }, []);
32851
- const defaultRender = (0, import_react26.useMemo)(() => {
32852
- const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: children2 });
33425
+ const defaultRender = (0, import_react28.useMemo)(() => {
33426
+ const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: children2 });
32853
33427
  return PuckDefault;
32854
33428
  }, []);
32855
- const defaultHeaderRender = (0, import_react26.useMemo)(() => {
33429
+ const defaultHeaderRender = (0, import_react28.useMemo)(() => {
32856
33430
  if (renderHeader) {
32857
33431
  console.warn(
32858
33432
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
32859
33433
  );
32860
- const RenderHeader = (_a) => {
32861
- var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
33434
+ const RenderHeader = (_a2) => {
33435
+ var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
32862
33436
  const Comp = renderHeader;
32863
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
33437
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
32864
33438
  };
32865
33439
  return RenderHeader;
32866
33440
  }
32867
33441
  return defaultRender;
32868
33442
  }, [renderHeader]);
32869
- const defaultHeaderActionsRender = (0, import_react26.useMemo)(() => {
33443
+ const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
32870
33444
  if (renderHeaderActions) {
32871
33445
  console.warn(
32872
33446
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
32873
33447
  );
32874
33448
  const RenderHeader = (props) => {
32875
33449
  const Comp = renderHeaderActions;
32876
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
33450
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
32877
33451
  };
32878
33452
  return RenderHeader;
32879
33453
  }
32880
33454
  return defaultRender;
32881
33455
  }, [renderHeader]);
32882
- const loadedOverrides = (0, import_react26.useMemo)(() => {
33456
+ const loadedOverrides = (0, import_react28.useMemo)(() => {
32883
33457
  return loadOverrides({ overrides, plugins });
32884
33458
  }, [plugins]);
32885
- const CustomPuck = (0, import_react26.useMemo)(
33459
+ const CustomPuck = (0, import_react28.useMemo)(
32886
33460
  () => loadedOverrides.puck || defaultRender,
32887
33461
  [loadedOverrides]
32888
33462
  );
32889
- const CustomPreview = (0, import_react26.useMemo)(
32890
- () => loadedOverrides.preview || defaultRender,
32891
- [loadedOverrides]
32892
- );
32893
- const CustomHeader = (0, import_react26.useMemo)(
33463
+ const CustomHeader = (0, import_react28.useMemo)(
32894
33464
  () => loadedOverrides.header || defaultHeaderRender,
32895
33465
  [loadedOverrides]
32896
33466
  );
32897
- const CustomHeaderActions = (0, import_react26.useMemo)(
33467
+ const CustomHeaderActions = (0, import_react28.useMemo)(
32898
33468
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
32899
33469
  [loadedOverrides]
32900
33470
  );
32901
- const disableZoom = children || loadedOverrides.puck ? true : false;
32902
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "Puck", children: [
32903
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33471
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "Puck", children: [
33472
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32904
33473
  AppProvider,
32905
33474
  {
32906
33475
  value: {
@@ -32911,9 +33480,10 @@ function Puck({
32911
33480
  resolveData,
32912
33481
  plugins,
32913
33482
  overrides: loadedOverrides,
32914
- history
33483
+ history,
33484
+ viewports
32915
33485
  },
32916
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33486
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32917
33487
  import_dnd7.DragDropContext,
32918
33488
  {
32919
33489
  onDragUpdate: (update) => {
@@ -32968,7 +33538,7 @@ function Puck({
32968
33538
  });
32969
33539
  }
32970
33540
  },
32971
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33541
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32972
33542
  DropZoneProvider,
32973
33543
  {
32974
33544
  value: {
@@ -32980,77 +33550,75 @@ function Puck({
32980
33550
  draggedItem,
32981
33551
  placeholderStyle,
32982
33552
  mode: "edit",
32983
- areaId: "root",
32984
- disableZoom
33553
+ areaId: "root"
32985
33554
  },
32986
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33555
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
32987
33556
  "div",
32988
33557
  {
32989
- className: getClassName22({
33558
+ className: getClassName25({
32990
33559
  leftSideBarVisible,
32991
33560
  menuOpen,
32992
- rightSideBarVisible,
32993
- disableZoom
33561
+ rightSideBarVisible
32994
33562
  }),
32995
33563
  children: [
32996
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33564
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32997
33565
  CustomHeader,
32998
33566
  {
32999
- actions: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
33000
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
33001
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33567
+ actions: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
33568
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CustomHeaderActions, {}),
33569
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33002
33570
  Button,
33003
33571
  {
33004
33572
  onClick: () => {
33005
33573
  onPublish && onPublish(data);
33006
33574
  },
33007
- icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Globe, { size: "14px" }),
33575
+ icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Globe, { size: "14px" }),
33008
33576
  children: "Publish"
33009
33577
  }
33010
33578
  )
33011
33579
  ] }),
33012
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("header", { className: getClassName22("header"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerInner"), children: [
33013
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerToggle"), children: [
33014
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33580
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName25("headerInner"), children: [
33581
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33582
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33015
33583
  IconButton,
33016
33584
  {
33017
33585
  onClick: () => {
33018
33586
  toggleSidebars("left");
33019
33587
  },
33020
33588
  title: "Toggle left sidebar",
33021
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelLeft, { focusable: "false" })
33589
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelLeft, { focusable: "false" })
33022
33590
  }
33023
33591
  ) }),
33024
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33592
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33025
33593
  IconButton,
33026
33594
  {
33027
33595
  onClick: () => {
33028
33596
  toggleSidebars("right");
33029
33597
  },
33030
33598
  title: "Toggle right sidebar",
33031
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelRight, { focusable: "false" })
33599
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelRight, { focusable: "false" })
33032
33600
  }
33033
33601
  ) })
33034
33602
  ] }),
33035
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Heading, { rank: 2, size: "xs", children: [
33603
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Heading, { rank: 2, size: "xs", children: [
33036
33604
  headerTitle || rootProps.title || "Page",
33037
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
33605
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
33038
33606
  " ",
33039
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("code", { className: getClassName22("headerPath"), children: headerPath })
33607
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
33040
33608
  ] })
33041
33609
  ] }) }),
33042
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerTools"), children: [
33043
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33610
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName25("headerTools"), children: [
33611
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33044
33612
  IconButton,
33045
33613
  {
33046
33614
  onClick: () => {
33047
33615
  return setMenuOpen(!menuOpen);
33048
33616
  },
33049
33617
  title: "Toggle menu bar",
33050
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { focusable: "false" })
33618
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronDown, { focusable: "false" })
33051
33619
  }
33052
33620
  ) }),
33053
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33621
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33054
33622
  MenuBar,
33055
33623
  {
33056
33624
  appState,
@@ -33058,7 +33626,7 @@ function Puck({
33058
33626
  dispatch,
33059
33627
  onPublish,
33060
33628
  menuOpen,
33061
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
33629
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CustomHeaderActions, {}),
33062
33630
  setMenuOpen
33063
33631
  }
33064
33632
  )
@@ -33066,38 +33634,19 @@ function Puck({
33066
33634
  ] }) })
33067
33635
  }
33068
33636
  ),
33069
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("leftSideBar"), children: [
33070
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Components, {}) }),
33071
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Outline, {}) })
33637
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
33638
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Components, {}) }),
33639
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Outline, {}) })
33072
33640
  ] }),
33073
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33074
- "div",
33075
- {
33076
- className: getClassName22("frame"),
33077
- onClick: () => setItemSelector(null),
33078
- children: [
33079
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("root"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Preview, {}) }) }),
33080
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33081
- "div",
33082
- {
33083
- style: {
33084
- background: "var(--puck-color-grey-11)",
33085
- height: "100%",
33086
- flexGrow: 1
33087
- }
33088
- }
33089
- )
33090
- ]
33091
- }
33092
- ),
33093
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33641
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Canvas, {}),
33642
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33094
33643
  SidebarSection,
33095
33644
  {
33096
33645
  noPadding: true,
33097
33646
  noBorderTop: true,
33098
33647
  showBreadcrumbs: true,
33099
- title: selectedItem ? selectedItem.type : "Page",
33100
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Fields, {})
33648
+ title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
33649
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Fields, {})
33101
33650
  }
33102
33651
  ) })
33103
33652
  ]
@@ -33109,7 +33658,7 @@ function Puck({
33109
33658
  )
33110
33659
  }
33111
33660
  ),
33112
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "puck-portal-root" })
33661
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { id: "puck-portal-root" })
33113
33662
  ] });
33114
33663
  }
33115
33664
  Puck.Components = Components;
@@ -33119,13 +33668,13 @@ Puck.Preview = Preview;
33119
33668
 
33120
33669
  // components/Render/index.tsx
33121
33670
  init_react_import();
33122
- var import_jsx_runtime30 = require("react/jsx-runtime");
33671
+ var import_jsx_runtime33 = require("react/jsx-runtime");
33123
33672
  function Render({ config, data }) {
33124
33673
  var _a;
33125
33674
  const rootProps = data.root.props || data.root;
33126
33675
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
33127
33676
  if ((_a = config.root) == null ? void 0 : _a.render) {
33128
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33677
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33129
33678
  config.root.render,
33130
33679
  __spreadProps(__spreadValues({}, rootProps), {
33131
33680
  puck: {
@@ -33134,11 +33683,11 @@ function Render({ config, data }) {
33134
33683
  title,
33135
33684
  editMode: false,
33136
33685
  id: "puck-root",
33137
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId })
33686
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
33138
33687
  })
33139
33688
  ) });
33140
33689
  }
33141
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) });
33690
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId }) });
33142
33691
  }
33143
33692
 
33144
33693
  // lib/migrate.ts
@@ -33433,6 +33982,14 @@ lucide-react/dist/esm/icons/lock.js:
33433
33982
  * See the LICENSE file in the root directory of this source tree.
33434
33983
  *)
33435
33984
 
33985
+ lucide-react/dist/esm/icons/monitor.js:
33986
+ (**
33987
+ * @license lucide-react v0.298.0 - ISC
33988
+ *
33989
+ * This source code is licensed under the ISC license.
33990
+ * See the LICENSE file in the root directory of this source tree.
33991
+ *)
33992
+
33436
33993
  lucide-react/dist/esm/icons/more-vertical.js:
33437
33994
  (**
33438
33995
  * @license lucide-react v0.298.0 - ISC
@@ -33481,6 +34038,22 @@ lucide-react/dist/esm/icons/sliders-horizontal.js:
33481
34038
  * See the LICENSE file in the root directory of this source tree.
33482
34039
  *)
33483
34040
 
34041
+ lucide-react/dist/esm/icons/smartphone.js:
34042
+ (**
34043
+ * @license lucide-react v0.298.0 - ISC
34044
+ *
34045
+ * This source code is licensed under the ISC license.
34046
+ * See the LICENSE file in the root directory of this source tree.
34047
+ *)
34048
+
34049
+ lucide-react/dist/esm/icons/tablet.js:
34050
+ (**
34051
+ * @license lucide-react v0.298.0 - ISC
34052
+ *
34053
+ * This source code is licensed under the ISC license.
34054
+ * See the LICENSE file in the root directory of this source tree.
34055
+ *)
34056
+
33484
34057
  lucide-react/dist/esm/icons/trash.js:
33485
34058
  (**
33486
34059
  * @license lucide-react v0.298.0 - ISC
@@ -33505,6 +34078,22 @@ lucide-react/dist/esm/icons/unlock.js:
33505
34078
  * See the LICENSE file in the root directory of this source tree.
33506
34079
  *)
33507
34080
 
34081
+ lucide-react/dist/esm/icons/zoom-in.js:
34082
+ (**
34083
+ * @license lucide-react v0.298.0 - ISC
34084
+ *
34085
+ * This source code is licensed under the ISC license.
34086
+ * See the LICENSE file in the root directory of this source tree.
34087
+ *)
34088
+
34089
+ lucide-react/dist/esm/icons/zoom-out.js:
34090
+ (**
34091
+ * @license lucide-react v0.298.0 - ISC
34092
+ *
34093
+ * This source code is licensed under the ISC license.
34094
+ * See the LICENSE file in the root directory of this source tree.
34095
+ *)
34096
+
33508
34097
  lucide-react/dist/esm/lucide-react.js:
33509
34098
  (**
33510
34099
  * @license lucide-react v0.298.0 - ISC