@measured/puck 0.14.0-canary.f975d87 → 0.14.0

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 Fragment14 = 7;
8087
+ var Fragment17 = 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 Fragment14:
9243
+ case Fragment17:
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 !== Fragment14) {
18914
+ if (current2 === null || current2.tag !== Fragment17) {
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 === Fragment14) {
19317
+ if (child.tag === Fragment17) {
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 Fragment14:
23492
+ case Fragment17:
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 Fragment14:
23765
+ case Fragment17:
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(Fragment14, elements, key, mode);
28024
+ var fiber = createFiber(Fragment17, elements, key, mode);
28025
28025
  fiber.lanes = lanes;
28026
28026
  return fiber;
28027
28027
  }
@@ -29173,7 +29173,7 @@ var import_react2 = require("react");
29173
29173
 
29174
29174
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
29175
29175
  init_react_import();
29176
- var Button_module_default = { "Button": "_Button_1hb69_1", "Button--medium": "_Button--medium_1hb69_29", "Button--large": "_Button--large_1hb69_37", "Button-icon": "_Button-icon_1hb69_44", "Button--primary": "_Button--primary_1hb69_48", "Button--secondary": "_Button--secondary_1hb69_67", "Button--flush": "_Button--flush_1hb69_82", "Button--disabled": "_Button--disabled_1hb69_86", "Button--fullWidth": "_Button--fullWidth_1hb69_93" };
29176
+ var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
29177
29177
 
29178
29178
  // lib/get-class-name-factory.ts
29179
29179
  init_react_import();
@@ -29255,10 +29255,7 @@ var Button = ({
29255
29255
  children: [
29256
29256
  icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("icon"), children: icon }),
29257
29257
  children,
29258
- loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
29259
- "\xA0\xA0",
29260
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_spinners.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" })
29261
- ] })
29258
+ loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_spinners.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" }) })
29262
29259
  ]
29263
29260
  }
29264
29261
  );
@@ -29267,7 +29264,150 @@ var Button = ({
29267
29264
 
29268
29265
  // components/Drawer/index.tsx
29269
29266
  init_react_import();
29270
- var import_dnd2 = require("@hello-pangea/dnd");
29267
+
29268
+ // components/Droppable/index.tsx
29269
+ init_react_import();
29270
+ var import_dnd = require("@measured/dnd");
29271
+
29272
+ // components/Puck/context.tsx
29273
+ init_react_import();
29274
+ var import_react3 = require("react");
29275
+
29276
+ // lib/get-item.ts
29277
+ init_react_import();
29278
+
29279
+ // lib/root-droppable-id.ts
29280
+ init_react_import();
29281
+ var rootDroppableId = "default-zone";
29282
+
29283
+ // lib/setup-zone.ts
29284
+ init_react_import();
29285
+ var setupZone = (data, zoneKey) => {
29286
+ if (zoneKey === rootDroppableId) {
29287
+ return data;
29288
+ }
29289
+ const newData = __spreadValues({}, data);
29290
+ newData.zones = data.zones || {};
29291
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29292
+ return newData;
29293
+ };
29294
+
29295
+ // lib/get-item.ts
29296
+ var getItem = (selector, data, dynamicProps = {}) => {
29297
+ if (!selector.zone || selector.zone === rootDroppableId) {
29298
+ const item2 = data.content[selector.index];
29299
+ return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29300
+ }
29301
+ const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29302
+ return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
29303
+ };
29304
+
29305
+ // components/ViewportControls/default-viewports.ts
29306
+ init_react_import();
29307
+ var defaultViewports = [
29308
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
29309
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
29310
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
29311
+ ];
29312
+
29313
+ // components/Puck/context.tsx
29314
+ var import_jsx_runtime2 = require("react/jsx-runtime");
29315
+ var defaultAppState = {
29316
+ data: { content: [], root: { props: { title: "" } } },
29317
+ ui: {
29318
+ leftSideBarVisible: true,
29319
+ rightSideBarVisible: true,
29320
+ arrayState: {},
29321
+ itemSelector: null,
29322
+ componentList: {},
29323
+ isDragging: false,
29324
+ viewports: {
29325
+ current: {
29326
+ width: defaultViewports[0].width,
29327
+ height: defaultViewports[0].height || "auto"
29328
+ },
29329
+ options: [],
29330
+ controlsVisible: true
29331
+ }
29332
+ }
29333
+ };
29334
+ var defaultContext = {
29335
+ state: defaultAppState,
29336
+ dispatch: () => null,
29337
+ config: { components: {} },
29338
+ componentState: {},
29339
+ resolveData: () => {
29340
+ },
29341
+ plugins: [],
29342
+ overrides: {},
29343
+ history: {},
29344
+ viewports: defaultViewports,
29345
+ zoomConfig: {
29346
+ autoZoom: 1,
29347
+ rootHeight: 0,
29348
+ zoom: 1
29349
+ },
29350
+ setZoomConfig: () => null,
29351
+ status: "LOADING",
29352
+ setStatus: () => null,
29353
+ iframe: {}
29354
+ };
29355
+ var appContext = (0, import_react3.createContext)(defaultContext);
29356
+ var AppProvider = ({
29357
+ children,
29358
+ value
29359
+ }) => {
29360
+ const [zoomConfig, setZoomConfig] = (0, import_react3.useState)(defaultContext.zoomConfig);
29361
+ const [status, setStatus] = (0, import_react3.useState)("LOADING");
29362
+ (0, import_react3.useEffect)(() => {
29363
+ setStatus("MOUNTED");
29364
+ }, []);
29365
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29366
+ appContext.Provider,
29367
+ {
29368
+ value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig, status, setStatus }),
29369
+ children
29370
+ }
29371
+ );
29372
+ };
29373
+ function useAppContext() {
29374
+ const mainContext = (0, import_react3.useContext)(appContext);
29375
+ const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29376
+ return __spreadProps(__spreadValues({}, mainContext), {
29377
+ // Helpers
29378
+ selectedItem,
29379
+ setUi: (ui, recordHistory) => {
29380
+ return mainContext.dispatch({
29381
+ type: "setUi",
29382
+ ui,
29383
+ recordHistory
29384
+ });
29385
+ }
29386
+ });
29387
+ }
29388
+
29389
+ // components/Droppable/index.tsx
29390
+ var import_jsx_runtime3 = require("react/jsx-runtime");
29391
+ var defaultProvided = {
29392
+ droppableProps: {
29393
+ "data-rfd-droppable-context-id": "",
29394
+ "data-rfd-droppable-id": ""
29395
+ },
29396
+ placeholder: null,
29397
+ innerRef: () => null
29398
+ };
29399
+ var defaultSnapshot = {
29400
+ isDraggingOver: false,
29401
+ draggingOverWith: null,
29402
+ draggingFromThisWith: null,
29403
+ isUsingPlaceholder: false
29404
+ };
29405
+ var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: children(defaultProvided, defaultSnapshot) });
29406
+ var Droppable = (props) => {
29407
+ const { status } = useAppContext();
29408
+ const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
29409
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(El, __spreadValues({}, props));
29410
+ };
29271
29411
 
29272
29412
  // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
29273
29413
  init_react_import();
@@ -29275,8 +29415,32 @@ var styles_module_default = { "Drawer": "_Drawer_6zh0b_1", "DrawerItem-default":
29275
29415
 
29276
29416
  // components/Draggable/index.tsx
29277
29417
  init_react_import();
29278
- var import_dnd = require("@hello-pangea/dnd");
29279
- var import_jsx_runtime2 = require("react/jsx-runtime");
29418
+ var import_dnd2 = require("@measured/dnd");
29419
+ var import_jsx_runtime4 = require("react/jsx-runtime");
29420
+ var defaultProvided2 = {
29421
+ draggableProps: {
29422
+ "data-rfd-draggable-context-id": "",
29423
+ "data-rfd-draggable-id": ""
29424
+ },
29425
+ dragHandleProps: null,
29426
+ innerRef: () => null
29427
+ };
29428
+ var defaultSnapshot2 = {
29429
+ isDragging: false,
29430
+ isDropAnimating: false,
29431
+ isClone: false,
29432
+ dropAnimation: null,
29433
+ draggingOver: null,
29434
+ combineWith: null,
29435
+ combineTargetFor: null,
29436
+ mode: null
29437
+ };
29438
+ var defaultRubric = {
29439
+ draggableId: "",
29440
+ type: "",
29441
+ source: { droppableId: "", index: 0 }
29442
+ };
29443
+ var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
29280
29444
  var Draggable = ({
29281
29445
  className,
29282
29446
  children,
@@ -29286,39 +29450,33 @@ var Draggable = ({
29286
29450
  disableAnimations = false,
29287
29451
  isDragDisabled = false
29288
29452
  }) => {
29289
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29290
- import_dnd.Draggable,
29291
- {
29292
- draggableId: id,
29293
- index,
29294
- isDragDisabled,
29295
- children: (provided, snapshot) => {
29296
- var _a;
29297
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
29298
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29299
- "div",
29300
- __spreadProps(__spreadValues(__spreadValues({
29301
- className: className && className(provided, snapshot),
29302
- ref: provided.innerRef
29303
- }, provided.draggableProps), provided.dragHandleProps), {
29304
- style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
29305
- transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
29306
- }),
29307
- children: children(provided, snapshot)
29308
- })
29309
- ),
29310
- showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29311
- "div",
29312
- {
29313
- className: className && className(provided, snapshot),
29314
- style: { transform: "none !important" },
29315
- children: children(provided, snapshot)
29316
- }
29317
- )
29318
- ] });
29319
- }
29320
- }
29321
- );
29453
+ const { status } = useAppContext();
29454
+ const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
29455
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
29456
+ var _a;
29457
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
29458
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29459
+ "div",
29460
+ __spreadProps(__spreadValues(__spreadValues({
29461
+ className: className && className(provided, snapshot),
29462
+ ref: provided.innerRef
29463
+ }, provided.draggableProps), provided.dragHandleProps), {
29464
+ style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
29465
+ transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
29466
+ }),
29467
+ children: children(provided, snapshot)
29468
+ })
29469
+ ),
29470
+ showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29471
+ "div",
29472
+ {
29473
+ className: className && className(provided, snapshot),
29474
+ style: { transform: "none !important" },
29475
+ children: children(provided, snapshot)
29476
+ }
29477
+ )
29478
+ ] });
29479
+ } });
29322
29480
  };
29323
29481
 
29324
29482
  // components/DragIcon/index.tsx
@@ -29353,23 +29511,23 @@ init_react_import();
29353
29511
  var styles_module_default2 = { "DragIcon": "_DragIcon_1p5wn_1" };
29354
29512
 
29355
29513
  // components/DragIcon/index.tsx
29356
- var import_jsx_runtime3 = require("react/jsx-runtime");
29514
+ var import_jsx_runtime5 = require("react/jsx-runtime");
29357
29515
  var getClassName2 = get_class_name_factory_default("DragIcon", styles_module_default2);
29358
- var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName2(), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
29516
+ var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName2(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
29359
29517
 
29360
29518
  // components/Drawer/index.tsx
29361
- var import_react3 = require("react");
29362
- var import_jsx_runtime4 = require("react/jsx-runtime");
29519
+ var import_react4 = require("react");
29520
+ var import_jsx_runtime6 = require("react/jsx-runtime");
29363
29521
  var getClassName3 = get_class_name_factory_default("Drawer", styles_module_default);
29364
29522
  var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_module_default);
29365
- var drawerContext = (0, import_react3.createContext)({
29523
+ var drawerContext = (0, import_react4.createContext)({
29366
29524
  droppableId: ""
29367
29525
  });
29368
29526
  var DrawerDraggable = ({
29369
29527
  children,
29370
29528
  id,
29371
29529
  index
29372
- }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29530
+ }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
29373
29531
  Draggable,
29374
29532
  {
29375
29533
  id,
@@ -29385,17 +29543,18 @@ var DrawerItem = ({
29385
29543
  name,
29386
29544
  children,
29387
29545
  id,
29546
+ label,
29388
29547
  index
29389
29548
  }) => {
29390
- const ctx = (0, import_react3.useContext)(drawerContext);
29549
+ const ctx = (0, import_react4.useContext)(drawerContext);
29391
29550
  const resolvedId = `${ctx.droppableId}::${id || name}`;
29392
- const CustomInner = (0, import_react3.useMemo)(
29393
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29551
+ const CustomInner = (0, import_react4.useMemo)(
29552
+ () => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29394
29553
  [children]
29395
29554
  );
29396
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CustomInner, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29397
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("name"), children: name }),
29398
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DragIcon, {}) })
29555
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29556
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("name"), children: label != null ? label : name }),
29557
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DragIcon, {}) })
29399
29558
  ] }) }) }) });
29400
29559
  };
29401
29560
  var Drawer = ({
@@ -29403,7 +29562,7 @@ var Drawer = ({
29403
29562
  droppableId = "component-list",
29404
29563
  direction = "vertical"
29405
29564
  }) => {
29406
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dnd2.Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
29565
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
29407
29566
  "div",
29408
29567
  __spreadProps(__spreadValues({}, provided.droppableProps), {
29409
29568
  ref: provided.innerRef,
@@ -29412,7 +29571,7 @@ var Drawer = ({
29412
29571
  }),
29413
29572
  children: [
29414
29573
  children,
29415
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
29574
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
29416
29575
  ]
29417
29576
  })
29418
29577
  ) }) });
@@ -29425,19 +29584,19 @@ var import_react9 = require("react");
29425
29584
 
29426
29585
  // components/DraggableComponent/index.tsx
29427
29586
  init_react_import();
29428
- var import_react6 = require("react");
29429
- var import_dnd3 = require("@hello-pangea/dnd");
29587
+ var import_react7 = require("react");
29588
+ var import_dnd3 = require("@measured/dnd");
29430
29589
 
29431
29590
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
29432
29591
  init_react_import();
29433
- 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" };
29592
+ var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_1542z_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_1542z_11", "DraggableComponent-contents": "_DraggableComponent-contents_1542z_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_1542z_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1542z_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1542z_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_1542z_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1542z_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_1542z_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1542z_97", "DraggableComponent-actions": "_DraggableComponent-actions_1542z_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_1542z_127", "DraggableComponent-action": "_DraggableComponent-action_1542z_97" };
29434
29593
 
29435
29594
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
29436
29595
  init_react_import();
29437
29596
 
29438
29597
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
29439
29598
  init_react_import();
29440
- var import_react4 = require("react");
29599
+ var import_react5 = require("react");
29441
29600
 
29442
29601
  // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
29443
29602
  init_react_import();
@@ -29456,10 +29615,10 @@ var defaultAttributes = {
29456
29615
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
29457
29616
  var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
29458
29617
  var createLucideIcon = (iconName, iconNode) => {
29459
- const Component = (0, import_react4.forwardRef)(
29618
+ const Component = (0, import_react5.forwardRef)(
29460
29619
  (_a, ref) => {
29461
29620
  var _b = _a, { color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children } = _b, rest = __objRest(_b, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children"]);
29462
- return (0, import_react4.createElement)(
29621
+ return (0, import_react5.createElement)(
29463
29622
  "svg",
29464
29623
  __spreadValues(__spreadProps(__spreadValues({
29465
29624
  ref
@@ -29471,7 +29630,7 @@ var createLucideIcon = (iconName, iconNode) => {
29471
29630
  className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
29472
29631
  }), rest),
29473
29632
  [
29474
- ...iconNode.map(([tag, attrs]) => (0, import_react4.createElement)(tag, attrs)),
29633
+ ...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
29475
29634
  ...Array.isArray(children) ? children : [children]
29476
29635
  ]
29477
29636
  );
@@ -29582,6 +29741,14 @@ var Lock = createLucideIcon("Lock", [
29582
29741
  ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
29583
29742
  ]);
29584
29743
 
29744
+ // ../../node_modules/lucide-react/dist/esm/icons/monitor.js
29745
+ init_react_import();
29746
+ var Monitor = createLucideIcon("Monitor", [
29747
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
29748
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
29749
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
29750
+ ]);
29751
+
29585
29752
  // ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
29586
29753
  init_react_import();
29587
29754
  var MoreVertical = createLucideIcon("MoreVertical", [
@@ -29618,6 +29785,34 @@ var Search = createLucideIcon("Search", [
29618
29785
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
29619
29786
  ]);
29620
29787
 
29788
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
29789
+ init_react_import();
29790
+ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
29791
+ ["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
29792
+ ["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
29793
+ ["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
29794
+ ["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
29795
+ ["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
29796
+ ["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
29797
+ ["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
29798
+ ["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
29799
+ ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
29800
+ ]);
29801
+
29802
+ // ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
29803
+ init_react_import();
29804
+ var Smartphone = createLucideIcon("Smartphone", [
29805
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
29806
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
29807
+ ]);
29808
+
29809
+ // ../../node_modules/lucide-react/dist/esm/icons/tablet.js
29810
+ init_react_import();
29811
+ var Tablet = createLucideIcon("Tablet", [
29812
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
29813
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
29814
+ ]);
29815
+
29621
29816
  // ../../node_modules/lucide-react/dist/esm/icons/trash.js
29622
29817
  init_react_import();
29623
29818
  var Trash = createLucideIcon("Trash", [
@@ -29641,12 +29836,29 @@ var Unlock = createLucideIcon("Unlock", [
29641
29836
  ["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
29642
29837
  ]);
29643
29838
 
29839
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
29840
+ init_react_import();
29841
+ var ZoomIn = createLucideIcon("ZoomIn", [
29842
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29843
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29844
+ ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
29845
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29846
+ ]);
29847
+
29848
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
29849
+ init_react_import();
29850
+ var ZoomOut = createLucideIcon("ZoomOut", [
29851
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29852
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29853
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29854
+ ]);
29855
+
29644
29856
  // lib/use-modifier-held.ts
29645
29857
  init_react_import();
29646
- var import_react5 = require("react");
29858
+ var import_react6 = require("react");
29647
29859
  var useModifierHeld = (modifier) => {
29648
- const [modifierHeld, setModifierHeld] = (0, import_react5.useState)(false);
29649
- (0, import_react5.useEffect)(() => {
29860
+ const [modifierHeld, setModifierHeld] = (0, import_react6.useState)(false);
29861
+ (0, import_react6.useEffect)(() => {
29650
29862
  function downHandler({ key }) {
29651
29863
  if (key === modifier) {
29652
29864
  setModifierHeld(true);
@@ -29667,10 +29879,26 @@ var useModifierHeld = (modifier) => {
29667
29879
  return modifierHeld;
29668
29880
  };
29669
29881
 
29882
+ // lib/is-ios.ts
29883
+ init_react_import();
29884
+ var isIos = () => [
29885
+ "iPad Simulator",
29886
+ "iPhone Simulator",
29887
+ "iPod Simulator",
29888
+ "iPad",
29889
+ "iPhone",
29890
+ "iPod"
29891
+ ].includes(navigator.platform) || // iPad on iOS 13 detection
29892
+ navigator.userAgent.includes("Mac") && "ontouchend" in document;
29893
+
29670
29894
  // components/DraggableComponent/index.tsx
29671
29895
  var import_react_spinners2 = require("react-spinners");
29672
- var import_jsx_runtime5 = require("react/jsx-runtime");
29896
+ var import_jsx_runtime7 = require("react/jsx-runtime");
29673
29897
  var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_module_default3);
29898
+ var space = 8;
29899
+ var actionsOverlayTop = space * 6.5;
29900
+ var actionsTop = -(actionsOverlayTop - 8);
29901
+ var actionsRight = space;
29674
29902
  var DraggableComponent = ({
29675
29903
  children,
29676
29904
  id,
@@ -29693,15 +29921,25 @@ var DraggableComponent = ({
29693
29921
  indicativeHover = false,
29694
29922
  style
29695
29923
  }) => {
29924
+ const { zoomConfig } = useAppContext();
29696
29925
  const isModifierHeld = useModifierHeld("Alt");
29697
- (0, import_react6.useEffect)(onMount, []);
29698
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
29699
- import_dnd3.Draggable,
29926
+ const { status } = useAppContext();
29927
+ const El = status !== "LOADING" ? import_dnd3.Draggable : DefaultDraggable;
29928
+ (0, import_react7.useEffect)(onMount, []);
29929
+ const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react7.useState)(false);
29930
+ (0, import_react7.useEffect)(() => {
29931
+ if (isIos()) {
29932
+ setDisableSecondaryAnimation(true);
29933
+ }
29934
+ }, []);
29935
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29936
+ El,
29700
29937
  {
29701
29938
  draggableId: id,
29702
29939
  index,
29703
29940
  isDragDisabled,
29704
- children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
29941
+ disableSecondaryAnimation,
29942
+ children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29705
29943
  "div",
29706
29944
  __spreadProps(__spreadValues(__spreadValues({
29707
29945
  ref: provided.innerRef
@@ -29724,13 +29962,34 @@ var DraggableComponent = ({
29724
29962
  onClick,
29725
29963
  children: [
29726
29964
  debug,
29727
- 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" }) }),
29728
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("overlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName4("actions"), children: [
29729
- label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29730
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Copy, { size: 16 }) }),
29731
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Trash, { size: 16 }) })
29732
- ] }) }),
29733
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("contents"), children })
29965
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29966
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29967
+ "div",
29968
+ {
29969
+ className: getClassName4("actionsOverlay"),
29970
+ style: {
29971
+ top: actionsOverlayTop / zoomConfig.zoom
29972
+ },
29973
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29974
+ "div",
29975
+ {
29976
+ className: getClassName4("actions"),
29977
+ style: {
29978
+ transform: `scale(${1 / zoomConfig.zoom}`,
29979
+ top: actionsTop / zoomConfig.zoom,
29980
+ right: actionsRight / zoomConfig.zoom
29981
+ },
29982
+ children: [
29983
+ label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29984
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 }) }),
29985
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 }) })
29986
+ ]
29987
+ }
29988
+ )
29989
+ }
29990
+ ),
29991
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("overlay") }),
29992
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("contents"), children })
29734
29993
  ]
29735
29994
  })
29736
29995
  )
@@ -29739,45 +29998,13 @@ var DraggableComponent = ({
29739
29998
  );
29740
29999
  };
29741
30000
 
29742
- // components/DropZone/index.tsx
29743
- var import_dnd4 = require("@hello-pangea/dnd");
29744
-
29745
- // lib/get-item.ts
29746
- init_react_import();
29747
-
29748
- // lib/root-droppable-id.ts
29749
- init_react_import();
29750
- var rootDroppableId = "default-zone";
29751
-
29752
- // lib/setup-zone.ts
29753
- init_react_import();
29754
- var setupZone = (data, zoneKey) => {
29755
- if (zoneKey === rootDroppableId) {
29756
- return data;
29757
- }
29758
- const newData = __spreadValues({}, data);
29759
- newData.zones = data.zones || {};
29760
- newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29761
- return newData;
29762
- };
29763
-
29764
- // lib/get-item.ts
29765
- var getItem = (selector, data, dynamicProps = {}) => {
29766
- if (!selector.zone || selector.zone === rootDroppableId) {
29767
- const item2 = data.content[selector.index];
29768
- return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29769
- }
29770
- const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29771
- return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
29772
- };
29773
-
29774
30001
  // css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
29775
30002
  init_react_import();
29776
- 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" };
30003
+ var styles_module_default4 = { "DropZone": "_DropZone_w4btq_1", "DropZone-content": "_DropZone-content_w4btq_10", "DropZone--userIsDragging": "_DropZone--userIsDragging_w4btq_15", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_w4btq_19", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_w4btq_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_w4btq_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_w4btq_27", "DropZone--isDisabled": "_DropZone--isDisabled_w4btq_28", "DropZone--isRootZone": "_DropZone--isRootZone_w4btq_29", "DropZone--hasChildren": "_DropZone--hasChildren_w4btq_30", "DropZone--isDestination": "_DropZone--isDestination_w4btq_40", "DropZone-item": "_DropZone-item_w4btq_52", "DropZone-hitbox": "_DropZone-hitbox_w4btq_56" };
29777
30004
 
29778
30005
  // components/DropZone/context.tsx
29779
30006
  init_react_import();
29780
- var import_react7 = require("react");
30007
+ var import_react8 = require("react");
29781
30008
  var import_use_debounce = require("use-debounce");
29782
30009
 
29783
30010
  // lib/get-zone-id.ts
@@ -29793,30 +30020,30 @@ var getZoneId = (zoneCompound) => {
29793
30020
  };
29794
30021
 
29795
30022
  // components/DropZone/context.tsx
29796
- var import_jsx_runtime6 = require("react/jsx-runtime");
29797
- var dropZoneContext = (0, import_react7.createContext)(null);
30023
+ var import_jsx_runtime8 = require("react/jsx-runtime");
30024
+ var dropZoneContext = (0, import_react8.createContext)(null);
29798
30025
  var DropZoneProvider = ({
29799
30026
  children,
29800
30027
  value
29801
30028
  }) => {
29802
- const [hoveringArea, setHoveringArea] = (0, import_react7.useState)(null);
29803
- const [hoveringZone, setHoveringZone] = (0, import_react7.useState)(
30029
+ const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
30030
+ const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
29804
30031
  rootDroppableId
29805
30032
  );
29806
- const [hoveringComponent, setHoveringComponent] = (0, import_react7.useState)();
30033
+ const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
29807
30034
  const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
29808
- const [areasWithZones, setAreasWithZones] = (0, import_react7.useState)(
30035
+ const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
29809
30036
  {}
29810
30037
  );
29811
- const [activeZones, setActiveZones] = (0, import_react7.useState)({});
30038
+ const [activeZones, setActiveZones] = (0, import_react8.useState)({});
29812
30039
  const { dispatch = null } = value ? value : {};
29813
- const registerZoneArea = (0, import_react7.useCallback)(
30040
+ const registerZoneArea = (0, import_react8.useCallback)(
29814
30041
  (area) => {
29815
30042
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
29816
30043
  },
29817
30044
  [setAreasWithZones]
29818
30045
  );
29819
- const registerZone = (0, import_react7.useCallback)(
30046
+ const registerZone = (0, import_react8.useCallback)(
29820
30047
  (zoneCompound) => {
29821
30048
  if (!dispatch) {
29822
30049
  return;
@@ -29829,7 +30056,7 @@ var DropZoneProvider = ({
29829
30056
  },
29830
30057
  [setActiveZones, dispatch]
29831
30058
  );
29832
- const unregisterZone = (0, import_react7.useCallback)(
30059
+ const unregisterZone = (0, import_react8.useCallback)(
29833
30060
  (zoneCompound) => {
29834
30061
  if (!dispatch) {
29835
30062
  return;
@@ -29844,8 +30071,8 @@ var DropZoneProvider = ({
29844
30071
  },
29845
30072
  [setActiveZones, dispatch]
29846
30073
  );
29847
- const [pathData, setPathData] = (0, import_react7.useState)();
29848
- const registerPath = (0, import_react7.useCallback)(
30074
+ const [pathData, setPathData] = (0, import_react8.useState)();
30075
+ const registerPath = (0, import_react8.useCallback)(
29849
30076
  (selector) => {
29850
30077
  if (!(value == null ? void 0 : value.data)) {
29851
30078
  return;
@@ -29870,7 +30097,8 @@ var DropZoneProvider = ({
29870
30097
  },
29871
30098
  [value, setPathData]
29872
30099
  );
29873
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
30100
+ const [zoneWillDrag, setZoneWillDrag] = (0, import_react8.useState)("");
30101
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
29874
30102
  dropZoneContext.Provider,
29875
30103
  {
29876
30104
  value: __spreadValues({
@@ -29886,57 +30114,17 @@ var DropZoneProvider = ({
29886
30114
  unregisterZone,
29887
30115
  activeZones,
29888
30116
  registerPath,
29889
- pathData
30117
+ pathData,
30118
+ zoneWillDrag,
30119
+ setZoneWillDrag
29890
30120
  }, value),
29891
30121
  children
29892
30122
  }
29893
30123
  ) });
29894
30124
  };
29895
30125
 
29896
- // components/Puck/context.tsx
29897
- init_react_import();
29898
- var import_react8 = require("react");
29899
- var defaultAppState = {
29900
- data: { content: [], root: { props: { title: "" } } },
29901
- ui: {
29902
- leftSideBarVisible: true,
29903
- rightSideBarVisible: true,
29904
- arrayState: {},
29905
- itemSelector: null,
29906
- componentList: {},
29907
- isDragging: false
29908
- }
29909
- };
29910
- var appContext = (0, import_react8.createContext)({
29911
- state: defaultAppState,
29912
- dispatch: () => null,
29913
- config: { components: {} },
29914
- componentState: {},
29915
- resolveData: () => {
29916
- },
29917
- plugins: [],
29918
- overrides: {},
29919
- history: {}
29920
- });
29921
- var AppProvider = appContext.Provider;
29922
- function useAppContext() {
29923
- const mainContext = (0, import_react8.useContext)(appContext);
29924
- const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29925
- return __spreadProps(__spreadValues({}, mainContext), {
29926
- // Helpers
29927
- selectedItem,
29928
- setUi: (ui, recordHistory) => {
29929
- return mainContext.dispatch({
29930
- type: "setUi",
29931
- ui,
29932
- recordHistory
29933
- });
29934
- }
29935
- });
29936
- }
29937
-
29938
30126
  // components/DropZone/index.tsx
29939
- var import_jsx_runtime7 = require("react/jsx-runtime");
30127
+ var import_jsx_runtime9 = require("react/jsx-runtime");
29940
30128
  var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
29941
30129
  function DropZoneEdit({ zone, allow, disallow, style }) {
29942
30130
  var _a;
@@ -29955,7 +30143,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29955
30143
  registerZoneArea,
29956
30144
  areasWithZones,
29957
30145
  hoveringComponent,
29958
- disableZoom = false
30146
+ zoneWillDrag,
30147
+ setZoneWillDrag = () => null
29959
30148
  } = ctx || {};
29960
30149
  let content = data.content || [];
29961
30150
  let zoneCompound = rootDroppableId;
@@ -29985,12 +30174,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29985
30174
  const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
29986
30175
  const [zoneArea] = getZoneId(zoneCompound);
29987
30176
  const [draggedSourceArea] = getZoneId(draggedSourceId);
29988
- const [userWillDrag, setUserWillDrag] = (0, import_react9.useState)(false);
30177
+ const userWillDrag = zoneWillDrag === zone;
29989
30178
  const userIsDragging = !!draggedItem;
29990
30179
  const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
29991
30180
  const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
29992
30181
  if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
29993
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "DropZone requires context to work." });
30182
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "DropZone requires context to work." });
29994
30183
  }
29995
30184
  const {
29996
30185
  hoveringArea = "root",
@@ -30027,7 +30216,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30027
30216
  }
30028
30217
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
30029
30218
  const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
30030
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30219
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30031
30220
  "div",
30032
30221
  {
30033
30222
  className: getClassName5({
@@ -30039,17 +30228,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30039
30228
  isDestination: draggedDestinationId === zoneCompound,
30040
30229
  isDisabled: !isEnabled,
30041
30230
  isAreaSelected,
30042
- hasChildren: content.length > 0,
30043
- zoomEnabled: !disableZoom
30231
+ hasChildren: content.length > 0
30044
30232
  }),
30045
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30046
- import_dnd4.Droppable,
30233
+ onMouseUp: () => {
30234
+ setZoneWillDrag("");
30235
+ },
30236
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30237
+ Droppable,
30047
30238
  {
30048
30239
  droppableId: zoneCompound,
30049
30240
  direction: "vertical",
30050
30241
  isDropDisabled: !isEnabled,
30051
30242
  children: (provided, snapshot) => {
30052
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30243
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30053
30244
  "div",
30054
30245
  __spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
30055
30246
  className: getClassName5("content"),
@@ -30063,7 +30254,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30063
30254
  },
30064
30255
  children: [
30065
30256
  content.map((item, i) => {
30066
- var _a2, _b;
30257
+ var _a2, _b, _c;
30067
30258
  const componentId = item.props.id;
30068
30259
  const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
30069
30260
  puck: { renderDropZone: DropZone },
@@ -30074,33 +30265,33 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30074
30265
  "draggable-"
30075
30266
  )[1] === componentId;
30076
30267
  const containsZone = areasWithZones ? areasWithZones[componentId] : false;
30077
- const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
30268
+ const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
30078
30269
  "No configuration for ",
30079
30270
  item.type
30080
30271
  ] });
30081
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30272
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30082
30273
  "div",
30083
30274
  {
30084
30275
  className: getClassName5("item"),
30085
30276
  style: { zIndex: isDragging ? 1 : void 0 },
30086
30277
  children: [
30087
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30278
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30088
30279
  DropZoneProvider,
30089
30280
  {
30090
30281
  value: __spreadProps(__spreadValues({}, ctx), {
30091
30282
  areaId: componentId
30092
30283
  }),
30093
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30284
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30094
30285
  DraggableComponent,
30095
30286
  {
30096
- label: item.type.toString(),
30287
+ label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
30097
30288
  id: `draggable-${componentId}`,
30098
30289
  index: i,
30099
30290
  isSelected,
30100
30291
  isLocked: userIsDragging,
30101
30292
  forceHover: hoveringComponent === componentId && !userIsDragging,
30102
30293
  indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
30103
- isLoading: (_b = appContext2.componentState[componentId]) == null ? void 0 : _b.loading,
30294
+ isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
30104
30295
  onMount: () => {
30105
30296
  ctx.registerPath({
30106
30297
  index: i,
@@ -30116,13 +30307,9 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30116
30307
  },
30117
30308
  onMouseDown: (e) => {
30118
30309
  e.stopPropagation();
30119
- setUserWillDrag(true);
30310
+ setZoneWillDrag(zone);
30120
30311
  },
30121
- onMouseUp: (e) => {
30122
- e.stopPropagation();
30123
- setUserWillDrag(false);
30124
- },
30125
- onMouseOver: (e) => {
30312
+ onMouseOver: (e) => {
30126
30313
  e.stopPropagation();
30127
30314
  if (containsZone) {
30128
30315
  setHoveringArea(componentId);
@@ -30161,12 +30348,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30161
30348
  style: {
30162
30349
  pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
30163
30350
  },
30164
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30351
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30165
30352
  }
30166
30353
  )
30167
30354
  }
30168
30355
  ),
30169
- userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30356
+ userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30170
30357
  "div",
30171
30358
  {
30172
30359
  className: getClassName5("hitbox"),
@@ -30183,7 +30370,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30183
30370
  );
30184
30371
  }),
30185
30372
  provided == null ? void 0 : provided.placeholder,
30186
- (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30373
+ (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30187
30374
  "div",
30188
30375
  {
30189
30376
  "data-puck-placeholder": true,
@@ -30215,14 +30402,14 @@ function DropZoneRender({ zone }) {
30215
30402
  zoneCompound = `${areaId}:${zone}`;
30216
30403
  content = setupZone(data, zoneCompound).zones[zoneCompound];
30217
30404
  }
30218
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: content.map((item) => {
30405
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content.map((item) => {
30219
30406
  const Component = config.components[item.type];
30220
30407
  if (Component) {
30221
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30408
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30222
30409
  DropZoneProvider,
30223
30410
  {
30224
30411
  value: { data, config, areaId: item.props.id },
30225
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30412
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30226
30413
  Component.render,
30227
30414
  __spreadProps(__spreadValues({}, item.props), {
30228
30415
  puck: { renderDropZone: DropZone }
@@ -30238,9 +30425,9 @@ function DropZoneRender({ zone }) {
30238
30425
  function DropZone(props) {
30239
30426
  const ctx = (0, import_react9.useContext)(dropZoneContext);
30240
30427
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
30241
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneEdit, __spreadValues({}, props));
30428
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneEdit, __spreadValues({}, props));
30242
30429
  }
30243
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneRender, __spreadValues({}, props));
30430
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
30244
30431
  }
30245
30432
 
30246
30433
  // components/IconButton/index.ts
@@ -30252,11 +30439,11 @@ var import_react10 = require("react");
30252
30439
 
30253
30440
  // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
30254
30441
  init_react_import();
30255
- var IconButton_module_default = { "IconButton": "_IconButton_1xqlg_1", "IconButton-title": "_IconButton-title_1xqlg_33" };
30442
+ var IconButton_module_default = { "IconButton": "_IconButton_swpni_1", "IconButton--disabled": "_IconButton--disabled_swpni_20", "IconButton-title": "_IconButton-title_swpni_33" };
30256
30443
 
30257
30444
  // components/IconButton/IconButton.tsx
30258
30445
  var import_react_spinners3 = require("react-spinners");
30259
- var import_jsx_runtime8 = require("react/jsx-runtime");
30446
+ var import_jsx_runtime10 = require("react/jsx-runtime");
30260
30447
  var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
30261
30448
  var IconButton = ({
30262
30449
  children,
@@ -30272,7 +30459,7 @@ var IconButton = ({
30272
30459
  }) => {
30273
30460
  const [loading, setLoading] = (0, import_react10.useState)(false);
30274
30461
  const ElementType = href ? "a" : "button";
30275
- const el = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30462
+ const el = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30276
30463
  ElementType,
30277
30464
  {
30278
30465
  className: getClassName6({
@@ -30297,11 +30484,11 @@ var IconButton = ({
30297
30484
  href,
30298
30485
  title,
30299
30486
  children: [
30300
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: getClassName6("title"), children: title }),
30487
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName6("title"), children: title }),
30301
30488
  children,
30302
- loading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
30489
+ loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
30303
30490
  "\xA0\xA0",
30304
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30491
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30305
30492
  ] })
30306
30493
  ]
30307
30494
  }
@@ -30311,12 +30498,23 @@ var IconButton = ({
30311
30498
 
30312
30499
  // components/Puck/index.tsx
30313
30500
  init_react_import();
30314
- var import_react26 = require("react");
30315
- var import_dnd7 = require("@hello-pangea/dnd");
30501
+ var import_react28 = require("react");
30316
30502
 
30317
30503
  // lib/use-placeholder-style.ts
30318
30504
  init_react_import();
30319
30505
  var import_react11 = require("react");
30506
+
30507
+ // lib/get-frame.ts
30508
+ init_react_import();
30509
+ var getFrame = () => {
30510
+ let frame = document.querySelector("#preview-frame");
30511
+ if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
30512
+ frame = frame.contentDocument;
30513
+ }
30514
+ return frame;
30515
+ };
30516
+
30517
+ // lib/use-placeholder-style.ts
30320
30518
  var usePlaceholderStyle = () => {
30321
30519
  const queryAttr = "data-rfd-drag-handle-draggable-id";
30322
30520
  const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
@@ -30326,11 +30524,12 @@ var usePlaceholderStyle = () => {
30326
30524
  const destinationIndex = (draggedItem.destination || draggedItem.source).index;
30327
30525
  const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
30328
30526
  const domQuery = `[${queryAttr}='${draggableId}']`;
30329
- const draggedDOM = document.querySelector(domQuery);
30527
+ const frame = getFrame();
30528
+ const draggedDOM = document.querySelector(domQuery) || (frame == null ? void 0 : frame.querySelector(domQuery));
30330
30529
  if (!draggedDOM) {
30331
30530
  return;
30332
30531
  }
30333
- const targetListElement = document.querySelector(
30532
+ const targetListElement = frame == null ? void 0 : frame.querySelector(
30334
30533
  `[data-rfd-droppable-id='${droppableId}']`
30335
30534
  );
30336
30535
  const { clientHeight } = draggedDOM;
@@ -30377,11 +30576,11 @@ init_react_import();
30377
30576
  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" };
30378
30577
 
30379
30578
  // components/Heading/index.tsx
30380
- var import_jsx_runtime9 = require("react/jsx-runtime");
30579
+ var import_jsx_runtime11 = require("react/jsx-runtime");
30381
30580
  var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
30382
30581
  var Heading = ({ children, rank, size = "m" }) => {
30383
30582
  const Tag = rank ? `h${rank}` : "span";
30384
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30583
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
30385
30584
  Tag,
30386
30585
  {
30387
30586
  className: getClassName7({
@@ -30460,7 +30659,7 @@ var useBreadcrumbs = (renderCount) => {
30460
30659
 
30461
30660
  // components/SidebarSection/index.tsx
30462
30661
  var import_react_spinners4 = require("react-spinners");
30463
- var import_jsx_runtime10 = require("react/jsx-runtime");
30662
+ var import_jsx_runtime12 = require("react/jsx-runtime");
30464
30663
  var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
30465
30664
  var SidebarSection = ({
30466
30665
  children,
@@ -30473,15 +30672,15 @@ var SidebarSection = ({
30473
30672
  }) => {
30474
30673
  const { setUi } = useAppContext();
30475
30674
  const breadcrumbs = useBreadcrumbs(1);
30476
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30675
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
30477
30676
  "div",
30478
30677
  {
30479
30678
  className: getClassName8({ noBorderTop, noPadding }),
30480
30679
  style: { background },
30481
30680
  children: [
30482
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30483
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30484
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
30681
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30682
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30683
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
30485
30684
  "button",
30486
30685
  {
30487
30686
  className: getClassName8("breadcrumbLabel"),
@@ -30489,12 +30688,12 @@ var SidebarSection = ({
30489
30688
  children: breadcrumb.label
30490
30689
  }
30491
30690
  ),
30492
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChevronRight, { size: 16 })
30691
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRight, { size: 16 })
30493
30692
  ] }, i)) : null,
30494
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
30693
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
30495
30694
  ] }) }),
30496
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("content"), children }),
30497
- 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" }) })
30695
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("content"), children }),
30696
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
30498
30697
  ]
30499
30698
  }
30500
30699
  );
@@ -31000,7 +31199,10 @@ var useResolvedData = (appState, config, dispatch) => {
31000
31199
  );
31001
31200
  const runResolvers = () => __async(void 0, null, function* () {
31002
31201
  const newData = newAppState.data;
31003
- const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => !!config.components[item.type].resolveData);
31202
+ const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
31203
+ var _a;
31204
+ return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
31205
+ });
31004
31206
  const applyIfChange = (dynamicDataMap, dynamicRoot) => {
31005
31207
  const processed = applyDynamicProps(
31006
31208
  appState.data,
@@ -31073,7 +31275,7 @@ init_react_import();
31073
31275
  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" };
31074
31276
 
31075
31277
  // components/MenuBar/index.tsx
31076
- var import_jsx_runtime11 = require("react/jsx-runtime");
31278
+ var import_jsx_runtime13 = require("react/jsx-runtime");
31077
31279
  var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
31078
31280
  var MenuBar = ({
31079
31281
  appState,
@@ -31088,7 +31290,7 @@ var MenuBar = ({
31088
31290
  history: { back, forward, historyStore }
31089
31291
  } = useAppContext();
31090
31292
  const { hasFuture = false, hasPast = false } = historyStore || {};
31091
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31293
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31092
31294
  "div",
31093
31295
  {
31094
31296
  className: getClassName9({ menuOpen }),
@@ -31102,16 +31304,16 @@ var MenuBar = ({
31102
31304
  setMenuOpen(false);
31103
31305
  }
31104
31306
  },
31105
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("inner"), children: [
31106
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("history"), children: [
31107
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31307
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("inner"), children: [
31308
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("history"), children: [
31309
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31108
31310
  ChevronLeft,
31109
31311
  {
31110
31312
  size: 21,
31111
31313
  stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
31112
31314
  }
31113
31315
  ) }),
31114
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31316
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31115
31317
  ChevronRight,
31116
31318
  {
31117
31319
  size: 21,
@@ -31119,17 +31321,17 @@ var MenuBar = ({
31119
31321
  }
31120
31322
  ) })
31121
31323
  ] }),
31122
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: renderHeaderActions && renderHeaderActions({
31324
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
31123
31325
  state: appState,
31124
31326
  dispatch
31125
31327
  }) }),
31126
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31328
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31127
31329
  Button,
31128
31330
  {
31129
31331
  onClick: () => {
31130
31332
  onPublish && onPublish(data);
31131
31333
  },
31132
- icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Globe, { size: "14px" }),
31334
+ icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
31133
31335
  children: "Publish"
31134
31336
  }
31135
31337
  ) })
@@ -31140,7 +31342,7 @@ var MenuBar = ({
31140
31342
 
31141
31343
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
31142
31344
  init_react_import();
31143
- 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" };
31345
+ var styles_module_default8 = { "Puck": "_Puck_u70b9_19", "Puck--mounted": "_Puck--mounted_u70b9_36", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_u70b9_40", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_u70b9_46", "Puck-mounted": "_Puck-mounted_u70b9_59", "Puck-header": "_Puck-header_u70b9_100", "Puck-headerInner": "_Puck-headerInner_u70b9_109", "Puck-headerToggle": "_Puck-headerToggle_u70b9_119", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_u70b9_126", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_u70b9_127", "Puck-headerTitle": "_Puck-headerTitle_u70b9_131", "Puck-headerPath": "_Puck-headerPath_u70b9_135", "Puck-headerTools": "_Puck-headerTools_u70b9_142", "Puck-menuButton": "_Puck-menuButton_u70b9_148", "Puck--menuOpen": "_Puck--menuOpen_u70b9_153", "Puck-leftSideBar": "_Puck-leftSideBar_u70b9_127", "Puck-rightSideBar": "_Puck-rightSideBar_u70b9_126", "Puck-portal": "_Puck-portal_u70b9_181" };
31144
31346
 
31145
31347
  // components/Puck/components/Fields/index.tsx
31146
31348
  init_react_import();
@@ -31151,7 +31353,7 @@ init_react_import();
31151
31353
 
31152
31354
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
31153
31355
  init_react_import();
31154
- var styles_module_default9 = { "Input": "_Input_3msty_1", "Input-label": "_Input-label_3msty_26", "Input-labelIcon": "_Input-labelIcon_3msty_34", "Input-disabledIcon": "_Input-disabledIcon_3msty_40", "Input-input": "_Input-input_3msty_45", "Input--readOnly": "_Input--readOnly_3msty_89", "Input-radioGroupItems": "_Input-radioGroupItems_3msty_100", "Input-radio": "_Input-radio_3msty_100", "Input-radioInner": "_Input-radioInner_3msty_117", "Input-radioInput": "_Input-radioInput_3msty_162" };
31356
+ var styles_module_default9 = { "Input": "_Input_1qi5b_1", "Input-label": "_Input-label_1qi5b_26", "Input-labelIcon": "_Input-labelIcon_1qi5b_34", "Input-disabledIcon": "_Input-disabledIcon_1qi5b_41", "Input-input": "_Input-input_1qi5b_46", "Input--readOnly": "_Input--readOnly_1qi5b_90", "Input-radioGroupItems": "_Input-radioGroupItems_1qi5b_101", "Input-radio": "_Input-radio_1qi5b_101", "Input-radioInner": "_Input-radioInner_1qi5b_118", "Input-radioInput": "_Input-radioInput_1qi5b_163" };
31155
31357
 
31156
31358
  // components/InputOrGroup/index.tsx
31157
31359
  var import_react18 = require("react");
@@ -31164,13 +31366,24 @@ init_react_import();
31164
31366
 
31165
31367
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
31166
31368
  init_react_import();
31167
- 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" };
31369
+ var styles_module_default10 = { "ArrayField": "_ArrayField_1lr58_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1lr58_13", "ArrayField-addButton": "_ArrayField-addButton_1lr58_18", "ArrayField--hasItems": "_ArrayField--hasItems_1lr58_33", "ArrayFieldItem": "_ArrayFieldItem_1lr58_63", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1lr58_71", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1lr58_81", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1lr58_97", "ArrayField--addDisabled": "_ArrayField--addDisabled_1lr58_128", "ArrayFieldItem-body": "_ArrayFieldItem-body_1lr58_164", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1lr58_173", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1lr58_180", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1lr58_186" };
31168
31370
 
31169
31371
  // components/InputOrGroup/fields/ArrayField/index.tsx
31170
- var import_dnd5 = require("@hello-pangea/dnd");
31171
- var import_dnd6 = require("@hello-pangea/dnd");
31172
31372
  var import_react14 = require("react");
31173
- var import_jsx_runtime12 = require("react/jsx-runtime");
31373
+
31374
+ // components/DragDropContext/index.tsx
31375
+ init_react_import();
31376
+ var import_dnd4 = require("@measured/dnd");
31377
+ var import_jsx_runtime14 = require("react/jsx-runtime");
31378
+ var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
31379
+ var DragDropContext = (props) => {
31380
+ const { status } = useAppContext();
31381
+ const El = status !== "LOADING" ? import_dnd4.DragDropContext : DefaultDragDropContext;
31382
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(El, __spreadValues({}, props));
31383
+ };
31384
+
31385
+ // components/InputOrGroup/fields/ArrayField/index.tsx
31386
+ var import_jsx_runtime15 = require("react/jsx-runtime");
31174
31387
  var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
31175
31388
  var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
31176
31389
  var ArrayField = ({
@@ -31234,21 +31447,24 @@ var ArrayField = ({
31234
31447
  [arrayState]
31235
31448
  );
31236
31449
  (0, import_react14.useEffect)(() => {
31237
- setUi(mapArrayStateToUi(arrayState));
31450
+ if (arrayState.items.length > 0) {
31451
+ setUi(mapArrayStateToUi(arrayState));
31452
+ }
31238
31453
  }, []);
31239
31454
  const [hovering, setHovering] = (0, import_react14.useState)(false);
31240
31455
  if (field.type !== "array" || !field.arrayFields) {
31241
31456
  return null;
31242
31457
  }
31243
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31458
+ const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
31459
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31244
31460
  FieldLabelInternal,
31245
31461
  {
31246
31462
  label: label || name,
31247
- icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(List, { size: 16 }),
31463
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { size: 16 }),
31248
31464
  el: "div",
31249
31465
  readOnly,
31250
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31251
- import_dnd6.DragDropContext,
31466
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31467
+ DragDropContext,
31252
31468
  {
31253
31469
  onDragEnd: (event) => {
31254
31470
  var _a, _b;
@@ -31274,14 +31490,15 @@ var ArrayField = ({
31274
31490
  });
31275
31491
  }
31276
31492
  },
31277
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dnd5.Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31278
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31493
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31494
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31279
31495
  "div",
31280
31496
  __spreadProps(__spreadValues({}, provided.droppableProps), {
31281
31497
  ref: provided.innerRef,
31282
31498
  className: getClassName10({
31283
31499
  isDraggingFrom: !!snapshot.draggingFromThisWith,
31284
- hasItems: Array.isArray(value) && value.length > 0
31500
+ hasItems: Array.isArray(value) && value.length > 0,
31501
+ addDisabled
31285
31502
  }),
31286
31503
  onMouseOver: (e) => {
31287
31504
  e.stopPropagation();
@@ -31295,7 +31512,7 @@ var ArrayField = ({
31295
31512
  localState.arrayState.items.map((item, i) => {
31296
31513
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
31297
31514
  const data = Array.from(localState.value || [])[i] || {};
31298
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31515
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31299
31516
  Draggable,
31300
31517
  {
31301
31518
  id: _arrayId,
@@ -31306,8 +31523,8 @@ var ArrayField = ({
31306
31523
  readOnly
31307
31524
  }),
31308
31525
  isDragDisabled: readOnly || !hovering,
31309
- children: () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
31310
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31526
+ children: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31527
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31311
31528
  "div",
31312
31529
  {
31313
31530
  onClick: () => {
@@ -31328,10 +31545,12 @@ var ArrayField = ({
31328
31545
  className: getClassNameItem2("summary"),
31329
31546
  children: [
31330
31547
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
31331
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31332
- !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)(
31548
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31549
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31333
31550
  IconButton,
31334
31551
  {
31552
+ type: "button",
31553
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
31335
31554
  onClick: (e) => {
31336
31555
  e.stopPropagation();
31337
31556
  const existingValue = [
@@ -31350,20 +31569,20 @@ var ArrayField = ({
31350
31569
  );
31351
31570
  },
31352
31571
  title: "Delete",
31353
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Trash, { size: 16 })
31572
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash, { size: 16 })
31354
31573
  }
31355
31574
  ) }) }),
31356
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DragIcon, {}) })
31575
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragIcon, {}) })
31357
31576
  ] })
31358
31577
  ]
31359
31578
  }
31360
31579
  ),
31361
- /* @__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(
31580
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
31362
31581
  (fieldName) => {
31363
31582
  const subField = field.arrayFields[fieldName];
31364
31583
  const subFieldName = `${name}[${i}].${fieldName}`;
31365
31584
  const wildcardFieldName = `${name}[*].${fieldName}`;
31366
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31585
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31367
31586
  InputOrGroup,
31368
31587
  {
31369
31588
  name: subFieldName,
@@ -31392,9 +31611,10 @@ var ArrayField = ({
31392
31611
  );
31393
31612
  }),
31394
31613
  provided.placeholder,
31395
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31614
+ !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31396
31615
  "button",
31397
31616
  {
31617
+ type: "button",
31398
31618
  className: getClassName10("addButton"),
31399
31619
  onClick: () => {
31400
31620
  const existingValue = value || [];
@@ -31405,7 +31625,7 @@ var ArrayField = ({
31405
31625
  const newArrayState = regenerateArrayState(newValue);
31406
31626
  onChange(newValue, mapArrayStateToUi(newArrayState));
31407
31627
  },
31408
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: "21" })
31628
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Plus, { size: 21 })
31409
31629
  }
31410
31630
  )
31411
31631
  ]
@@ -31420,7 +31640,7 @@ var ArrayField = ({
31420
31640
 
31421
31641
  // components/InputOrGroup/fields/DefaultField/index.tsx
31422
31642
  init_react_import();
31423
- var import_jsx_runtime13 = require("react/jsx-runtime");
31643
+ var import_jsx_runtime16 = require("react/jsx-runtime");
31424
31644
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
31425
31645
  var DefaultField = ({
31426
31646
  field,
@@ -31431,16 +31651,16 @@ var DefaultField = ({
31431
31651
  label,
31432
31652
  id
31433
31653
  }) => {
31434
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31654
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31435
31655
  FieldLabelInternal,
31436
31656
  {
31437
31657
  label: label || name,
31438
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
31439
- field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Type, { size: 16 }),
31440
- field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Hash, { size: 16 })
31658
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
31659
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
31660
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Hash, { size: 16 })
31441
31661
  ] }),
31442
31662
  readOnly,
31443
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31663
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31444
31664
  "input",
31445
31665
  {
31446
31666
  className: getClassName11("input"),
@@ -31476,7 +31696,7 @@ var import_react16 = require("react");
31476
31696
 
31477
31697
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
31478
31698
  init_react_import();
31479
- var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_oqtaj_1", "ExternalInput-button": "_ExternalInput-button_oqtaj_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_oqtaj_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_oqtaj_32", "ExternalInputModal": "_ExternalInputModal_oqtaj_74", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_oqtaj_82", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_oqtaj_90", "ExternalInputModal-table": "_ExternalInputModal-table_oqtaj_90", "ExternalInputModal-thead": "_ExternalInputModal-thead_oqtaj_106", "ExternalInputModal-th": "_ExternalInputModal-th_oqtaj_106", "ExternalInputModal-td": "_ExternalInputModal-td_oqtaj_120", "ExternalInputModal-tr": "_ExternalInputModal-tr_oqtaj_124", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_oqtaj_137", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_oqtaj_157", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_oqtaj_161", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_oqtaj_174", "ExternalInputModal-noContentBanner": "_ExternalInputModal-noContentBanner_oqtaj_178", "ExternalInputModal--loaded": "_ExternalInputModal--loaded_oqtaj_185", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_oqtaj_190", "ExternalInputModal-search": "_ExternalInputModal-search_oqtaj_190", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_oqtaj_221", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_oqtaj_246", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_oqtaj_256" };
31699
+ 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" };
31480
31700
 
31481
31701
  // components/Modal/index.tsx
31482
31702
  init_react_import();
@@ -31484,11 +31704,11 @@ var import_react15 = require("react");
31484
31704
 
31485
31705
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
31486
31706
  init_react_import();
31487
- var styles_module_default12 = { "Modal": "_Modal_1yh4j_1", "Modal--isOpen": "_Modal--isOpen_1yh4j_15", "Modal-inner": "_Modal-inner_1yh4j_19" };
31707
+ var styles_module_default12 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
31488
31708
 
31489
31709
  // components/Modal/index.tsx
31490
31710
  var import_react_dom = __toESM(require_react_dom());
31491
- var import_jsx_runtime14 = require("react/jsx-runtime");
31711
+ var import_jsx_runtime17 = require("react/jsx-runtime");
31492
31712
  var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
31493
31713
  var Modal = ({
31494
31714
  children,
@@ -31500,10 +31720,10 @@ var Modal = ({
31500
31720
  setRootEl(document.getElementById("puck-portal-root"));
31501
31721
  }, []);
31502
31722
  if (!rootEl) {
31503
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", {});
31723
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {});
31504
31724
  }
31505
31725
  return (0, import_react_dom.createPortal)(
31506
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31726
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31507
31727
  "div",
31508
31728
  {
31509
31729
  className: getClassName12("inner"),
@@ -31517,7 +31737,7 @@ var Modal = ({
31517
31737
 
31518
31738
  // components/ExternalInput/index.tsx
31519
31739
  var import_react_spinners5 = require("react-spinners");
31520
- var import_jsx_runtime15 = require("react/jsx-runtime");
31740
+ var import_jsx_runtime18 = require("react/jsx-runtime");
31521
31741
  var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
31522
31742
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
31523
31743
  var dataCache = {};
@@ -31528,13 +31748,23 @@ var ExternalInput = ({
31528
31748
  name,
31529
31749
  id
31530
31750
  }) => {
31531
- const { mapProp = (val) => val } = field || {};
31751
+ const {
31752
+ mapProp = (val) => val,
31753
+ mapRow = (val) => val,
31754
+ filterFields
31755
+ } = field || {};
31532
31756
  const [data, setData] = (0, import_react16.useState)([]);
31533
31757
  const [isOpen, setOpen] = (0, import_react16.useState)(false);
31534
31758
  const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
31759
+ const hasFilterFields = !!filterFields;
31760
+ const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
31761
+ const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
31762
+ const mappedData = (0, import_react16.useMemo)(() => {
31763
+ return data.map(mapRow);
31764
+ }, [data]);
31535
31765
  const keys = (0, import_react16.useMemo)(() => {
31536
31766
  const validKeys = /* @__PURE__ */ new Set();
31537
- for (const item of data) {
31767
+ for (const item of mappedData) {
31538
31768
  for (const key of Object.keys(item)) {
31539
31769
  if (typeof item[key] === "string" || typeof item[key] === "number") {
31540
31770
  validKeys.add(key);
@@ -31542,13 +31772,13 @@ var ExternalInput = ({
31542
31772
  }
31543
31773
  }
31544
31774
  return Array.from(validKeys);
31545
- }, [data]);
31775
+ }, [mappedData]);
31546
31776
  const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
31547
31777
  const search = (0, import_react16.useCallback)(
31548
- (query) => __async(void 0, null, function* () {
31778
+ (query, filters2) => __async(void 0, null, function* () {
31549
31779
  setIsLoading(true);
31550
- const cacheKey = `${id}-${name}-${query}`;
31551
- const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
31780
+ const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
31781
+ const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
31552
31782
  if (listData) {
31553
31783
  setData(listData);
31554
31784
  setIsLoading(false);
@@ -31558,9 +31788,9 @@ var ExternalInput = ({
31558
31788
  [name, field]
31559
31789
  );
31560
31790
  (0, import_react16.useEffect)(() => {
31561
- search(searchQuery);
31791
+ search(searchQuery, filters);
31562
31792
  }, []);
31563
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31793
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31564
31794
  "div",
31565
31795
  {
31566
31796
  className: getClassName13({
@@ -31569,102 +31799,134 @@ var ExternalInput = ({
31569
31799
  }),
31570
31800
  id,
31571
31801
  children: [
31572
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassName13("actions"), children: [
31573
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31802
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName13("actions"), children: [
31803
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31574
31804
  "button",
31575
31805
  {
31806
+ type: "button",
31576
31807
  onClick: () => setOpen(true),
31577
31808
  className: getClassName13("button"),
31578
- children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31579
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: "16" }),
31580
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: field.placeholder })
31809
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
31810
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Link, { size: "16" }),
31811
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: field.placeholder })
31581
31812
  ] })
31582
31813
  }
31583
31814
  ),
31584
- value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31815
+ value && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31585
31816
  "button",
31586
31817
  {
31587
31818
  className: getClassName13("detachButton"),
31588
31819
  onClick: () => {
31589
31820
  onChange(null);
31590
31821
  },
31591
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Unlock, { size: 16 })
31822
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Unlock, { size: 16 })
31592
31823
  }
31593
31824
  )
31594
31825
  ] }),
31595
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31596
- "div",
31826
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31827
+ "form",
31597
31828
  {
31598
31829
  className: getClassNameModal({
31599
31830
  isLoading,
31600
31831
  loaded: !isLoading,
31601
- hasData: data.length > 0
31832
+ hasData: mappedData.length > 0,
31833
+ filtersToggled
31602
31834
  }),
31835
+ onSubmit: (e) => {
31836
+ e.preventDefault();
31837
+ search(searchQuery, filters);
31838
+ },
31603
31839
  children: [
31604
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("masthead"), children: [
31605
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { rank: 2, size: "xxl", children: "Select content" }),
31606
- field.showSearch && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31607
- "form",
31608
- {
31609
- className: getClassNameModal("searchForm"),
31610
- onSubmit: (e) => {
31611
- e.preventDefault();
31612
- search(searchQuery);
31613
- },
31614
- children: [
31615
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
31616
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31617
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
31618
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31619
- "input",
31620
- {
31621
- className: getClassNameModal("searchInput"),
31622
- name: "q",
31623
- type: "search",
31624
- placeholder: "Search",
31625
- onChange: (e) => {
31626
- setSearchQuery(e.currentTarget.value);
31627
- },
31628
- autoComplete: "off",
31629
- value: searchQuery
31630
- }
31631
- )
31632
- ] }),
31633
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, disabled: isLoading, children: "Search" })
31634
- ]
31635
- }
31636
- )
31637
- ] }),
31638
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31639
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
31640
- /* @__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)(
31641
- "th",
31840
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
31841
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: getClassNameModal("search"), children: [
31842
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31843
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Search, { size: "18" }) }),
31844
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31845
+ "input",
31642
31846
  {
31643
- className: getClassNameModal("th"),
31644
- style: { textAlign: "left" },
31645
- children: key
31847
+ className: getClassNameModal("searchInput"),
31848
+ name: "q",
31849
+ type: "search",
31850
+ placeholder: field.placeholder,
31851
+ onChange: (e) => {
31852
+ setSearchQuery(e.currentTarget.value);
31853
+ },
31854
+ autoComplete: "off",
31855
+ value: searchQuery
31856
+ }
31857
+ )
31858
+ ] }),
31859
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
31860
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
31861
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31862
+ IconButton,
31863
+ {
31864
+ title: "Toggle filters",
31865
+ onClick: (e) => {
31866
+ e.preventDefault();
31867
+ e.stopPropagation();
31868
+ setFiltersToggled(!filtersToggled);
31869
+ },
31870
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlidersHorizontal, { size: 20 })
31871
+ }
31872
+ ) })
31873
+ ] })
31874
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
31875
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("grid"), children: [
31876
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
31877
+ const filterField = filterFields[fieldName];
31878
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31879
+ InputOrGroup,
31880
+ {
31881
+ field: filterField,
31882
+ name: fieldName,
31883
+ id: `external_field_${fieldName}_filter`,
31884
+ label: filterField.label || fieldName,
31885
+ value: filters[fieldName],
31886
+ onChange: (value2) => {
31887
+ const newFilters = __spreadProps(__spreadValues({}, filters), { [fieldName]: value2 });
31888
+ setFilters(newFilters);
31889
+ search(searchQuery, newFilters);
31890
+ }
31646
31891
  },
31647
- key
31648
- )) }) }),
31649
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i) => {
31650
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31651
- "tr",
31892
+ fieldName
31893
+ );
31894
+ }) }),
31895
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31896
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: getClassNameModal("table"), children: [
31897
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31898
+ "th",
31652
31899
  {
31653
- style: { whiteSpace: "nowrap" },
31654
- className: getClassNameModal("tr"),
31655
- onClick: (e) => {
31656
- onChange(mapProp(item));
31657
- setOpen(false);
31658
- },
31659
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31900
+ className: getClassNameModal("th"),
31901
+ style: { textAlign: "left" },
31902
+ children: key
31660
31903
  },
31661
- i
31662
- );
31663
- }) })
31664
- ] }),
31665
- /* @__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" }) })
31904
+ key
31905
+ )) }) }),
31906
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
31907
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31908
+ "tr",
31909
+ {
31910
+ style: { whiteSpace: "nowrap" },
31911
+ className: getClassNameModal("tr"),
31912
+ onClick: () => {
31913
+ onChange(mapProp(data[i]));
31914
+ setOpen(false);
31915
+ },
31916
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31917
+ },
31918
+ i
31919
+ );
31920
+ }) })
31921
+ ] }),
31922
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
31923
+ ] })
31666
31924
  ] }),
31667
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No results." })
31925
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("footer"), children: [
31926
+ mappedData.length,
31927
+ " result",
31928
+ mappedData.length === 1 ? "" : "s"
31929
+ ] })
31668
31930
  ]
31669
31931
  }
31670
31932
  ) })
@@ -31674,7 +31936,7 @@ var ExternalInput = ({
31674
31936
  };
31675
31937
 
31676
31938
  // components/InputOrGroup/fields/ExternalField/index.tsx
31677
- var import_jsx_runtime16 = require("react/jsx-runtime");
31939
+ var import_jsx_runtime19 = require("react/jsx-runtime");
31678
31940
  var ExternalField = ({
31679
31941
  field,
31680
31942
  onChange,
@@ -31696,13 +31958,13 @@ var ExternalField = ({
31696
31958
  if (field.type !== "external") {
31697
31959
  return null;
31698
31960
  }
31699
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31961
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31700
31962
  FieldLabelInternal,
31701
31963
  {
31702
31964
  label: label || name,
31703
- icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { size: 16 }),
31965
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Link, { size: 16 }),
31704
31966
  el: "div",
31705
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31967
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31706
31968
  ExternalInput,
31707
31969
  {
31708
31970
  name,
@@ -31710,6 +31972,7 @@ var ExternalField = ({
31710
31972
  // DEPRECATED
31711
31973
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
31712
31974
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
31975
+ mapRow: validField.mapRow,
31713
31976
  fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
31714
31977
  return yield deprecatedField.adaptor.fetchList(
31715
31978
  deprecatedField.adaptorParams
@@ -31727,7 +31990,7 @@ var ExternalField = ({
31727
31990
 
31728
31991
  // components/InputOrGroup/fields/RadioField/index.tsx
31729
31992
  init_react_import();
31730
- var import_jsx_runtime17 = require("react/jsx-runtime");
31993
+ var import_jsx_runtime20 = require("react/jsx-runtime");
31731
31994
  var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
31732
31995
  var RadioField = ({
31733
31996
  field,
@@ -31741,19 +32004,19 @@ var RadioField = ({
31741
32004
  if (field.type !== "radio" || !field.options) {
31742
32005
  return null;
31743
32006
  }
31744
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
32007
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31745
32008
  FieldLabelInternal,
31746
32009
  {
31747
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CheckCircle, { size: 16 }),
32010
+ icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckCircle, { size: 16 }),
31748
32011
  label: label || name,
31749
32012
  readOnly,
31750
32013
  el: "div",
31751
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
32014
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
31752
32015
  "label",
31753
32016
  {
31754
32017
  className: getClassName14("radio"),
31755
32018
  children: [
31756
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
32019
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31757
32020
  "input",
31758
32021
  {
31759
32022
  type: "radio",
@@ -31771,7 +32034,7 @@ var RadioField = ({
31771
32034
  defaultChecked: value === option.value
31772
32035
  }
31773
32036
  ),
31774
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
32037
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
31775
32038
  ]
31776
32039
  },
31777
32040
  option.label + option.value
@@ -31782,7 +32045,7 @@ var RadioField = ({
31782
32045
 
31783
32046
  // components/InputOrGroup/fields/SelectField/index.tsx
31784
32047
  init_react_import();
31785
- var import_jsx_runtime18 = require("react/jsx-runtime");
32048
+ var import_jsx_runtime21 = require("react/jsx-runtime");
31786
32049
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
31787
32050
  var SelectField = ({
31788
32051
  field,
@@ -31796,13 +32059,13 @@ var SelectField = ({
31796
32059
  if (field.type !== "select" || !field.options) {
31797
32060
  return null;
31798
32061
  }
31799
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32062
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31800
32063
  FieldLabelInternal,
31801
32064
  {
31802
32065
  label: label || name,
31803
- icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDown, { size: 16 }),
32066
+ icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDown, { size: 16 }),
31804
32067
  readOnly,
31805
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32068
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31806
32069
  "select",
31807
32070
  {
31808
32071
  id,
@@ -31816,7 +32079,7 @@ var SelectField = ({
31816
32079
  onChange(e.currentTarget.value);
31817
32080
  },
31818
32081
  value,
31819
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32082
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31820
32083
  "option",
31821
32084
  {
31822
32085
  label: option.label,
@@ -31832,7 +32095,7 @@ var SelectField = ({
31832
32095
 
31833
32096
  // components/InputOrGroup/fields/TextareaField/index.tsx
31834
32097
  init_react_import();
31835
- var import_jsx_runtime19 = require("react/jsx-runtime");
32098
+ var import_jsx_runtime22 = require("react/jsx-runtime");
31836
32099
  var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
31837
32100
  var TextareaField = ({
31838
32101
  onChange,
@@ -31842,13 +32105,13 @@ var TextareaField = ({
31842
32105
  label,
31843
32106
  id
31844
32107
  }) => {
31845
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32108
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
31846
32109
  FieldLabelInternal,
31847
32110
  {
31848
32111
  label: label || name,
31849
- icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Type, { size: 16 }),
32112
+ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Type, { size: 16 }),
31850
32113
  readOnly,
31851
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32114
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
31852
32115
  "textarea",
31853
32116
  {
31854
32117
  id,
@@ -31877,7 +32140,7 @@ init_react_import();
31877
32140
  var styles_module_default13 = { "ObjectField": "_ObjectField_15j63_5", "ObjectField-fieldset": "_ObjectField-fieldset_15j63_13" };
31878
32141
 
31879
32142
  // components/InputOrGroup/fields/ObjectField/index.tsx
31880
- var import_jsx_runtime20 = require("react/jsx-runtime");
32143
+ var import_jsx_runtime23 = require("react/jsx-runtime");
31881
32144
  var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
31882
32145
  var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
31883
32146
  var ObjectField = ({
@@ -31894,18 +32157,18 @@ var ObjectField = ({
31894
32157
  return null;
31895
32158
  }
31896
32159
  const data = value || {};
31897
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32160
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
31898
32161
  FieldLabelInternal,
31899
32162
  {
31900
32163
  label: label || name,
31901
- icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MoreVertical, { size: 16 }),
32164
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MoreVertical, { size: 16 }),
31902
32165
  el: "div",
31903
32166
  readOnly,
31904
- 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) => {
32167
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
31905
32168
  const subField = field.objectFields[fieldName];
31906
32169
  const subFieldName = `${name}.${fieldName}`;
31907
32170
  const wildcardFieldName = `${name}.${fieldName}`;
31908
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32171
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
31909
32172
  InputOrGroup,
31910
32173
  {
31911
32174
  name: subFieldName,
@@ -31932,7 +32195,7 @@ var ObjectField = ({
31932
32195
  };
31933
32196
 
31934
32197
  // components/InputOrGroup/index.tsx
31935
- var import_jsx_runtime21 = require("react/jsx-runtime");
32198
+ var import_jsx_runtime24 = require("react/jsx-runtime");
31936
32199
  var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
31937
32200
  var FieldLabel = ({
31938
32201
  children,
@@ -31943,11 +32206,11 @@ var FieldLabel = ({
31943
32206
  className
31944
32207
  }) => {
31945
32208
  const El = el;
31946
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(El, { className, children: [
31947
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassName18("label"), children: [
31948
- icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {}),
32209
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(El, { className, children: [
32210
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("label"), children: [
32211
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, {}),
31949
32212
  label,
31950
- readOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Lock, { size: "12" }) })
32213
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Lock, { size: "12" }) })
31951
32214
  ] }),
31952
32215
  children
31953
32216
  ] });
@@ -31964,7 +32227,7 @@ var FieldLabelInternal = ({
31964
32227
  () => overrides.fieldLabel || FieldLabel,
31965
32228
  [overrides]
31966
32229
  );
31967
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
32230
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
31968
32231
  Wrapper,
31969
32232
  {
31970
32233
  label,
@@ -32004,7 +32267,7 @@ var InputOrGroup = (_a) => {
32004
32267
  if (!field.render) {
32005
32268
  return null;
32006
32269
  }
32007
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32270
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32008
32271
  field,
32009
32272
  name,
32010
32273
  readOnly
@@ -32033,7 +32296,7 @@ var InputOrGroup = (_a) => {
32033
32296
  const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
32034
32297
  const children = defaultFields[field.type](mergedProps);
32035
32298
  const Render2 = render[field.type];
32036
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32299
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32037
32300
  };
32038
32301
 
32039
32302
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
@@ -32042,7 +32305,7 @@ var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields
32042
32305
 
32043
32306
  // components/Puck/components/Fields/index.tsx
32044
32307
  var import_react19 = require("react");
32045
- var import_jsx_runtime22 = require("react/jsx-runtime");
32308
+ var import_jsx_runtime25 = require("react/jsx-runtime");
32046
32309
  var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
32047
32310
  var defaultPageFields = {
32048
32311
  title: { type: "text" }
@@ -32051,9 +32314,9 @@ var DefaultFields = ({
32051
32314
  children,
32052
32315
  isLoading
32053
32316
  }) => {
32054
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName19(), children: [
32317
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
32055
32318
  children,
32056
- 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" }) })
32319
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
32057
32320
  ] });
32058
32321
  };
32059
32322
  var Fields = () => {
@@ -32074,14 +32337,14 @@ var Fields = () => {
32074
32337
  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;
32075
32338
  const rootProps = data.root.props || data.root;
32076
32339
  const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32077
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32340
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32078
32341
  "form",
32079
32342
  {
32080
32343
  className: getClassName19(),
32081
32344
  onSubmit: (e) => {
32082
32345
  e.preventDefault();
32083
32346
  },
32084
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32347
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32085
32348
  const field = fields[fieldName];
32086
32349
  const onChange = (value, updatedUi) => {
32087
32350
  var _a2, _b2;
@@ -32147,7 +32410,7 @@ var Fields = () => {
32147
32410
  };
32148
32411
  if (selectedItem && itemSelector) {
32149
32412
  const { readOnly = {} } = selectedItem;
32150
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32413
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32151
32414
  InputOrGroup,
32152
32415
  {
32153
32416
  field,
@@ -32163,7 +32426,7 @@ var Fields = () => {
32163
32426
  );
32164
32427
  } else {
32165
32428
  const { readOnly = {} } = data.root;
32166
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32429
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32167
32430
  InputOrGroup,
32168
32431
  {
32169
32432
  field,
@@ -32198,14 +32461,15 @@ init_react_import();
32198
32461
  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" };
32199
32462
 
32200
32463
  // components/ComponentList/index.tsx
32201
- var import_jsx_runtime23 = require("react/jsx-runtime");
32464
+ var import_jsx_runtime26 = require("react/jsx-runtime");
32202
32465
  var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
32203
32466
  var ComponentListItem = ({
32204
32467
  name,
32468
+ label,
32205
32469
  index
32206
32470
  }) => {
32207
32471
  const { overrides } = useAppContext();
32208
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer.Item, { name, index, children: overrides.componentItem });
32472
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
32209
32473
  };
32210
32474
  var ComponentList = ({
32211
32475
  children,
@@ -32214,8 +32478,8 @@ var ComponentList = ({
32214
32478
  }) => {
32215
32479
  const { config, state, setUi } = useAppContext();
32216
32480
  const { expanded = true } = state.ui.componentList[id] || {};
32217
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32218
- title && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
32481
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32482
+ title && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
32219
32483
  "button",
32220
32484
  {
32221
32485
  className: getClassName20("title"),
@@ -32228,15 +32492,17 @@ var ComponentList = ({
32228
32492
  }),
32229
32493
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
32230
32494
  children: [
32231
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: title }),
32232
- /* @__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 }) })
32495
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: title }),
32496
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronDown, { size: 12 }) })
32233
32497
  ]
32234
32498
  }
32235
32499
  ),
32236
- /* @__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) => {
32237
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32500
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
32501
+ var _a;
32502
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32238
32503
  ComponentListItem,
32239
32504
  {
32505
+ label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
32240
32506
  name: componentKey,
32241
32507
  index: i
32242
32508
  },
@@ -32248,7 +32514,7 @@ var ComponentList = ({
32248
32514
  ComponentList.Item = ComponentListItem;
32249
32515
 
32250
32516
  // lib/use-component-list.tsx
32251
- var import_jsx_runtime24 = require("react/jsx-runtime");
32517
+ var import_jsx_runtime27 = require("react/jsx-runtime");
32252
32518
  var useComponentList = (config, ui) => {
32253
32519
  const [componentList, setComponentList] = (0, import_react20.useState)();
32254
32520
  (0, import_react20.useEffect)(() => {
@@ -32261,16 +32527,18 @@ var useComponentList = (config, ui) => {
32261
32527
  if (category.visible === false || !category.components) {
32262
32528
  return null;
32263
32529
  }
32264
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32530
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32265
32531
  ComponentList,
32266
32532
  {
32267
32533
  id: categoryKey,
32268
32534
  title: category.title || categoryKey,
32269
32535
  children: category.components.map((componentName, i) => {
32536
+ var _a2;
32270
32537
  matchedComponents.push(componentName);
32271
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32538
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32272
32539
  ComponentList.Item,
32273
32540
  {
32541
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32274
32542
  name: componentName,
32275
32543
  index: i
32276
32544
  },
@@ -32287,16 +32555,18 @@ var useComponentList = (config, ui) => {
32287
32555
  );
32288
32556
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
32289
32557
  _componentList.push(
32290
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32558
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32291
32559
  ComponentList,
32292
32560
  {
32293
32561
  id: "other",
32294
32562
  title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
32295
32563
  children: remainingComponents.map((componentName, i) => {
32296
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32564
+ var _a2;
32565
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32297
32566
  ComponentList.Item,
32298
32567
  {
32299
32568
  name: componentName,
32569
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32300
32570
  index: i
32301
32571
  },
32302
32572
  componentName
@@ -32309,44 +32579,69 @@ var useComponentList = (config, ui) => {
32309
32579
  }
32310
32580
  setComponentList(_componentList);
32311
32581
  }
32312
- }, [config.categories, ui.componentList]);
32582
+ }, [config.categories, config.components, ui.componentList]);
32313
32583
  return componentList;
32314
32584
  };
32315
32585
 
32316
32586
  // components/Puck/components/Components/index.tsx
32317
32587
  var import_react21 = require("react");
32318
- var import_jsx_runtime25 = require("react/jsx-runtime");
32588
+ var import_jsx_runtime28 = require("react/jsx-runtime");
32319
32589
  var Components = () => {
32320
32590
  const { config, state, overrides } = useAppContext();
32321
32591
  const componentList = useComponentList(config, state.ui);
32322
32592
  const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
32323
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComponentList, { id: "all" }) });
32593
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
32324
32594
  };
32325
32595
 
32326
32596
  // components/Puck/components/Preview/index.tsx
32327
32597
  init_react_import();
32328
32598
  var import_react22 = require("react");
32329
- var import_jsx_runtime26 = require("react/jsx-runtime");
32599
+ var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
32600
+
32601
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
32602
+ init_react_import();
32603
+ var styles_module_default16 = { "PuckPreview": "_PuckPreview_1mia0_1", "PuckPreview-frame": "_PuckPreview-frame_1mia0_5" };
32604
+
32605
+ // components/Puck/components/Preview/index.tsx
32606
+ var import_jsx_runtime29 = require("react/jsx-runtime");
32607
+ var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
32330
32608
  var Preview = ({ id = "puck-preview" }) => {
32331
- const { config, dispatch, state } = useAppContext();
32609
+ const { config, dispatch, state, setStatus, iframe } = useAppContext();
32332
32610
  const Page = (0, import_react22.useCallback)(
32333
32611
  (pageProps) => {
32334
32612
  var _a, _b;
32335
- return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({}, pageProps), { editMode: true })) : pageProps.children;
32613
+ return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
32614
+ id: "puck-root"
32615
+ }, pageProps), {
32616
+ editMode: true,
32617
+ puck: { renderDropZone: DropZone }
32618
+ })) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: pageProps.children });
32336
32619
  },
32337
32620
  [config.root]
32338
32621
  );
32339
32622
  const rootProps = state.data.root.props || state.data.root;
32340
- const { disableZoom = false } = (0, import_react22.useContext)(dropZoneContext) || {};
32341
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32623
+ const ref = (0, import_react22.useRef)(null);
32624
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32342
32625
  "div",
32343
32626
  {
32627
+ className: getClassName21(),
32344
32628
  id,
32345
32629
  onClick: () => {
32346
32630
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
32347
32631
  },
32348
- style: { zoom: disableZoom ? 1 : 0.75 },
32349
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZone, { zone: rootDroppableId }) }))
32632
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32633
+ import_auto_frame_component.default,
32634
+ {
32635
+ id: "preview-frame",
32636
+ className: getClassName21("frame"),
32637
+ "data-rfd-iframe": true,
32638
+ ref,
32639
+ onStylesLoaded: () => {
32640
+ setStatus("READY");
32641
+ },
32642
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) }))
32643
+ }
32644
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) })) })
32350
32645
  }
32351
32646
  );
32352
32647
  };
@@ -32380,7 +32675,7 @@ init_react_import();
32380
32675
 
32381
32676
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
32382
32677
  init_react_import();
32383
- 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" };
32678
+ 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" };
32384
32679
 
32385
32680
  // lib/scroll-into-view.ts
32386
32681
  init_react_import();
@@ -32408,11 +32703,12 @@ var isChildOfZone = (item, maybeChild, ctx) => {
32408
32703
  };
32409
32704
 
32410
32705
  // components/LayerTree/index.tsx
32411
- var import_jsx_runtime27 = require("react/jsx-runtime");
32412
- var getClassName21 = get_class_name_factory_default("LayerTree", styles_module_default16);
32413
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default16);
32706
+ var import_jsx_runtime30 = require("react/jsx-runtime");
32707
+ var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
32708
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
32414
32709
  var LayerTree = ({
32415
32710
  data,
32711
+ config,
32416
32712
  zoneContent,
32417
32713
  itemSelector,
32418
32714
  setItemSelector,
@@ -32421,15 +32717,16 @@ var LayerTree = ({
32421
32717
  }) => {
32422
32718
  const zones = data.zones || {};
32423
32719
  const ctx = (0, import_react23.useContext)(dropZoneContext);
32424
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
32425
- label && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName21("zoneTitle"), children: [
32426
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Layers, { size: "16" }) }),
32720
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
32721
+ label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
32722
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
32427
32723
  " ",
32428
32724
  label
32429
32725
  ] }),
32430
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("ul", { className: getClassName21(), children: [
32431
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("helper"), children: "No items" }),
32726
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName22(), children: [
32727
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
32432
32728
  zoneContent.map((item, i) => {
32729
+ var _a;
32433
32730
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
32434
32731
  const zonesForItem = findZonesForArea(data, item.props.id);
32435
32732
  const containsZone = Object.keys(zonesForItem).length > 0;
@@ -32443,7 +32740,7 @@ var LayerTree = ({
32443
32740
  const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
32444
32741
  const isHovering = hoveringComponent === item.props.id;
32445
32742
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
32446
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32743
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32447
32744
  "li",
32448
32745
  {
32449
32746
  className: getClassNameLayer({
@@ -32453,7 +32750,7 @@ var LayerTree = ({
32453
32750
  childIsSelected
32454
32751
  }),
32455
32752
  children: [
32456
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32753
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32457
32754
  "button",
32458
32755
  {
32459
32756
  className: getClassNameLayer("clickable"),
@@ -32467,8 +32764,9 @@ var LayerTree = ({
32467
32764
  zone
32468
32765
  });
32469
32766
  const id = zoneContent[i].props.id;
32767
+ const frame = getFrame();
32470
32768
  scrollIntoView(
32471
- document.querySelector(
32769
+ frame == null ? void 0 : frame.querySelector(
32472
32770
  `[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
32473
32771
  )
32474
32772
  );
@@ -32484,24 +32782,25 @@ var LayerTree = ({
32484
32782
  setHoveringComponent(null);
32485
32783
  },
32486
32784
  children: [
32487
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32785
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32488
32786
  "div",
32489
32787
  {
32490
32788
  className: getClassNameLayer("chevron"),
32491
32789
  title: isSelected ? "Collapse" : "Expand",
32492
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDown, { size: "12" })
32790
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
32493
32791
  }
32494
32792
  ),
32495
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassNameLayer("title"), children: [
32496
- /* @__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" }) }),
32497
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
32793
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
32794
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LayoutGrid, { size: "16" }) }),
32795
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
32498
32796
  ] })
32499
32797
  ]
32500
32798
  }
32501
32799
  ) }),
32502
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32800
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32503
32801
  LayerTree,
32504
32802
  {
32803
+ config,
32505
32804
  data,
32506
32805
  zoneContent: zones[zoneKey],
32507
32806
  setItemSelector,
@@ -32521,9 +32820,9 @@ var LayerTree = ({
32521
32820
 
32522
32821
  // components/Puck/components/Outline/index.tsx
32523
32822
  var import_react24 = require("react");
32524
- var import_jsx_runtime28 = require("react/jsx-runtime");
32823
+ var import_jsx_runtime31 = require("react/jsx-runtime");
32525
32824
  var Outline = () => {
32526
- const { dispatch, state, overrides } = useAppContext();
32825
+ const { dispatch, state, overrides, config } = useAppContext();
32527
32826
  const { data, ui } = state;
32528
32827
  const { itemSelector } = ui;
32529
32828
  const setItemSelector = (0, import_react24.useCallback)(
@@ -32536,10 +32835,11 @@ var Outline = () => {
32536
32835
  []
32537
32836
  );
32538
32837
  const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
32539
- 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: [
32540
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32838
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
32839
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32541
32840
  LayerTree,
32542
32841
  {
32842
+ config,
32543
32843
  data,
32544
32844
  label: areaContainsZones(data, "root") ? rootDroppableId : "",
32545
32845
  zoneContent: data.content,
@@ -32549,9 +32849,10 @@ var Outline = () => {
32549
32849
  ),
32550
32850
  Object.entries(findZonesForArea(data, "root")).map(
32551
32851
  ([zoneKey, zone]) => {
32552
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32852
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32553
32853
  LayerTree,
32554
32854
  {
32855
+ config,
32555
32856
  data,
32556
32857
  label: zoneKey,
32557
32858
  zone: zoneKey,
@@ -32675,14 +32976,432 @@ function useHistoryStore() {
32675
32976
  };
32676
32977
  }
32677
32978
 
32979
+ // components/Puck/components/Canvas/index.tsx
32980
+ init_react_import();
32981
+
32982
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
32983
+ init_react_import();
32984
+
32985
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
32986
+ init_react_import();
32987
+ var isProduction = process.env.NODE_ENV === "production";
32988
+ var prefix = "Invariant failed";
32989
+ function invariant(condition, message) {
32990
+ if (condition) {
32991
+ return;
32992
+ }
32993
+ if (isProduction) {
32994
+ throw new Error(prefix);
32995
+ }
32996
+ var provided = typeof message === "function" ? message() : message;
32997
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
32998
+ throw new Error(value);
32999
+ }
33000
+
33001
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
33002
+ var getRect = function getRect2(_ref) {
33003
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
33004
+ var width = right - left;
33005
+ var height = bottom - top;
33006
+ var rect = {
33007
+ top,
33008
+ right,
33009
+ bottom,
33010
+ left,
33011
+ width,
33012
+ height,
33013
+ x: left,
33014
+ y: top,
33015
+ center: {
33016
+ x: (right + left) / 2,
33017
+ y: (bottom + top) / 2
33018
+ }
33019
+ };
33020
+ return rect;
33021
+ };
33022
+ var expand = function expand2(target, expandBy) {
33023
+ return {
33024
+ top: target.top - expandBy.top,
33025
+ left: target.left - expandBy.left,
33026
+ bottom: target.bottom + expandBy.bottom,
33027
+ right: target.right + expandBy.right
33028
+ };
33029
+ };
33030
+ var shrink = function shrink2(target, shrinkBy) {
33031
+ return {
33032
+ top: target.top + shrinkBy.top,
33033
+ left: target.left + shrinkBy.left,
33034
+ bottom: target.bottom - shrinkBy.bottom,
33035
+ right: target.right - shrinkBy.right
33036
+ };
33037
+ };
33038
+ var noSpacing = {
33039
+ top: 0,
33040
+ right: 0,
33041
+ bottom: 0,
33042
+ left: 0
33043
+ };
33044
+ var createBox = function createBox2(_ref2) {
33045
+ 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;
33046
+ var marginBox = getRect(expand(borderBox, margin));
33047
+ var paddingBox = getRect(shrink(borderBox, border));
33048
+ var contentBox = getRect(shrink(paddingBox, padding));
33049
+ return {
33050
+ marginBox,
33051
+ borderBox: getRect(borderBox),
33052
+ paddingBox,
33053
+ contentBox,
33054
+ margin,
33055
+ border,
33056
+ padding
33057
+ };
33058
+ };
33059
+ var parse = function parse2(raw) {
33060
+ var value = raw.slice(0, -2);
33061
+ var suffix = raw.slice(-2);
33062
+ if (suffix !== "px") {
33063
+ return 0;
33064
+ }
33065
+ var result = Number(value);
33066
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
33067
+ return result;
33068
+ };
33069
+ var calculateBox = function calculateBox2(borderBox, styles) {
33070
+ var margin = {
33071
+ top: parse(styles.marginTop),
33072
+ right: parse(styles.marginRight),
33073
+ bottom: parse(styles.marginBottom),
33074
+ left: parse(styles.marginLeft)
33075
+ };
33076
+ var padding = {
33077
+ top: parse(styles.paddingTop),
33078
+ right: parse(styles.paddingRight),
33079
+ bottom: parse(styles.paddingBottom),
33080
+ left: parse(styles.paddingLeft)
33081
+ };
33082
+ var border = {
33083
+ top: parse(styles.borderTopWidth),
33084
+ right: parse(styles.borderRightWidth),
33085
+ bottom: parse(styles.borderBottomWidth),
33086
+ left: parse(styles.borderLeftWidth)
33087
+ };
33088
+ return createBox({
33089
+ borderBox,
33090
+ margin,
33091
+ padding,
33092
+ border
33093
+ });
33094
+ };
33095
+ var getBox = function getBox2(el) {
33096
+ var borderBox = el.getBoundingClientRect();
33097
+ var styles = window.getComputedStyle(el);
33098
+ return calculateBox(borderBox, styles);
33099
+ };
33100
+
33101
+ // components/Puck/components/Canvas/index.tsx
33102
+ var import_react27 = require("react");
33103
+
33104
+ // components/ViewportControls/index.tsx
33105
+ init_react_import();
33106
+ var import_react26 = require("react");
33107
+
33108
+ // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
33109
+ init_react_import();
33110
+ var styles_module_default18 = { "ViewportControls": "_ViewportControls_3zdvn_1", "ViewportControls-divider": "_ViewportControls-divider_3zdvn_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_3zdvn_21", "ViewportButton--isActive": "_ViewportButton--isActive_3zdvn_33", "ViewportButton-inner": "_ViewportButton-inner_3zdvn_33" };
33111
+
33112
+ // components/ViewportControls/index.tsx
33113
+ var import_jsx_runtime32 = require("react/jsx-runtime");
33114
+ var icons = {
33115
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Smartphone, { size: 16 }),
33116
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tablet, { size: 16 }),
33117
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Monitor, { size: 16 })
33118
+ };
33119
+ var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
33120
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
33121
+ var ViewportButton = ({
33122
+ children,
33123
+ height = "auto",
33124
+ title,
33125
+ width,
33126
+ onClick
33127
+ }) => {
33128
+ const { state } = useAppContext();
33129
+ const [isActive, setIsActive] = (0, import_react26.useState)(false);
33130
+ (0, import_react26.useEffect)(() => {
33131
+ setIsActive(width === state.ui.viewports.current.width);
33132
+ }, [width, state.ui.viewports.current.width]);
33133
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33134
+ IconButton,
33135
+ {
33136
+ title,
33137
+ disabled: isActive,
33138
+ onClick: (e) => {
33139
+ e.stopPropagation();
33140
+ onClick({ width, height });
33141
+ },
33142
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton("inner"), children })
33143
+ }
33144
+ ) });
33145
+ };
33146
+ var defaultZoomOptions = [
33147
+ { label: "25%", value: 0.25 },
33148
+ { label: "50%", value: 0.5 },
33149
+ { label: "75%", value: 0.75 },
33150
+ { label: "100%", value: 1 },
33151
+ { label: "125%", value: 1.25 },
33152
+ { label: "150%", value: 1.5 },
33153
+ { label: "200%", value: 2 }
33154
+ ];
33155
+ var ViewportControls = ({
33156
+ autoZoom,
33157
+ zoom,
33158
+ onViewportChange,
33159
+ onZoom
33160
+ }) => {
33161
+ const { viewports } = useAppContext();
33162
+ const defaultsContainAutoZoom = defaultZoomOptions.find(
33163
+ (option) => option.value === autoZoom
33164
+ );
33165
+ const zoomOptions = (0, import_react26.useMemo)(
33166
+ () => [
33167
+ ...defaultZoomOptions,
33168
+ ...defaultsContainAutoZoom ? [] : [
33169
+ {
33170
+ value: autoZoom,
33171
+ label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
33172
+ }
33173
+ ]
33174
+ ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
33175
+ [autoZoom]
33176
+ );
33177
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName23(), children: [
33178
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33179
+ ViewportButton,
33180
+ {
33181
+ height: viewport.height,
33182
+ width: viewport.width,
33183
+ title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
33184
+ onClick: onViewportChange,
33185
+ children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
33186
+ },
33187
+ i
33188
+ )),
33189
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33190
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33191
+ IconButton,
33192
+ {
33193
+ title: "Zoom viewport out",
33194
+ disabled: zoom <= zoomOptions[0].value,
33195
+ onClick: (e) => {
33196
+ e.stopPropagation();
33197
+ onZoom(
33198
+ zoomOptions[Math.max(
33199
+ zoomOptions.findIndex((option) => option.value === zoom) - 1,
33200
+ 0
33201
+ )].value
33202
+ );
33203
+ },
33204
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomOut, { size: 16 })
33205
+ }
33206
+ ),
33207
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33208
+ IconButton,
33209
+ {
33210
+ title: "Zoom viewport in",
33211
+ disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
33212
+ onClick: (e) => {
33213
+ e.stopPropagation();
33214
+ onZoom(
33215
+ zoomOptions[Math.min(
33216
+ zoomOptions.findIndex((option) => option.value === zoom) + 1,
33217
+ zoomOptions.length - 1
33218
+ )].value
33219
+ );
33220
+ },
33221
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomIn, { size: 16 })
33222
+ }
33223
+ ),
33224
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33225
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33226
+ "select",
33227
+ {
33228
+ className: getClassName23("zoomSelect"),
33229
+ value: zoom.toString(),
33230
+ onChange: (e) => {
33231
+ onZoom(parseFloat(e.currentTarget.value));
33232
+ },
33233
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33234
+ "option",
33235
+ {
33236
+ value: option.value,
33237
+ label: option.label
33238
+ },
33239
+ option.label
33240
+ ))
33241
+ }
33242
+ )
33243
+ ] });
33244
+ };
33245
+
33246
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
33247
+ init_react_import();
33248
+ var styles_module_default19 = { "PuckCanvas": "_PuckCanvas_6zd4y_1", "PuckCanvas-controls": "_PuckCanvas-controls_6zd4y_16", "PuckCanvas-inner": "_PuckCanvas-inner_6zd4y_21", "PuckCanvas-root": "_PuckCanvas-root_6zd4y_32", "PuckCanvas--ready": "_PuckCanvas--ready_6zd4y_56" };
33249
+
33250
+ // lib/get-zoom-config.ts
33251
+ init_react_import();
33252
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
33253
+ var getZoomConfig = (uiViewport, frame, zoom) => {
33254
+ const box = getBox(frame);
33255
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
33256
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
33257
+ let rootHeight = 0;
33258
+ let autoZoom = 1;
33259
+ if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
33260
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
33261
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
33262
+ zoom = widthZoom;
33263
+ if (widthZoom < heightZoom) {
33264
+ rootHeight = viewportHeight / zoom;
33265
+ } else {
33266
+ rootHeight = viewportHeight;
33267
+ zoom = heightZoom;
33268
+ }
33269
+ autoZoom = zoom;
33270
+ } else {
33271
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
33272
+ autoZoom = 1;
33273
+ zoom = 1;
33274
+ rootHeight = viewportHeight;
33275
+ }
33276
+ }
33277
+ return { autoZoom, rootHeight, zoom };
33278
+ };
33279
+
33280
+ // components/Puck/components/Canvas/index.tsx
33281
+ var import_jsx_runtime33 = require("react/jsx-runtime");
33282
+ var getClassName24 = get_class_name_factory_default("PuckCanvas", styles_module_default19);
33283
+ var ZOOM_ON_CHANGE = true;
33284
+ var Canvas = () => {
33285
+ const { status, iframe } = useAppContext();
33286
+ const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
33287
+ const { ui } = state;
33288
+ const frameRef = (0, import_react27.useRef)(null);
33289
+ const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
33290
+ const defaultRender = (0, import_react27.useMemo)(() => {
33291
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
33292
+ return PuckDefault;
33293
+ }, []);
33294
+ const CustomPreview = (0, import_react27.useMemo)(
33295
+ () => overrides.preview || defaultRender,
33296
+ [overrides]
33297
+ );
33298
+ const getFrameDimensions = (0, import_react27.useCallback)(() => {
33299
+ if (frameRef.current) {
33300
+ const frame = frameRef.current;
33301
+ const box = getBox(frame);
33302
+ return { width: box.contentBox.width, height: box.contentBox.height };
33303
+ }
33304
+ return { width: 0, height: 0 };
33305
+ }, [frameRef]);
33306
+ const resetAutoZoom = (0, import_react27.useCallback)(
33307
+ (ui2 = state.ui) => {
33308
+ if (frameRef.current) {
33309
+ setZoomConfig(
33310
+ getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
33311
+ );
33312
+ }
33313
+ },
33314
+ [frameRef, zoomConfig, state.ui]
33315
+ );
33316
+ (0, import_react27.useEffect)(() => {
33317
+ setShowTransition(false);
33318
+ resetAutoZoom();
33319
+ }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
33320
+ (0, import_react27.useEffect)(() => {
33321
+ const { height: frameHeight } = getFrameDimensions();
33322
+ if (ui.viewports.current.height === "auto") {
33323
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
33324
+ rootHeight: frameHeight / zoomConfig.zoom
33325
+ }));
33326
+ }
33327
+ }, [zoomConfig.zoom]);
33328
+ (0, import_react27.useEffect)(() => {
33329
+ const observer = new ResizeObserver(() => {
33330
+ setShowTransition(false);
33331
+ resetAutoZoom();
33332
+ });
33333
+ if (document.body) {
33334
+ observer.observe(document.body);
33335
+ }
33336
+ return () => {
33337
+ observer.disconnect();
33338
+ };
33339
+ }, []);
33340
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
33341
+ "div",
33342
+ {
33343
+ className: getClassName24({
33344
+ ready: status === "READY" || !iframe.enabled
33345
+ }),
33346
+ onClick: () => dispatch({
33347
+ type: "setUi",
33348
+ ui: { itemSelector: null },
33349
+ recordHistory: true
33350
+ }),
33351
+ children: [
33352
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33353
+ ViewportControls,
33354
+ {
33355
+ autoZoom: zoomConfig.autoZoom,
33356
+ zoom: zoomConfig.zoom,
33357
+ onViewportChange: (viewport) => {
33358
+ setShowTransition(true);
33359
+ const uiViewport = __spreadProps(__spreadValues({}, viewport), {
33360
+ height: viewport.height || "auto",
33361
+ zoom: zoomConfig.zoom
33362
+ });
33363
+ const newUi = __spreadProps(__spreadValues({}, ui), {
33364
+ viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
33365
+ });
33366
+ setUi(newUi);
33367
+ if (ZOOM_ON_CHANGE) {
33368
+ resetAutoZoom(newUi);
33369
+ }
33370
+ },
33371
+ onZoom: (zoom) => {
33372
+ setShowTransition(true);
33373
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
33374
+ }
33375
+ }
33376
+ ) }),
33377
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33378
+ "div",
33379
+ {
33380
+ className: getClassName24("root"),
33381
+ style: {
33382
+ width: iframe.enabled ? ui.viewports.current.width : void 0,
33383
+ height: zoomConfig.rootHeight,
33384
+ transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
33385
+ transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
33386
+ overflow: iframe.enabled ? void 0 : "auto"
33387
+ },
33388
+ suppressHydrationWarning: true,
33389
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
33390
+ }
33391
+ ) })
33392
+ ]
33393
+ }
33394
+ );
33395
+ };
33396
+
32678
33397
  // components/Puck/index.tsx
32679
- var import_jsx_runtime29 = require("react/jsx-runtime");
32680
- var getClassName22 = get_class_name_factory_default("Puck", styles_module_default8);
33398
+ var import_jsx_runtime34 = require("react/jsx-runtime");
33399
+ var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
32681
33400
  function Puck({
32682
33401
  children,
32683
33402
  config,
32684
33403
  data: initialData = { content: [], root: { props: { title: "" } } },
32685
- ui: initialUi = defaultAppState.ui,
33404
+ ui: initialUi,
32686
33405
  onChange,
32687
33406
  onPublish,
32688
33407
  plugins = [],
@@ -32690,32 +33409,66 @@ function Puck({
32690
33409
  renderHeader,
32691
33410
  renderHeaderActions,
32692
33411
  headerTitle,
32693
- headerPath
33412
+ headerPath,
33413
+ viewports = defaultViewports,
33414
+ iframe = {
33415
+ enabled: true
33416
+ }
32694
33417
  }) {
33418
+ var _a;
32695
33419
  const historyStore = useHistoryStore();
32696
- const [reducer] = (0, import_react26.useState)(
33420
+ const [reducer] = (0, import_react28.useState)(
32697
33421
  () => createReducer({ config, record: historyStore.record })
32698
33422
  );
32699
- const [initialAppState] = (0, import_react26.useState)(() => __spreadProps(__spreadValues({}, defaultAppState), {
32700
- data: initialData,
32701
- ui: __spreadProps(__spreadValues(__spreadValues({}, defaultAppState.ui), initialUi), {
32702
- // Store categories under componentList on state to allow render functions and plugins to modify
32703
- componentList: config.categories ? Object.entries(config.categories).reduce(
32704
- (acc, [categoryName, category]) => {
32705
- return __spreadProps(__spreadValues({}, acc), {
32706
- [categoryName]: {
32707
- title: category.title,
32708
- components: category.components,
32709
- expanded: category.defaultExpanded,
32710
- visible: category.visible
32711
- }
32712
- });
32713
- },
32714
- {}
32715
- ) : {}
32716
- })
32717
- }));
32718
- const [appState, dispatch] = (0, import_react26.useReducer)(
33423
+ const [initialAppState] = (0, import_react28.useState)(() => {
33424
+ var _a2, _b, _c, _d;
33425
+ const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
33426
+ let clientUiState = {};
33427
+ if (typeof window !== "undefined") {
33428
+ if (window.matchMedia("(max-width: 638px)").matches) {
33429
+ clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
33430
+ leftSideBarVisible: false,
33431
+ rightSideBarVisible: false
33432
+ });
33433
+ }
33434
+ const viewportWidth = window.innerWidth;
33435
+ const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
33436
+ key,
33437
+ diff: Math.abs(viewportWidth - value.width)
33438
+ })).sort((a, b) => a.diff > b.diff ? 1 : -1);
33439
+ const closestViewport = viewportDifferences[0].key;
33440
+ if (iframe.enabled) {
33441
+ clientUiState = {
33442
+ viewports: __spreadProps(__spreadValues({}, initial.viewports), {
33443
+ current: __spreadProps(__spreadValues({}, initial.viewports.current), {
33444
+ height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
33445
+ width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
33446
+ })
33447
+ })
33448
+ };
33449
+ }
33450
+ }
33451
+ return __spreadProps(__spreadValues({}, defaultAppState), {
33452
+ data: initialData,
33453
+ ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
33454
+ // Store categories under componentList on state to allow render functions and plugins to modify
33455
+ componentList: config.categories ? Object.entries(config.categories).reduce(
33456
+ (acc, [categoryName, category]) => {
33457
+ return __spreadProps(__spreadValues({}, acc), {
33458
+ [categoryName]: {
33459
+ title: category.title,
33460
+ components: category.components,
33461
+ expanded: category.defaultExpanded,
33462
+ visible: category.visible
33463
+ }
33464
+ });
33465
+ },
33466
+ {}
33467
+ ) : {}
33468
+ })
33469
+ });
33470
+ });
33471
+ const [appState, dispatch] = (0, import_react28.useReducer)(
32719
33472
  reducer,
32720
33473
  flushZones(initialAppState)
32721
33474
  );
@@ -32726,9 +33479,9 @@ function Puck({
32726
33479
  config,
32727
33480
  dispatch
32728
33481
  );
32729
- const [menuOpen, setMenuOpen] = (0, import_react26.useState)(false);
33482
+ const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
32730
33483
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
32731
- const setItemSelector = (0, import_react26.useCallback)(
33484
+ const setItemSelector = (0, import_react28.useCallback)(
32732
33485
  (newItemSelector) => {
32733
33486
  if (newItemSelector === itemSelector)
32734
33487
  return;
@@ -32741,21 +33494,21 @@ function Puck({
32741
33494
  [itemSelector]
32742
33495
  );
32743
33496
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
32744
- (0, import_react26.useEffect)(() => {
33497
+ (0, import_react28.useEffect)(() => {
32745
33498
  if (onChange)
32746
33499
  onChange(data);
32747
33500
  }, [data]);
32748
33501
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
32749
- const [draggedItem, setDraggedItem] = (0, import_react26.useState)();
33502
+ const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
32750
33503
  const rootProps = data.root.props || data.root;
32751
- (0, import_react26.useEffect)(() => {
33504
+ (0, import_react28.useEffect)(() => {
32752
33505
  if (Object.keys(data.root).length > 0 && !data.root.props) {
32753
33506
  console.error(
32754
33507
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
32755
33508
  );
32756
33509
  }
32757
33510
  }, []);
32758
- const toggleSidebars = (0, import_react26.useCallback)(
33511
+ const toggleSidebars = (0, import_react28.useCallback)(
32759
33512
  (sidebar) => {
32760
33513
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
32761
33514
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -32769,7 +33522,7 @@ function Puck({
32769
33522
  },
32770
33523
  [dispatch, leftSideBarVisible, rightSideBarVisible]
32771
33524
  );
32772
- (0, import_react26.useEffect)(() => {
33525
+ (0, import_react28.useEffect)(() => {
32773
33526
  if (!window.matchMedia("(min-width: 638px)").matches) {
32774
33527
  dispatch({
32775
33528
  type: "setUi",
@@ -32792,269 +33545,254 @@ function Puck({
32792
33545
  window.removeEventListener("resize", handleResize);
32793
33546
  };
32794
33547
  }, []);
32795
- const defaultRender = (0, import_react26.useMemo)(() => {
32796
- const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: children2 });
33548
+ const defaultRender = (0, import_react28.useMemo)(() => {
33549
+ const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
32797
33550
  return PuckDefault;
32798
33551
  }, []);
32799
- const defaultHeaderRender = (0, import_react26.useMemo)(() => {
33552
+ const defaultHeaderRender = (0, import_react28.useMemo)(() => {
32800
33553
  if (renderHeader) {
32801
33554
  console.warn(
32802
33555
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
32803
33556
  );
32804
- const RenderHeader = (_a) => {
32805
- var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
33557
+ const RenderHeader = (_a2) => {
33558
+ var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
32806
33559
  const Comp = renderHeader;
32807
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
33560
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
32808
33561
  };
32809
33562
  return RenderHeader;
32810
33563
  }
32811
33564
  return defaultRender;
32812
33565
  }, [renderHeader]);
32813
- const defaultHeaderActionsRender = (0, import_react26.useMemo)(() => {
33566
+ const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
32814
33567
  if (renderHeaderActions) {
32815
33568
  console.warn(
32816
33569
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
32817
33570
  );
32818
33571
  const RenderHeader = (props) => {
32819
33572
  const Comp = renderHeaderActions;
32820
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
33573
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
32821
33574
  };
32822
33575
  return RenderHeader;
32823
33576
  }
32824
33577
  return defaultRender;
32825
33578
  }, [renderHeader]);
32826
- const loadedOverrides = (0, import_react26.useMemo)(() => {
33579
+ const loadedOverrides = (0, import_react28.useMemo)(() => {
32827
33580
  return loadOverrides({ overrides, plugins });
32828
33581
  }, [plugins]);
32829
- const CustomPuck = (0, import_react26.useMemo)(
33582
+ const CustomPuck = (0, import_react28.useMemo)(
32830
33583
  () => loadedOverrides.puck || defaultRender,
32831
33584
  [loadedOverrides]
32832
33585
  );
32833
- const CustomPreview = (0, import_react26.useMemo)(
32834
- () => loadedOverrides.preview || defaultRender,
32835
- [loadedOverrides]
32836
- );
32837
- const CustomHeader = (0, import_react26.useMemo)(
33586
+ const CustomHeader = (0, import_react28.useMemo)(
32838
33587
  () => loadedOverrides.header || defaultHeaderRender,
32839
33588
  [loadedOverrides]
32840
33589
  );
32841
- const CustomHeaderActions = (0, import_react26.useMemo)(
33590
+ const CustomHeaderActions = (0, import_react28.useMemo)(
32842
33591
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
32843
33592
  [loadedOverrides]
32844
33593
  );
32845
- const disableZoom = children || loadedOverrides.puck ? true : false;
32846
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "Puck", children: [
32847
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32848
- AppProvider,
32849
- {
32850
- value: {
32851
- state: appState,
32852
- dispatch,
32853
- config,
32854
- componentState,
32855
- resolveData,
32856
- plugins,
32857
- overrides: loadedOverrides,
32858
- history
32859
- },
32860
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32861
- import_dnd7.DragDropContext,
32862
- {
32863
- onDragUpdate: (update) => {
32864
- setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
32865
- onDragStartOrUpdate(update);
32866
- },
32867
- onBeforeDragStart: (start) => {
32868
- onDragStartOrUpdate(start);
32869
- setItemSelector(null);
32870
- dispatch({ type: "setUi", ui: { isDragging: true } });
32871
- },
32872
- onDragEnd: (droppedItem) => {
32873
- setDraggedItem(void 0);
32874
- dispatch({ type: "setUi", ui: { isDragging: false } });
32875
- if (!droppedItem.destination) {
32876
- return;
32877
- }
32878
- if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
32879
- const [_, componentType] = droppedItem.draggableId.split("::");
33594
+ const [mounted, setMounted] = (0, import_react28.useState)(false);
33595
+ (0, import_react28.useEffect)(() => {
33596
+ setMounted(true);
33597
+ }, []);
33598
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33599
+ AppProvider,
33600
+ {
33601
+ value: {
33602
+ state: appState,
33603
+ dispatch,
33604
+ config,
33605
+ componentState,
33606
+ resolveData,
33607
+ plugins,
33608
+ overrides: loadedOverrides,
33609
+ history,
33610
+ viewports,
33611
+ iframe
33612
+ },
33613
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33614
+ DragDropContext,
33615
+ {
33616
+ onDragUpdate: (update) => {
33617
+ setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
33618
+ onDragStartOrUpdate(update);
33619
+ },
33620
+ onBeforeDragStart: (start) => {
33621
+ onDragStartOrUpdate(start);
33622
+ setItemSelector(null);
33623
+ dispatch({ type: "setUi", ui: { isDragging: true } });
33624
+ },
33625
+ onDragEnd: (droppedItem) => {
33626
+ setDraggedItem(void 0);
33627
+ dispatch({ type: "setUi", ui: { isDragging: false } });
33628
+ if (!droppedItem.destination) {
33629
+ return;
33630
+ }
33631
+ if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
33632
+ const [_, componentType] = droppedItem.draggableId.split("::");
33633
+ dispatch({
33634
+ type: "insert",
33635
+ componentType: componentType || droppedItem.draggableId,
33636
+ destinationIndex: droppedItem.destination.index,
33637
+ destinationZone: droppedItem.destination.droppableId
33638
+ });
33639
+ setItemSelector({
33640
+ index: droppedItem.destination.index,
33641
+ zone: droppedItem.destination.droppableId
33642
+ });
33643
+ return;
33644
+ } else {
33645
+ const { source, destination } = droppedItem;
33646
+ if (source.droppableId === destination.droppableId) {
32880
33647
  dispatch({
32881
- type: "insert",
32882
- componentType: componentType || droppedItem.draggableId,
32883
- destinationIndex: droppedItem.destination.index,
32884
- destinationZone: droppedItem.destination.droppableId
32885
- });
32886
- setItemSelector({
32887
- index: droppedItem.destination.index,
32888
- zone: droppedItem.destination.droppableId
33648
+ type: "reorder",
33649
+ sourceIndex: source.index,
33650
+ destinationIndex: destination.index,
33651
+ destinationZone: destination.droppableId
32889
33652
  });
32890
- return;
32891
33653
  } else {
32892
- const { source, destination } = droppedItem;
32893
- if (source.droppableId === destination.droppableId) {
32894
- dispatch({
32895
- type: "reorder",
32896
- sourceIndex: source.index,
32897
- destinationIndex: destination.index,
32898
- destinationZone: destination.droppableId
32899
- });
32900
- } else {
32901
- dispatch({
32902
- type: "move",
32903
- sourceZone: source.droppableId,
32904
- sourceIndex: source.index,
32905
- destinationIndex: destination.index,
32906
- destinationZone: destination.droppableId
32907
- });
32908
- }
32909
- setItemSelector({
32910
- index: destination.index,
32911
- zone: destination.droppableId
33654
+ dispatch({
33655
+ type: "move",
33656
+ sourceZone: source.droppableId,
33657
+ sourceIndex: source.index,
33658
+ destinationIndex: destination.index,
33659
+ destinationZone: destination.droppableId
32912
33660
  });
32913
33661
  }
32914
- },
32915
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32916
- DropZoneProvider,
32917
- {
32918
- value: {
32919
- data,
32920
- itemSelector,
32921
- setItemSelector,
32922
- config,
32923
- dispatch,
32924
- draggedItem,
32925
- placeholderStyle,
32926
- mode: "edit",
32927
- areaId: "root",
32928
- disableZoom
32929
- },
32930
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
32931
- "div",
32932
- {
32933
- className: getClassName22({
32934
- leftSideBarVisible,
32935
- menuOpen,
32936
- rightSideBarVisible,
32937
- disableZoom
32938
- }),
32939
- children: [
32940
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32941
- CustomHeader,
32942
- {
32943
- actions: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
32944
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
32945
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32946
- Button,
33662
+ setItemSelector({
33663
+ index: destination.index,
33664
+ zone: destination.droppableId
33665
+ });
33666
+ }
33667
+ },
33668
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33669
+ DropZoneProvider,
33670
+ {
33671
+ value: {
33672
+ data,
33673
+ itemSelector,
33674
+ setItemSelector,
33675
+ config,
33676
+ dispatch,
33677
+ draggedItem,
33678
+ placeholderStyle,
33679
+ mode: "edit",
33680
+ areaId: "root"
33681
+ },
33682
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
33683
+ "div",
33684
+ {
33685
+ className: getClassName25({
33686
+ leftSideBarVisible,
33687
+ menuOpen,
33688
+ mounted,
33689
+ rightSideBarVisible
33690
+ }),
33691
+ children: [
33692
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33693
+ CustomHeader,
33694
+ {
33695
+ actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33696
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33697
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33698
+ Button,
33699
+ {
33700
+ onClick: () => {
33701
+ onPublish && onPublish(data);
33702
+ },
33703
+ icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
33704
+ children: "Publish"
33705
+ }
33706
+ )
33707
+ ] }),
33708
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
33709
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33710
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33711
+ IconButton,
32947
33712
  {
32948
33713
  onClick: () => {
32949
- onPublish && onPublish(data);
33714
+ toggleSidebars("left");
32950
33715
  },
32951
- icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Globe, { size: "14px" }),
32952
- children: "Publish"
33716
+ title: "Toggle left sidebar",
33717
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
32953
33718
  }
32954
- )
33719
+ ) }),
33720
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33721
+ IconButton,
33722
+ {
33723
+ onClick: () => {
33724
+ toggleSidebars("right");
33725
+ },
33726
+ title: "Toggle right sidebar",
33727
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
33728
+ }
33729
+ ) })
32955
33730
  ] }),
32956
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("header", { className: getClassName22("header"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerInner"), children: [
32957
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerToggle"), children: [
32958
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32959
- IconButton,
32960
- {
32961
- onClick: () => {
32962
- toggleSidebars("left");
32963
- },
32964
- title: "Toggle left sidebar",
32965
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelLeft, { focusable: "false" })
32966
- }
32967
- ) }),
32968
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32969
- IconButton,
32970
- {
32971
- onClick: () => {
32972
- toggleSidebars("right");
32973
- },
32974
- title: "Toggle right sidebar",
32975
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelRight, { focusable: "false" })
32976
- }
32977
- ) })
32978
- ] }),
32979
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Heading, { rank: 2, size: "xs", children: [
32980
- headerTitle || rootProps.title || "Page",
32981
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
32982
- " ",
32983
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("code", { className: getClassName22("headerPath"), children: headerPath })
32984
- ] })
32985
- ] }) }),
32986
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerTools"), children: [
32987
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32988
- IconButton,
32989
- {
32990
- onClick: () => {
32991
- return setMenuOpen(!menuOpen);
32992
- },
32993
- title: "Toggle menu bar",
32994
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { focusable: "false" })
32995
- }
32996
- ) }),
32997
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32998
- MenuBar,
32999
- {
33000
- appState,
33001
- data,
33002
- dispatch,
33003
- onPublish,
33004
- menuOpen,
33005
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
33006
- setMenuOpen
33007
- }
33008
- )
33731
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
33732
+ headerTitle || rootProps.title || "Page",
33733
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33734
+ " ",
33735
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
33009
33736
  ] })
33010
- ] }) })
33011
- }
33012
- ),
33013
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("leftSideBar"), children: [
33014
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Components, {}) }),
33015
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Outline, {}) })
33016
- ] }),
33017
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33018
- "div",
33019
- {
33020
- className: getClassName22("frame"),
33021
- onClick: () => setItemSelector(null),
33022
- children: [
33023
- /* @__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, {}) }) }),
33024
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33025
- "div",
33737
+ ] }) }),
33738
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
33739
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33740
+ IconButton,
33026
33741
  {
33027
- style: {
33028
- background: "var(--puck-color-grey-11)",
33029
- height: "100%",
33030
- flexGrow: 1
33031
- }
33742
+ onClick: () => {
33743
+ return setMenuOpen(!menuOpen);
33744
+ },
33745
+ title: "Toggle menu bar",
33746
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
33747
+ }
33748
+ ) }),
33749
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33750
+ MenuBar,
33751
+ {
33752
+ appState,
33753
+ data,
33754
+ dispatch,
33755
+ onPublish,
33756
+ menuOpen,
33757
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33758
+ setMenuOpen
33032
33759
  }
33033
33760
  )
33034
- ]
33035
- }
33036
- ),
33037
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33038
- SidebarSection,
33039
- {
33040
- noPadding: true,
33041
- noBorderTop: true,
33042
- showBreadcrumbs: true,
33043
- title: selectedItem ? selectedItem.type : "Page",
33044
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Fields, {})
33045
- }
33046
- ) })
33047
- ]
33048
- }
33049
- ) })
33050
- }
33051
- )
33052
- }
33053
- )
33054
- }
33055
- ),
33056
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "puck-portal-root" })
33057
- ] });
33761
+ ] })
33762
+ ] }) })
33763
+ }
33764
+ ),
33765
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
33766
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
33767
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
33768
+ ] }),
33769
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
33770
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33771
+ SidebarSection,
33772
+ {
33773
+ noPadding: true,
33774
+ noBorderTop: true,
33775
+ showBreadcrumbs: true,
33776
+ title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
33777
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
33778
+ }
33779
+ ) }),
33780
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33781
+ "div",
33782
+ {
33783
+ id: "puck-portal-root",
33784
+ className: getClassName25("portal")
33785
+ }
33786
+ )
33787
+ ]
33788
+ }
33789
+ ) })
33790
+ }
33791
+ )
33792
+ }
33793
+ )
33794
+ }
33795
+ ) });
33058
33796
  }
33059
33797
  Puck.Components = Components;
33060
33798
  Puck.Fields = Fields;
@@ -33063,13 +33801,16 @@ Puck.Preview = Preview;
33063
33801
 
33064
33802
  // components/Render/index.tsx
33065
33803
  init_react_import();
33066
- var import_jsx_runtime30 = require("react/jsx-runtime");
33067
- function Render({ config, data }) {
33804
+ var import_jsx_runtime35 = require("react/jsx-runtime");
33805
+ function Render({
33806
+ config,
33807
+ data
33808
+ }) {
33068
33809
  var _a;
33069
33810
  const rootProps = data.root.props || data.root;
33070
33811
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
33071
33812
  if ((_a = config.root) == null ? void 0 : _a.render) {
33072
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33813
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33073
33814
  config.root.render,
33074
33815
  __spreadProps(__spreadValues({}, rootProps), {
33075
33816
  puck: {
@@ -33078,11 +33819,11 @@ function Render({ config, data }) {
33078
33819
  title,
33079
33820
  editMode: false,
33080
33821
  id: "puck-root",
33081
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId })
33822
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
33082
33823
  })
33083
33824
  ) });
33084
33825
  }
33085
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) });
33826
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
33086
33827
  }
33087
33828
 
33088
33829
  // lib/migrate.ts
@@ -33143,37 +33884,51 @@ function transformProps(data, propTransforms) {
33143
33884
 
33144
33885
  // lib/resolve-all-data.ts
33145
33886
  init_react_import();
33146
- var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
33147
- const dynamicRoot = yield resolveRootData(data, config);
33148
- const { zones = {} } = data;
33149
- const zoneKeys = Object.keys(zones);
33150
- const resolvedZones = {};
33151
- for (let i = 0; i < zoneKeys.length; i++) {
33152
- const zoneKey = zoneKeys[i];
33153
- resolvedZones[zoneKey] = yield resolveAllComponentData(
33154
- zones[zoneKey],
33155
- config,
33156
- onResolveStart,
33157
- onResolveEnd
33158
- );
33159
- }
33160
- return __spreadProps(__spreadValues({}, data), {
33161
- root: dynamicRoot,
33162
- content: yield resolveAllComponentData(
33163
- data.content,
33164
- config,
33165
- onResolveStart,
33166
- onResolveEnd
33167
- ),
33168
- zones: resolvedZones
33887
+ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
33888
+ return __async(this, null, function* () {
33889
+ const dynamicRoot = yield resolveRootData(data, config);
33890
+ const { zones = {} } = data;
33891
+ const zoneKeys = Object.keys(zones);
33892
+ const resolvedZones = {};
33893
+ for (let i = 0; i < zoneKeys.length; i++) {
33894
+ const zoneKey = zoneKeys[i];
33895
+ resolvedZones[zoneKey] = yield resolveAllComponentData(
33896
+ zones[zoneKey],
33897
+ config,
33898
+ onResolveStart,
33899
+ onResolveEnd
33900
+ );
33901
+ }
33902
+ return __spreadProps(__spreadValues({}, data), {
33903
+ root: dynamicRoot,
33904
+ content: yield resolveAllComponentData(
33905
+ data.content,
33906
+ config,
33907
+ onResolveStart,
33908
+ onResolveEnd
33909
+ ),
33910
+ zones: resolvedZones
33911
+ });
33169
33912
  });
33170
- });
33913
+ }
33171
33914
 
33172
33915
  // lib/use-puck.ts
33173
33916
  init_react_import();
33174
33917
  var usePuck = () => {
33175
- const { state: appState, config, dispatch } = useAppContext();
33176
- return { appState, config, dispatch };
33918
+ const {
33919
+ state: appState,
33920
+ config,
33921
+ history,
33922
+ dispatch,
33923
+ selectedItem
33924
+ } = useAppContext();
33925
+ return {
33926
+ appState,
33927
+ config,
33928
+ dispatch,
33929
+ history,
33930
+ selectedItem: selectedItem || null
33931
+ };
33177
33932
  };
33178
33933
  // Annotate the CommonJS export names for ESM import in node:
33179
33934
  0 && (module.exports = {
@@ -33377,6 +34132,14 @@ lucide-react/dist/esm/icons/lock.js:
33377
34132
  * See the LICENSE file in the root directory of this source tree.
33378
34133
  *)
33379
34134
 
34135
+ lucide-react/dist/esm/icons/monitor.js:
34136
+ (**
34137
+ * @license lucide-react v0.298.0 - ISC
34138
+ *
34139
+ * This source code is licensed under the ISC license.
34140
+ * See the LICENSE file in the root directory of this source tree.
34141
+ *)
34142
+
33380
34143
  lucide-react/dist/esm/icons/more-vertical.js:
33381
34144
  (**
33382
34145
  * @license lucide-react v0.298.0 - ISC
@@ -33417,6 +34180,30 @@ lucide-react/dist/esm/icons/search.js:
33417
34180
  * See the LICENSE file in the root directory of this source tree.
33418
34181
  *)
33419
34182
 
34183
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
34184
+ (**
34185
+ * @license lucide-react v0.298.0 - ISC
34186
+ *
34187
+ * This source code is licensed under the ISC license.
34188
+ * See the LICENSE file in the root directory of this source tree.
34189
+ *)
34190
+
34191
+ lucide-react/dist/esm/icons/smartphone.js:
34192
+ (**
34193
+ * @license lucide-react v0.298.0 - ISC
34194
+ *
34195
+ * This source code is licensed under the ISC license.
34196
+ * See the LICENSE file in the root directory of this source tree.
34197
+ *)
34198
+
34199
+ lucide-react/dist/esm/icons/tablet.js:
34200
+ (**
34201
+ * @license lucide-react v0.298.0 - ISC
34202
+ *
34203
+ * This source code is licensed under the ISC license.
34204
+ * See the LICENSE file in the root directory of this source tree.
34205
+ *)
34206
+
33420
34207
  lucide-react/dist/esm/icons/trash.js:
33421
34208
  (**
33422
34209
  * @license lucide-react v0.298.0 - ISC
@@ -33441,6 +34228,22 @@ lucide-react/dist/esm/icons/unlock.js:
33441
34228
  * See the LICENSE file in the root directory of this source tree.
33442
34229
  *)
33443
34230
 
34231
+ lucide-react/dist/esm/icons/zoom-in.js:
34232
+ (**
34233
+ * @license lucide-react v0.298.0 - ISC
34234
+ *
34235
+ * This source code is licensed under the ISC license.
34236
+ * See the LICENSE file in the root directory of this source tree.
34237
+ *)
34238
+
34239
+ lucide-react/dist/esm/icons/zoom-out.js:
34240
+ (**
34241
+ * @license lucide-react v0.298.0 - ISC
34242
+ *
34243
+ * This source code is licensed under the ISC license.
34244
+ * See the LICENSE file in the root directory of this source tree.
34245
+ *)
34246
+
33444
34247
  lucide-react/dist/esm/lucide-react.js:
33445
34248
  (**
33446
34249
  * @license lucide-react v0.298.0 - ISC