@measured/puck 0.13.2-canary.7d861f5 → 0.14.0-canary.0337c8d

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -93,7 +93,8 @@ var init_react_import = __esm({
93
93
 
94
94
  // ../../node_modules/classnames/index.js
95
95
  var require_classnames = __commonJS({
96
- "../../node_modules/classnames/index.js"(exports, module2) {
96
+ "../../node_modules/classnames/index.js"(exports2, module2) {
97
+ "use strict";
97
98
  init_react_import();
98
99
  (function() {
99
100
  "use strict";
@@ -145,7 +146,7 @@ var require_classnames = __commonJS({
145
146
 
146
147
  // ../../node_modules/scheduler/cjs/scheduler.production.min.js
147
148
  var require_scheduler_production_min = __commonJS({
148
- "../../node_modules/scheduler/cjs/scheduler.production.min.js"(exports) {
149
+ "../../node_modules/scheduler/cjs/scheduler.production.min.js"(exports2) {
149
150
  "use strict";
150
151
  init_react_import();
151
152
  function f(a, b) {
@@ -188,12 +189,12 @@ var require_scheduler_production_min = __commonJS({
188
189
  }
189
190
  if ("object" === typeof performance && "function" === typeof performance.now) {
190
191
  l = performance;
191
- exports.unstable_now = function() {
192
+ exports2.unstable_now = function() {
192
193
  return l.now();
193
194
  };
194
195
  } else {
195
196
  p = Date, q = p.now();
196
- exports.unstable_now = function() {
197
+ exports2.unstable_now = function() {
197
198
  return p.now() - q;
198
199
  };
199
200
  }
@@ -247,7 +248,7 @@ var require_scheduler_production_min = __commonJS({
247
248
  v.callback = null;
248
249
  y = v.priorityLevel;
249
250
  var e = d(v.expirationTime <= b);
250
- b = exports.unstable_now();
251
+ b = exports2.unstable_now();
251
252
  "function" === typeof e ? v.callback = e : v === h(r) && k(r);
252
253
  G(b);
253
254
  } else
@@ -272,11 +273,11 @@ var require_scheduler_production_min = __commonJS({
272
273
  var P = 5;
273
274
  var Q = -1;
274
275
  function M() {
275
- return exports.unstable_now() - Q < P ? false : true;
276
+ return exports2.unstable_now() - Q < P ? false : true;
276
277
  }
277
278
  function R() {
278
279
  if (null !== O) {
279
- var a = exports.unstable_now();
280
+ var a = exports2.unstable_now();
280
281
  Q = a;
281
282
  var b = true;
282
283
  try {
@@ -310,31 +311,31 @@ var require_scheduler_production_min = __commonJS({
310
311
  }
311
312
  function K(a, b) {
312
313
  L = D(function() {
313
- a(exports.unstable_now());
314
+ a(exports2.unstable_now());
314
315
  }, b);
315
316
  }
316
- exports.unstable_IdlePriority = 5;
317
- exports.unstable_ImmediatePriority = 1;
318
- exports.unstable_LowPriority = 4;
319
- exports.unstable_NormalPriority = 3;
320
- exports.unstable_Profiling = null;
321
- exports.unstable_UserBlockingPriority = 2;
322
- exports.unstable_cancelCallback = function(a) {
317
+ exports2.unstable_IdlePriority = 5;
318
+ exports2.unstable_ImmediatePriority = 1;
319
+ exports2.unstable_LowPriority = 4;
320
+ exports2.unstable_NormalPriority = 3;
321
+ exports2.unstable_Profiling = null;
322
+ exports2.unstable_UserBlockingPriority = 2;
323
+ exports2.unstable_cancelCallback = function(a) {
323
324
  a.callback = null;
324
325
  };
325
- exports.unstable_continueExecution = function() {
326
+ exports2.unstable_continueExecution = function() {
326
327
  A || z || (A = true, I(J));
327
328
  };
328
- exports.unstable_forceFrameRate = function(a) {
329
+ exports2.unstable_forceFrameRate = function(a) {
329
330
  0 > a || 125 < a ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : P = 0 < a ? Math.floor(1e3 / a) : 5;
330
331
  };
331
- exports.unstable_getCurrentPriorityLevel = function() {
332
+ exports2.unstable_getCurrentPriorityLevel = function() {
332
333
  return y;
333
334
  };
334
- exports.unstable_getFirstCallbackNode = function() {
335
+ exports2.unstable_getFirstCallbackNode = function() {
335
336
  return h(r);
336
337
  };
337
- exports.unstable_next = function(a) {
338
+ exports2.unstable_next = function(a) {
338
339
  switch (y) {
339
340
  case 1:
340
341
  case 2:
@@ -352,11 +353,11 @@ var require_scheduler_production_min = __commonJS({
352
353
  y = c;
353
354
  }
354
355
  };
355
- exports.unstable_pauseExecution = function() {
356
+ exports2.unstable_pauseExecution = function() {
356
357
  };
357
- exports.unstable_requestPaint = function() {
358
+ exports2.unstable_requestPaint = function() {
358
359
  };
359
- exports.unstable_runWithPriority = function(a, b) {
360
+ exports2.unstable_runWithPriority = function(a, b) {
360
361
  switch (a) {
361
362
  case 1:
362
363
  case 2:
@@ -375,8 +376,8 @@ var require_scheduler_production_min = __commonJS({
375
376
  y = c;
376
377
  }
377
378
  };
378
- exports.unstable_scheduleCallback = function(a, b, c) {
379
- var d = exports.unstable_now();
379
+ exports2.unstable_scheduleCallback = function(a, b, c) {
380
+ var d = exports2.unstable_now();
380
381
  "object" === typeof c && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
381
382
  switch (a) {
382
383
  case 1:
@@ -399,8 +400,8 @@ var require_scheduler_production_min = __commonJS({
399
400
  c > d ? (a.sortIndex = c, f(t, a), null === h(r) && a === h(t) && (B ? (E(L), L = -1) : B = true, K(H, c - d))) : (a.sortIndex = e, f(r, a), A || z || (A = true, I(J)));
400
401
  return a;
401
402
  };
402
- exports.unstable_shouldYield = M;
403
- exports.unstable_wrapCallback = function(a) {
403
+ exports2.unstable_shouldYield = M;
404
+ exports2.unstable_wrapCallback = function(a) {
404
405
  var b = y;
405
406
  return function() {
406
407
  var c = y;
@@ -417,7 +418,7 @@ var require_scheduler_production_min = __commonJS({
417
418
 
418
419
  // ../../node_modules/scheduler/cjs/scheduler.development.js
419
420
  var require_scheduler_development = __commonJS({
420
- "../../node_modules/scheduler/cjs/scheduler.development.js"(exports) {
421
+ "../../node_modules/scheduler/cjs/scheduler.development.js"(exports2) {
421
422
  "use strict";
422
423
  init_react_import();
423
424
  if (process.env.NODE_ENV !== "production") {
@@ -505,13 +506,13 @@ var require_scheduler_development = __commonJS({
505
506
  var hasPerformanceNow = typeof performance === "object" && typeof performance.now === "function";
506
507
  if (hasPerformanceNow) {
507
508
  var localPerformance = performance;
508
- exports.unstable_now = function() {
509
+ exports2.unstable_now = function() {
509
510
  return localPerformance.now();
510
511
  };
511
512
  } else {
512
513
  var localDate = Date;
513
514
  var initialTime = localDate.now();
514
- exports.unstable_now = function() {
515
+ exports2.unstable_now = function() {
515
516
  return localDate.now() - initialTime;
516
517
  };
517
518
  }
@@ -577,7 +578,7 @@ var require_scheduler_development = __commonJS({
577
578
  return workLoop(hasTimeRemaining, initialTime2);
578
579
  } catch (error) {
579
580
  if (currentTask !== null) {
580
- var currentTime = exports.unstable_now();
581
+ var currentTime = exports2.unstable_now();
581
582
  markTaskErrored(currentTask, currentTime);
582
583
  currentTask.isQueued = false;
583
584
  }
@@ -606,7 +607,7 @@ var require_scheduler_development = __commonJS({
606
607
  currentPriorityLevel = currentTask.priorityLevel;
607
608
  var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
608
609
  var continuationCallback = callback(didUserCallbackTimeout);
609
- currentTime = exports.unstable_now();
610
+ currentTime = exports2.unstable_now();
610
611
  if (typeof continuationCallback === "function") {
611
612
  currentTask.callback = continuationCallback;
612
613
  } else {
@@ -682,7 +683,7 @@ var require_scheduler_development = __commonJS({
682
683
  };
683
684
  }
684
685
  function unstable_scheduleCallback(priorityLevel, callback, options) {
685
- var currentTime = exports.unstable_now();
686
+ var currentTime = exports2.unstable_now();
686
687
  var startTime2;
687
688
  if (typeof options === "object" && options !== null) {
688
689
  var delay = options.delay;
@@ -766,7 +767,7 @@ var require_scheduler_development = __commonJS({
766
767
  var frameInterval = frameYieldMs;
767
768
  var startTime = -1;
768
769
  function shouldYieldToHost() {
769
- var timeElapsed = exports.unstable_now() - startTime;
770
+ var timeElapsed = exports2.unstable_now() - startTime;
770
771
  if (timeElapsed < frameInterval) {
771
772
  return false;
772
773
  }
@@ -787,7 +788,7 @@ var require_scheduler_development = __commonJS({
787
788
  }
788
789
  var performWorkUntilDeadline = function() {
789
790
  if (scheduledHostCallback !== null) {
790
- var currentTime = exports.unstable_now();
791
+ var currentTime = exports2.unstable_now();
791
792
  startTime = currentTime;
792
793
  var hasTimeRemaining = true;
793
794
  var hasMoreWork = true;
@@ -831,7 +832,7 @@ var require_scheduler_development = __commonJS({
831
832
  }
832
833
  function requestHostTimeout(callback, ms) {
833
834
  taskTimeoutID = localSetTimeout(function() {
834
- callback(exports.unstable_now());
835
+ callback(exports2.unstable_now());
835
836
  }, ms);
836
837
  }
837
838
  function cancelHostTimeout() {
@@ -840,24 +841,24 @@ var require_scheduler_development = __commonJS({
840
841
  }
841
842
  var unstable_requestPaint = requestPaint;
842
843
  var unstable_Profiling = null;
843
- exports.unstable_IdlePriority = IdlePriority;
844
- exports.unstable_ImmediatePriority = ImmediatePriority;
845
- exports.unstable_LowPriority = LowPriority;
846
- exports.unstable_NormalPriority = NormalPriority;
847
- exports.unstable_Profiling = unstable_Profiling;
848
- exports.unstable_UserBlockingPriority = UserBlockingPriority;
849
- exports.unstable_cancelCallback = unstable_cancelCallback;
850
- exports.unstable_continueExecution = unstable_continueExecution;
851
- exports.unstable_forceFrameRate = forceFrameRate;
852
- exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
853
- exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
854
- exports.unstable_next = unstable_next;
855
- exports.unstable_pauseExecution = unstable_pauseExecution;
856
- exports.unstable_requestPaint = unstable_requestPaint;
857
- exports.unstable_runWithPriority = unstable_runWithPriority;
858
- exports.unstable_scheduleCallback = unstable_scheduleCallback;
859
- exports.unstable_shouldYield = shouldYieldToHost;
860
- exports.unstable_wrapCallback = unstable_wrapCallback;
844
+ exports2.unstable_IdlePriority = IdlePriority;
845
+ exports2.unstable_ImmediatePriority = ImmediatePriority;
846
+ exports2.unstable_LowPriority = LowPriority;
847
+ exports2.unstable_NormalPriority = NormalPriority;
848
+ exports2.unstable_Profiling = unstable_Profiling;
849
+ exports2.unstable_UserBlockingPriority = UserBlockingPriority;
850
+ exports2.unstable_cancelCallback = unstable_cancelCallback;
851
+ exports2.unstable_continueExecution = unstable_continueExecution;
852
+ exports2.unstable_forceFrameRate = forceFrameRate;
853
+ exports2.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
854
+ exports2.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
855
+ exports2.unstable_next = unstable_next;
856
+ exports2.unstable_pauseExecution = unstable_pauseExecution;
857
+ exports2.unstable_requestPaint = unstable_requestPaint;
858
+ exports2.unstable_runWithPriority = unstable_runWithPriority;
859
+ exports2.unstable_scheduleCallback = unstable_scheduleCallback;
860
+ exports2.unstable_shouldYield = shouldYieldToHost;
861
+ exports2.unstable_wrapCallback = unstable_wrapCallback;
861
862
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
862
863
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
863
864
  }
@@ -868,7 +869,7 @@ var require_scheduler_development = __commonJS({
868
869
 
869
870
  // ../../node_modules/scheduler/index.js
870
871
  var require_scheduler = __commonJS({
871
- "../../node_modules/scheduler/index.js"(exports, module2) {
872
+ "../../node_modules/scheduler/index.js"(exports2, module2) {
872
873
  "use strict";
873
874
  init_react_import();
874
875
  if (process.env.NODE_ENV === "production") {
@@ -881,7 +882,7 @@ var require_scheduler = __commonJS({
881
882
 
882
883
  // ../../node_modules/react-dom/cjs/react-dom.production.min.js
883
884
  var require_react_dom_production_min = __commonJS({
884
- "../../node_modules/react-dom/cjs/react-dom.production.min.js"(exports) {
885
+ "../../node_modules/react-dom/cjs/react-dom.production.min.js"(exports2) {
885
886
  "use strict";
886
887
  init_react_import();
887
888
  var aa = require("react");
@@ -7938,14 +7939,14 @@ var require_react_dom_production_min = __commonJS({
7938
7939
  }
7939
7940
  }
7940
7941
  var wl;
7941
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = tl;
7942
- exports.createPortal = function(a, b) {
7942
+ exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = tl;
7943
+ exports2.createPortal = function(a, b) {
7943
7944
  var c = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
7944
7945
  if (!ol(b))
7945
7946
  throw Error(p(200));
7946
7947
  return dl(a, b, null, c);
7947
7948
  };
7948
- exports.createRoot = function(a, b) {
7949
+ exports2.createRoot = function(a, b) {
7949
7950
  if (!ol(a))
7950
7951
  throw Error(p(299));
7951
7952
  var c = false, d = "", e = ll;
@@ -7955,7 +7956,7 @@ var require_react_dom_production_min = __commonJS({
7955
7956
  sf(8 === a.nodeType ? a.parentNode : a);
7956
7957
  return new ml(b);
7957
7958
  };
7958
- exports.findDOMNode = function(a) {
7959
+ exports2.findDOMNode = function(a) {
7959
7960
  if (null == a)
7960
7961
  return null;
7961
7962
  if (1 === a.nodeType)
@@ -7971,15 +7972,15 @@ var require_react_dom_production_min = __commonJS({
7971
7972
  a = null === a ? null : a.stateNode;
7972
7973
  return a;
7973
7974
  };
7974
- exports.flushSync = function(a) {
7975
+ exports2.flushSync = function(a) {
7975
7976
  return Sk(a);
7976
7977
  };
7977
- exports.hydrate = function(a, b, c) {
7978
+ exports2.hydrate = function(a, b, c) {
7978
7979
  if (!pl(b))
7979
7980
  throw Error(p(200));
7980
7981
  return sl(null, a, b, true, c);
7981
7982
  };
7982
- exports.hydrateRoot = function(a, b, c) {
7983
+ exports2.hydrateRoot = function(a, b, c) {
7983
7984
  if (!ol(a))
7984
7985
  throw Error(p(405));
7985
7986
  var d = null != c && c.hydratedSources || null, e = false, f = "", g = ll;
@@ -7995,12 +7996,12 @@ var require_react_dom_production_min = __commonJS({
7995
7996
  );
7996
7997
  return new nl(b);
7997
7998
  };
7998
- exports.render = function(a, b, c) {
7999
+ exports2.render = function(a, b, c) {
7999
8000
  if (!pl(b))
8000
8001
  throw Error(p(200));
8001
8002
  return sl(null, a, b, false, c);
8002
8003
  };
8003
- exports.unmountComponentAtNode = function(a) {
8004
+ exports2.unmountComponentAtNode = function(a) {
8004
8005
  if (!pl(a))
8005
8006
  throw Error(p(40));
8006
8007
  return a._reactRootContainer ? (Sk(function() {
@@ -8010,21 +8011,21 @@ var require_react_dom_production_min = __commonJS({
8010
8011
  });
8011
8012
  }), true) : false;
8012
8013
  };
8013
- exports.unstable_batchedUpdates = Rk;
8014
- exports.unstable_renderSubtreeIntoContainer = function(a, b, c, d) {
8014
+ exports2.unstable_batchedUpdates = Rk;
8015
+ exports2.unstable_renderSubtreeIntoContainer = function(a, b, c, d) {
8015
8016
  if (!pl(c))
8016
8017
  throw Error(p(200));
8017
8018
  if (null == a || void 0 === a._reactInternals)
8018
8019
  throw Error(p(38));
8019
8020
  return sl(a, b, c, false, d);
8020
8021
  };
8021
- exports.version = "18.2.0-next-9e3b772b8-20220608";
8022
+ exports2.version = "18.2.0-next-9e3b772b8-20220608";
8022
8023
  }
8023
8024
  });
8024
8025
 
8025
8026
  // ../../node_modules/react-dom/cjs/react-dom.development.js
8026
8027
  var require_react_dom_development = __commonJS({
8027
- "../../node_modules/react-dom/cjs/react-dom.development.js"(exports) {
8028
+ "../../node_modules/react-dom/cjs/react-dom.development.js"(exports2) {
8028
8029
  "use strict";
8029
8030
  init_react_import();
8030
8031
  if (process.env.NODE_ENV !== "production") {
@@ -8084,7 +8085,7 @@ var require_react_dom_development = __commonJS({
8084
8085
  var HostPortal = 4;
8085
8086
  var HostComponent = 5;
8086
8087
  var HostText = 6;
8087
- var Fragment14 = 7;
8088
+ var Fragment17 = 7;
8088
8089
  var Mode = 8;
8089
8090
  var ContextConsumer = 9;
8090
8091
  var ContextProvider = 10;
@@ -8264,8 +8265,8 @@ var require_react_dom_development = __commonJS({
8264
8265
  if (propertyInfo !== null) {
8265
8266
  return !propertyInfo.acceptsBooleans;
8266
8267
  } else {
8267
- var prefix2 = name.toLowerCase().slice(0, 5);
8268
- return prefix2 !== "data-" && prefix2 !== "aria-";
8268
+ var prefix3 = name.toLowerCase().slice(0, 5);
8269
+ return prefix3 !== "data-" && prefix3 !== "aria-";
8269
8270
  }
8270
8271
  }
8271
8272
  default:
@@ -8937,18 +8938,18 @@ var require_react_dom_development = __commonJS({
8937
8938
  }
8938
8939
  }
8939
8940
  var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
8940
- var prefix;
8941
+ var prefix2;
8941
8942
  function describeBuiltInComponentFrame(name, source, ownerFn) {
8942
8943
  {
8943
- if (prefix === void 0) {
8944
+ if (prefix2 === void 0) {
8944
8945
  try {
8945
8946
  throw Error();
8946
8947
  } catch (x) {
8947
8948
  var match = x.stack.trim().match(/\n( *(at )?)/);
8948
- prefix = match && match[1] || "";
8949
+ prefix2 = match && match[1] || "";
8949
8950
  }
8950
8951
  }
8951
- return "\n" + prefix + name;
8952
+ return "\n" + prefix2 + name;
8952
8953
  }
8953
8954
  }
8954
8955
  var reentry = false;
@@ -9240,7 +9241,7 @@ var require_react_dom_development = __commonJS({
9240
9241
  return "DehydratedFragment";
9241
9242
  case ForwardRef:
9242
9243
  return getWrappedName$1(type, type.render, "ForwardRef");
9243
- case Fragment14:
9244
+ case Fragment17:
9244
9245
  return "Fragment";
9245
9246
  case HostComponent:
9246
9247
  return type;
@@ -10033,13 +10034,13 @@ var require_react_dom_development = __commonJS({
10033
10034
  strokeOpacity: true,
10034
10035
  strokeWidth: true
10035
10036
  };
10036
- function prefixKey(prefix2, key) {
10037
- return prefix2 + key.charAt(0).toUpperCase() + key.substring(1);
10037
+ function prefixKey(prefix3, key) {
10038
+ return prefix3 + key.charAt(0).toUpperCase() + key.substring(1);
10038
10039
  }
10039
10040
  var prefixes = ["Webkit", "ms", "Moz", "O"];
10040
10041
  Object.keys(isUnitlessNumber).forEach(function(prop) {
10041
- prefixes.forEach(function(prefix2) {
10042
- isUnitlessNumber[prefixKey(prefix2, prop)] = isUnitlessNumber[prop];
10042
+ prefixes.forEach(function(prefix3) {
10043
+ isUnitlessNumber[prefixKey(prefix3, prop)] = isUnitlessNumber[prop];
10043
10044
  });
10044
10045
  });
10045
10046
  function dangerousStyleValue(name, value, isCustomProperty) {
@@ -18911,7 +18912,7 @@ var require_react_dom_development = __commonJS({
18911
18912
  }
18912
18913
  }
18913
18914
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
18914
- if (current2 === null || current2.tag !== Fragment14) {
18915
+ if (current2 === null || current2.tag !== Fragment17) {
18915
18916
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
18916
18917
  created.return = returnFiber;
18917
18918
  return created;
@@ -19314,7 +19315,7 @@ var require_react_dom_development = __commonJS({
19314
19315
  if (child.key === key) {
19315
19316
  var elementType = element.type;
19316
19317
  if (elementType === REACT_FRAGMENT_TYPE) {
19317
- if (child.tag === Fragment14) {
19318
+ if (child.tag === Fragment17) {
19318
19319
  deleteRemainingChildren(returnFiber, child.sibling);
19319
19320
  var existing = useFiber(child, element.props.children);
19320
19321
  existing.return = returnFiber;
@@ -23489,7 +23490,7 @@ var require_react_dom_development = __commonJS({
23489
23490
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
23490
23491
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
23491
23492
  }
23492
- case Fragment14:
23493
+ case Fragment17:
23493
23494
  return updateFragment(current2, workInProgress2, renderLanes2);
23494
23495
  case Mode:
23495
23496
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -23762,7 +23763,7 @@ var require_react_dom_development = __commonJS({
23762
23763
  case SimpleMemoComponent:
23763
23764
  case FunctionComponent:
23764
23765
  case ForwardRef:
23765
- case Fragment14:
23766
+ case Fragment17:
23766
23767
  case Mode:
23767
23768
  case Profiler:
23768
23769
  case ContextConsumer:
@@ -28021,7 +28022,7 @@ var require_react_dom_development = __commonJS({
28021
28022
  return fiber;
28022
28023
  }
28023
28024
  function createFiberFromFragment(elements, mode, lanes, key) {
28024
- var fiber = createFiber(Fragment14, elements, key, mode);
28025
+ var fiber = createFiber(Fragment17, elements, key, mode);
28025
28026
  fiber.lanes = lanes;
28026
28027
  return fiber;
28027
28028
  }
@@ -29094,18 +29095,18 @@ var require_react_dom_development = __commonJS({
29094
29095
  }
29095
29096
  }
29096
29097
  }
29097
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
29098
- exports.createPortal = createPortal$1;
29099
- exports.createRoot = createRoot$1;
29100
- exports.findDOMNode = findDOMNode;
29101
- exports.flushSync = flushSync$1;
29102
- exports.hydrate = hydrate;
29103
- exports.hydrateRoot = hydrateRoot$1;
29104
- exports.render = render;
29105
- exports.unmountComponentAtNode = unmountComponentAtNode;
29106
- exports.unstable_batchedUpdates = batchedUpdates$1;
29107
- exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
29108
- exports.version = ReactVersion;
29098
+ exports2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
29099
+ exports2.createPortal = createPortal$1;
29100
+ exports2.createRoot = createRoot$1;
29101
+ exports2.findDOMNode = findDOMNode;
29102
+ exports2.flushSync = flushSync$1;
29103
+ exports2.hydrate = hydrate;
29104
+ exports2.hydrateRoot = hydrateRoot$1;
29105
+ exports2.render = render;
29106
+ exports2.unmountComponentAtNode = unmountComponentAtNode;
29107
+ exports2.unstable_batchedUpdates = batchedUpdates$1;
29108
+ exports2.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
29109
+ exports2.version = ReactVersion;
29109
29110
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
29110
29111
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
29111
29112
  }
@@ -29116,7 +29117,7 @@ var require_react_dom_development = __commonJS({
29116
29117
 
29117
29118
  // ../../node_modules/react-dom/index.js
29118
29119
  var require_react_dom = __commonJS({
29119
- "../../node_modules/react-dom/index.js"(exports, module2) {
29120
+ "../../node_modules/react-dom/index.js"(exports2, module2) {
29120
29121
  "use strict";
29121
29122
  init_react_import();
29122
29123
  function checkDCE() {
@@ -29171,9 +29172,19 @@ init_react_import();
29171
29172
  init_react_import();
29172
29173
  var import_react2 = require("react");
29173
29174
 
29174
- // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
29175
- init_react_import();
29176
- var Button_module_default = { "Button": "_Button_1brfa_1", "Button--medium": "_Button--medium_1brfa_22", "Button--large": "_Button--large_1brfa_29", "Button-icon": "_Button-icon_1brfa_36", "Button--primary": "_Button--primary_1brfa_44", "Button--secondary": "_Button--secondary_1brfa_53", "Button--flush": "_Button--flush_1brfa_64", "Button--disabled": "_Button--disabled_1brfa_68", "Button--fullWidth": "_Button--fullWidth_1brfa_78" };
29175
+ // components/Button/Button.module.css
29176
+ var Button_default = {
29177
+ Button: "Button_Button",
29178
+ "Button--medium": "Button_Button--medium",
29179
+ "Button--large": "Button_Button--large",
29180
+ "Button-icon": "Button_Button-icon",
29181
+ "Button--primary": "Button_Button--primary",
29182
+ "Button--secondary": "Button_Button--secondary",
29183
+ "Button--flush": "Button_Button--flush",
29184
+ "Button--disabled": "Button_Button--disabled",
29185
+ "Button--fullWidth": "Button_Button--fullWidth",
29186
+ "Button-spinner": "Button_Button-spinner"
29187
+ };
29177
29188
 
29178
29189
  // lib/get-class-name-factory.ts
29179
29190
  init_react_import();
@@ -29210,7 +29221,7 @@ var get_class_name_factory_default = getClassNameFactory;
29210
29221
  // components/Button/Button.tsx
29211
29222
  var import_react_spinners = require("react-spinners");
29212
29223
  var import_jsx_runtime = require("react/jsx-runtime");
29213
- var getClassName = get_class_name_factory_default("Button", Button_module_default);
29224
+ var getClassName = get_class_name_factory_default("Button", Button_default);
29214
29225
  var Button = ({
29215
29226
  children,
29216
29227
  href,
@@ -29227,7 +29238,7 @@ var Button = ({
29227
29238
  }) => {
29228
29239
  const [loading, setLoading] = (0, import_react2.useState)(loadingProp);
29229
29240
  (0, import_react2.useEffect)(() => setLoading(loadingProp), [loadingProp]);
29230
- const ElementType = href ? "a" : onClick ? "button" : "div";
29241
+ const ElementType = href ? "a" : type ? "button" : "span";
29231
29242
  const el = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
29232
29243
  ElementType,
29233
29244
  {
@@ -29255,10 +29266,7 @@ var Button = ({
29255
29266
  children: [
29256
29267
  icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("icon"), children: icon }),
29257
29268
  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
- ] })
29269
+ 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
29270
  ]
29263
29271
  }
29264
29272
  );
@@ -29267,16 +29275,190 @@ var Button = ({
29267
29275
 
29268
29276
  // components/Drawer/index.tsx
29269
29277
  init_react_import();
29270
- var import_dnd2 = require("@hello-pangea/dnd");
29271
29278
 
29272
- // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
29279
+ // components/Droppable/index.tsx
29273
29280
  init_react_import();
29274
- var styles_module_default = { "DrawerItem": "_DrawerItem_1qydx_1", "DrawerItem-default": "_DrawerItem-default_1qydx_1", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_1qydx_1", "DrawerItem-draggable": "_DrawerItem-draggable_1qydx_1", "Drawer": "_Drawer_1qydx_1", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_1qydx_21", "DrawerItem-name": "_DrawerItem-name_1qydx_26" };
29281
+ var import_dnd = require("@measured/dnd");
29275
29282
 
29276
- // components/Draggable/index.tsx
29283
+ // components/Puck/context.tsx
29284
+ init_react_import();
29285
+ var import_react3 = require("react");
29286
+
29287
+ // lib/get-item.ts
29288
+ init_react_import();
29289
+
29290
+ // lib/root-droppable-id.ts
29291
+ init_react_import();
29292
+ var rootDroppableId = "default-zone";
29293
+
29294
+ // lib/setup-zone.ts
29295
+ init_react_import();
29296
+ var setupZone = (data, zoneKey) => {
29297
+ if (zoneKey === rootDroppableId) {
29298
+ return data;
29299
+ }
29300
+ const newData = __spreadValues({}, data);
29301
+ newData.zones = data.zones || {};
29302
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29303
+ return newData;
29304
+ };
29305
+
29306
+ // lib/get-item.ts
29307
+ var getItem = (selector, data, dynamicProps = {}) => {
29308
+ if (!selector.zone || selector.zone === rootDroppableId) {
29309
+ const item2 = data.content[selector.index];
29310
+ return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29311
+ }
29312
+ const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29313
+ return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
29314
+ };
29315
+
29316
+ // components/ViewportControls/default-viewports.ts
29277
29317
  init_react_import();
29278
- var import_dnd = require("@hello-pangea/dnd");
29318
+ var defaultViewports = [
29319
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
29320
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
29321
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
29322
+ ];
29323
+
29324
+ // components/Puck/context.tsx
29279
29325
  var import_jsx_runtime2 = require("react/jsx-runtime");
29326
+ var defaultAppState = {
29327
+ data: { content: [], root: { props: { title: "" } } },
29328
+ ui: {
29329
+ leftSideBarVisible: true,
29330
+ rightSideBarVisible: true,
29331
+ arrayState: {},
29332
+ itemSelector: null,
29333
+ componentList: {},
29334
+ isDragging: false,
29335
+ viewports: {
29336
+ current: {
29337
+ width: defaultViewports[0].width,
29338
+ height: defaultViewports[0].height || "auto"
29339
+ },
29340
+ options: [],
29341
+ controlsVisible: true
29342
+ }
29343
+ }
29344
+ };
29345
+ var defaultContext = {
29346
+ state: defaultAppState,
29347
+ dispatch: () => null,
29348
+ config: { components: {} },
29349
+ componentState: {},
29350
+ resolveData: () => {
29351
+ },
29352
+ plugins: [],
29353
+ overrides: {},
29354
+ history: {},
29355
+ viewports: defaultViewports,
29356
+ zoomConfig: {
29357
+ autoZoom: 1,
29358
+ rootHeight: 0,
29359
+ zoom: 1
29360
+ },
29361
+ setZoomConfig: () => null,
29362
+ status: "LOADING",
29363
+ setStatus: () => null,
29364
+ iframe: {}
29365
+ };
29366
+ var appContext = (0, import_react3.createContext)(defaultContext);
29367
+ var AppProvider = ({
29368
+ children,
29369
+ value
29370
+ }) => {
29371
+ const [zoomConfig, setZoomConfig] = (0, import_react3.useState)(defaultContext.zoomConfig);
29372
+ const [status, setStatus] = (0, import_react3.useState)("LOADING");
29373
+ (0, import_react3.useEffect)(() => {
29374
+ setStatus("MOUNTED");
29375
+ }, []);
29376
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29377
+ appContext.Provider,
29378
+ {
29379
+ value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig, status, setStatus }),
29380
+ children
29381
+ }
29382
+ );
29383
+ };
29384
+ function useAppContext() {
29385
+ const mainContext = (0, import_react3.useContext)(appContext);
29386
+ const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29387
+ return __spreadProps(__spreadValues({}, mainContext), {
29388
+ // Helpers
29389
+ selectedItem,
29390
+ setUi: (ui, recordHistory) => {
29391
+ return mainContext.dispatch({
29392
+ type: "setUi",
29393
+ ui,
29394
+ recordHistory
29395
+ });
29396
+ }
29397
+ });
29398
+ }
29399
+
29400
+ // components/Droppable/index.tsx
29401
+ var import_jsx_runtime3 = require("react/jsx-runtime");
29402
+ var defaultProvided = {
29403
+ droppableProps: {
29404
+ "data-rfd-droppable-context-id": "",
29405
+ "data-rfd-droppable-id": ""
29406
+ },
29407
+ placeholder: null,
29408
+ innerRef: () => null
29409
+ };
29410
+ var defaultSnapshot = {
29411
+ isDraggingOver: false,
29412
+ draggingOverWith: null,
29413
+ draggingFromThisWith: null,
29414
+ isUsingPlaceholder: false
29415
+ };
29416
+ var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: children(defaultProvided, defaultSnapshot) });
29417
+ var Droppable = (props) => {
29418
+ const { status } = useAppContext();
29419
+ const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
29420
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(El, __spreadValues({}, props));
29421
+ };
29422
+
29423
+ // components/Drawer/styles.module.css
29424
+ var styles_default = {
29425
+ Drawer: "styles_Drawer",
29426
+ "DrawerItem-default": "styles_DrawerItem-default",
29427
+ "DrawerItem-draggableWrapper": "styles_DrawerItem-draggableWrapper",
29428
+ DrawerItem: "styles_DrawerItem",
29429
+ "DrawerItem-draggable": "styles_DrawerItem-draggable",
29430
+ "Drawer--isDraggingFrom": "styles_Drawer--isDraggingFrom",
29431
+ "DrawerItem-name": "styles_DrawerItem-name"
29432
+ };
29433
+
29434
+ // components/Draggable/index.tsx
29435
+ init_react_import();
29436
+ var import_dnd2 = require("@measured/dnd");
29437
+ var import_jsx_runtime4 = require("react/jsx-runtime");
29438
+ var defaultProvided2 = {
29439
+ draggableProps: {
29440
+ "data-rfd-draggable-context-id": "",
29441
+ "data-rfd-draggable-id": ""
29442
+ },
29443
+ dragHandleProps: null,
29444
+ innerRef: () => null
29445
+ };
29446
+ var defaultSnapshot2 = {
29447
+ isDragging: false,
29448
+ isDropAnimating: false,
29449
+ isClone: false,
29450
+ dropAnimation: null,
29451
+ draggingOver: null,
29452
+ combineWith: null,
29453
+ combineTargetFor: null,
29454
+ mode: null
29455
+ };
29456
+ var defaultRubric = {
29457
+ draggableId: "",
29458
+ type: "",
29459
+ source: { droppableId: "", index: 0 }
29460
+ };
29461
+ var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
29280
29462
  var Draggable = ({
29281
29463
  className,
29282
29464
  children,
@@ -29286,39 +29468,33 @@ var Draggable = ({
29286
29468
  disableAnimations = false,
29287
29469
  isDragDisabled = false
29288
29470
  }) => {
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
- );
29471
+ const { status } = useAppContext();
29472
+ const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
29473
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
29474
+ var _a;
29475
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
29476
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29477
+ "div",
29478
+ __spreadProps(__spreadValues(__spreadValues({
29479
+ className: className && className(provided, snapshot),
29480
+ ref: provided.innerRef
29481
+ }, provided.draggableProps), provided.dragHandleProps), {
29482
+ style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
29483
+ transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
29484
+ }),
29485
+ children: children(provided, snapshot)
29486
+ })
29487
+ ),
29488
+ showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29489
+ "div",
29490
+ {
29491
+ className: className && className(provided, snapshot),
29492
+ style: { transform: "none !important" },
29493
+ children: children(provided, snapshot)
29494
+ }
29495
+ )
29496
+ ] });
29497
+ } });
29322
29498
  };
29323
29499
 
29324
29500
  // components/DragIcon/index.tsx
@@ -29348,28 +29524,29 @@ var replace = (list, index, newItem) => {
29348
29524
  return result;
29349
29525
  };
29350
29526
 
29351
- // css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
29352
- init_react_import();
29353
- var styles_module_default2 = { "DragIcon": "_DragIcon_o29on_1" };
29527
+ // components/DragIcon/styles.module.css
29528
+ var styles_default2 = {
29529
+ DragIcon: "styles_DragIcon"
29530
+ };
29354
29531
 
29355
29532
  // components/DragIcon/index.tsx
29356
- var import_jsx_runtime3 = require("react/jsx-runtime");
29357
- 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" }) }) });
29533
+ var import_jsx_runtime5 = require("react/jsx-runtime");
29534
+ var getClassName2 = get_class_name_factory_default("DragIcon", styles_default2);
29535
+ 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
29536
 
29360
29537
  // components/Drawer/index.tsx
29361
- var import_react3 = require("react");
29362
- var import_jsx_runtime4 = require("react/jsx-runtime");
29363
- var getClassName3 = get_class_name_factory_default("Drawer", styles_module_default);
29364
- var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_module_default);
29365
- var drawerContext = (0, import_react3.createContext)({
29538
+ var import_react4 = require("react");
29539
+ var import_jsx_runtime6 = require("react/jsx-runtime");
29540
+ var getClassName3 = get_class_name_factory_default("Drawer", styles_default);
29541
+ var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_default);
29542
+ var drawerContext = (0, import_react4.createContext)({
29366
29543
  droppableId: ""
29367
29544
  });
29368
29545
  var DrawerDraggable = ({
29369
29546
  children,
29370
29547
  id,
29371
29548
  index
29372
- }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29549
+ }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
29373
29550
  Draggable,
29374
29551
  {
29375
29552
  id,
@@ -29385,17 +29562,18 @@ var DrawerItem = ({
29385
29562
  name,
29386
29563
  children,
29387
29564
  id,
29565
+ label,
29388
29566
  index
29389
29567
  }) => {
29390
- const ctx = (0, import_react3.useContext)(drawerContext);
29568
+ const ctx = (0, import_react4.useContext)(drawerContext);
29391
29569
  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 })),
29570
+ const CustomInner = (0, import_react4.useMemo)(
29571
+ () => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29394
29572
  [children]
29395
29573
  );
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, {}) })
29574
+ 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: [
29575
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("name"), children: label != null ? label : name }),
29576
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DragIcon, {}) })
29399
29577
  ] }) }) }) });
29400
29578
  };
29401
29579
  var Drawer = ({
@@ -29403,7 +29581,7 @@ var Drawer = ({
29403
29581
  droppableId = "component-list",
29404
29582
  direction = "vertical"
29405
29583
  }) => {
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)(
29584
+ 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
29585
  "div",
29408
29586
  __spreadProps(__spreadValues({}, provided.droppableProps), {
29409
29587
  ref: provided.innerRef,
@@ -29412,7 +29590,7 @@ var Drawer = ({
29412
29590
  }),
29413
29591
  children: [
29414
29592
  children,
29415
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
29593
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
29416
29594
  ]
29417
29595
  })
29418
29596
  ) }) });
@@ -29425,19 +29603,32 @@ var import_react9 = require("react");
29425
29603
 
29426
29604
  // components/DraggableComponent/index.tsx
29427
29605
  init_react_import();
29428
- var import_react6 = require("react");
29429
- var import_dnd3 = require("@hello-pangea/dnd");
29606
+ var import_react7 = require("react");
29607
+ var import_dnd3 = require("@measured/dnd");
29430
29608
 
29431
- // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
29432
- init_react_import();
29433
- var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_foluk_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_foluk_6", "DraggableComponent-contents": "_DraggableComponent-contents_foluk_12", "DraggableComponent-overlay": "_DraggableComponent-overlay_foluk_25", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_foluk_39", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_foluk_55", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_foluk_61", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_foluk_66", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_foluk_71", "DraggableComponent-actions": "_DraggableComponent-actions_foluk_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_foluk_120", "DraggableComponent-action": "_DraggableComponent-action_foluk_97" };
29609
+ // components/DraggableComponent/styles.module.css
29610
+ var styles_default3 = {
29611
+ DraggableComponent: "styles_DraggableComponent",
29612
+ "DraggableComponent--isDragging": "styles_DraggableComponent--isDragging",
29613
+ "DraggableComponent-contents": "styles_DraggableComponent-contents",
29614
+ "DraggableComponent-overlay": "styles_DraggableComponent-overlay",
29615
+ "DraggableComponent-loadingOverlay": "styles_DraggableComponent-loadingOverlay",
29616
+ "DraggableComponent--isLocked": "styles_DraggableComponent--isLocked",
29617
+ "DraggableComponent--forceHover": "styles_DraggableComponent--forceHover",
29618
+ "DraggableComponent--isSelected": "styles_DraggableComponent--isSelected",
29619
+ "DraggableComponent--indicativeHover": "styles_DraggableComponent--indicativeHover",
29620
+ "DraggableComponent-actionsOverlay": "styles_DraggableComponent-actionsOverlay",
29621
+ "DraggableComponent-actions": "styles_DraggableComponent-actions",
29622
+ "DraggableComponent-actionsLabel": "styles_DraggableComponent-actionsLabel",
29623
+ "DraggableComponent-action": "styles_DraggableComponent-action"
29624
+ };
29434
29625
 
29435
29626
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
29436
29627
  init_react_import();
29437
29628
 
29438
29629
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
29439
29630
  init_react_import();
29440
- var import_react4 = require("react");
29631
+ var import_react5 = require("react");
29441
29632
 
29442
29633
  // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
29443
29634
  init_react_import();
@@ -29456,10 +29647,10 @@ var defaultAttributes = {
29456
29647
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
29457
29648
  var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
29458
29649
  var createLucideIcon = (iconName, iconNode) => {
29459
- const Component = (0, import_react4.forwardRef)(
29650
+ const Component = (0, import_react5.forwardRef)(
29460
29651
  (_a, ref) => {
29461
29652
  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)(
29653
+ return (0, import_react5.createElement)(
29463
29654
  "svg",
29464
29655
  __spreadValues(__spreadProps(__spreadValues({
29465
29656
  ref
@@ -29471,7 +29662,7 @@ var createLucideIcon = (iconName, iconNode) => {
29471
29662
  className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
29472
29663
  }), rest),
29473
29664
  [
29474
- ...iconNode.map(([tag, attrs]) => (0, import_react4.createElement)(tag, attrs)),
29665
+ ...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
29475
29666
  ...Array.isArray(children) ? children : [children]
29476
29667
  ]
29477
29668
  );
@@ -29582,6 +29773,14 @@ var Lock = createLucideIcon("Lock", [
29582
29773
  ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
29583
29774
  ]);
29584
29775
 
29776
+ // ../../node_modules/lucide-react/dist/esm/icons/monitor.js
29777
+ init_react_import();
29778
+ var Monitor = createLucideIcon("Monitor", [
29779
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
29780
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
29781
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
29782
+ ]);
29783
+
29585
29784
  // ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
29586
29785
  init_react_import();
29587
29786
  var MoreVertical = createLucideIcon("MoreVertical", [
@@ -29618,6 +29817,34 @@ var Search = createLucideIcon("Search", [
29618
29817
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
29619
29818
  ]);
29620
29819
 
29820
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
29821
+ init_react_import();
29822
+ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
29823
+ ["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
29824
+ ["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
29825
+ ["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
29826
+ ["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
29827
+ ["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
29828
+ ["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
29829
+ ["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
29830
+ ["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
29831
+ ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
29832
+ ]);
29833
+
29834
+ // ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
29835
+ init_react_import();
29836
+ var Smartphone = createLucideIcon("Smartphone", [
29837
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
29838
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
29839
+ ]);
29840
+
29841
+ // ../../node_modules/lucide-react/dist/esm/icons/tablet.js
29842
+ init_react_import();
29843
+ var Tablet = createLucideIcon("Tablet", [
29844
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
29845
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
29846
+ ]);
29847
+
29621
29848
  // ../../node_modules/lucide-react/dist/esm/icons/trash.js
29622
29849
  init_react_import();
29623
29850
  var Trash = createLucideIcon("Trash", [
@@ -29641,12 +29868,29 @@ var Unlock = createLucideIcon("Unlock", [
29641
29868
  ["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
29642
29869
  ]);
29643
29870
 
29871
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
29872
+ init_react_import();
29873
+ var ZoomIn = createLucideIcon("ZoomIn", [
29874
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29875
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29876
+ ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
29877
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29878
+ ]);
29879
+
29880
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
29881
+ init_react_import();
29882
+ var ZoomOut = createLucideIcon("ZoomOut", [
29883
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29884
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29885
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29886
+ ]);
29887
+
29644
29888
  // lib/use-modifier-held.ts
29645
29889
  init_react_import();
29646
- var import_react5 = require("react");
29890
+ var import_react6 = require("react");
29647
29891
  var useModifierHeld = (modifier) => {
29648
- const [modifierHeld, setModifierHeld] = (0, import_react5.useState)(false);
29649
- (0, import_react5.useEffect)(() => {
29892
+ const [modifierHeld, setModifierHeld] = (0, import_react6.useState)(false);
29893
+ (0, import_react6.useEffect)(() => {
29650
29894
  function downHandler({ key }) {
29651
29895
  if (key === modifier) {
29652
29896
  setModifierHeld(true);
@@ -29669,8 +29913,12 @@ var useModifierHeld = (modifier) => {
29669
29913
 
29670
29914
  // components/DraggableComponent/index.tsx
29671
29915
  var import_react_spinners2 = require("react-spinners");
29672
- var import_jsx_runtime5 = require("react/jsx-runtime");
29673
- var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_module_default3);
29916
+ var import_jsx_runtime7 = require("react/jsx-runtime");
29917
+ var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_default3);
29918
+ var space = 8;
29919
+ var actionsOverlayTop = space * 6.5;
29920
+ var actionsTop = -(actionsOverlayTop - 8);
29921
+ var actionsRight = space;
29674
29922
  var DraggableComponent = ({
29675
29923
  children,
29676
29924
  id,
@@ -29693,91 +29941,87 @@ var DraggableComponent = ({
29693
29941
  indicativeHover = false,
29694
29942
  style
29695
29943
  }) => {
29944
+ const { zoomConfig } = useAppContext();
29696
29945
  const isModifierHeld = useModifierHeld("Alt");
29697
- (0, import_react6.useEffect)(onMount, []);
29698
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
29699
- import_dnd3.Draggable,
29700
- {
29701
- draggableId: id,
29702
- index,
29703
- isDragDisabled,
29704
- children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
29705
- "div",
29706
- __spreadProps(__spreadValues(__spreadValues({
29707
- ref: provided.innerRef
29708
- }, provided.draggableProps), provided.dragHandleProps), {
29709
- className: getClassName4({
29710
- isSelected,
29711
- isModifierHeld,
29712
- isDragging: snapshot.isDragging,
29713
- isLocked,
29714
- forceHover,
29715
- indicativeHover
29716
- }),
29717
- style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
29718
- cursor: isModifierHeld ? "initial" : "grab"
29719
- }),
29720
- onMouseOver,
29721
- onMouseOut,
29722
- onMouseDown,
29723
- onMouseUp,
29724
- onClick,
29725
- children: [
29726
- 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 })
29734
- ]
29735
- })
29736
- )
29737
- },
29738
- id
29739
- );
29740
- };
29741
-
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;
29946
+ const { status } = useAppContext();
29947
+ const El = status !== "LOADING" ? import_dnd3.Draggable : DefaultDraggable;
29948
+ (0, import_react7.useEffect)(onMount, []);
29949
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29950
+ "div",
29951
+ __spreadProps(__spreadValues(__spreadValues({
29952
+ ref: provided.innerRef
29953
+ }, provided.draggableProps), provided.dragHandleProps), {
29954
+ className: getClassName4({
29955
+ isSelected,
29956
+ isModifierHeld,
29957
+ isDragging: snapshot.isDragging,
29958
+ isLocked,
29959
+ forceHover,
29960
+ indicativeHover
29961
+ }),
29962
+ style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
29963
+ cursor: isModifierHeld ? "initial" : "grab"
29964
+ }),
29965
+ onMouseOver,
29966
+ onMouseOut,
29967
+ onMouseDown,
29968
+ onMouseUp,
29969
+ onClick,
29970
+ children: [
29971
+ debug,
29972
+ 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" }) }),
29973
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29974
+ "div",
29975
+ {
29976
+ className: getClassName4("actionsOverlay"),
29977
+ style: {
29978
+ top: actionsOverlayTop / zoomConfig.zoom
29979
+ },
29980
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29981
+ "div",
29982
+ {
29983
+ className: getClassName4("actions"),
29984
+ style: {
29985
+ transform: `scale(${1 / zoomConfig.zoom}`,
29986
+ top: actionsTop / zoomConfig.zoom,
29987
+ right: actionsRight / zoomConfig.zoom
29988
+ },
29989
+ children: [
29990
+ label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29991
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 }) }),
29992
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 }) })
29993
+ ]
29994
+ }
29995
+ )
29996
+ }
29997
+ ),
29998
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("overlay") }),
29999
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("contents"), children })
30000
+ ]
30001
+ })
30002
+ ) }, id);
29762
30003
  };
29763
30004
 
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 });
30005
+ // components/DropZone/styles.module.css
30006
+ var styles_default4 = {
30007
+ DropZone: "styles_DropZone",
30008
+ "DropZone-content": "styles_DropZone-content",
30009
+ "DropZone--userIsDragging": "styles_DropZone--userIsDragging",
30010
+ "DropZone--draggingOverArea": "styles_DropZone--draggingOverArea",
30011
+ "DropZone--draggingNewComponent": "styles_DropZone--draggingNewComponent",
30012
+ "DropZone--isAreaSelected": "styles_DropZone--isAreaSelected",
30013
+ "DropZone--hoveringOverArea": "styles_DropZone--hoveringOverArea",
30014
+ "DropZone--isDisabled": "styles_DropZone--isDisabled",
30015
+ "DropZone--isRootZone": "styles_DropZone--isRootZone",
30016
+ "DropZone--hasChildren": "styles_DropZone--hasChildren",
30017
+ "DropZone--isDestination": "styles_DropZone--isDestination",
30018
+ "DropZone-item": "styles_DropZone-item",
30019
+ "DropZone-hitbox": "styles_DropZone-hitbox"
29772
30020
  };
29773
30021
 
29774
- // css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
29775
- init_react_import();
29776
- var styles_module_default4 = { "DropZone": "_DropZone_i675d_1", "DropZone--zoomEnabled": "_DropZone--zoomEnabled_i675d_10", "DropZone-renderWrapper": "_DropZone-renderWrapper_i675d_14", "DropZone-content": "_DropZone-content_i675d_18", "DropZone--userIsDragging": "_DropZone--userIsDragging_i675d_23", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_i675d_27", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_i675d_28", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_i675d_34", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_i675d_35", "DropZone--isDisabled": "_DropZone--isDisabled_i675d_36", "DropZone--isRootZone": "_DropZone--isRootZone_i675d_37", "DropZone--hasChildren": "_DropZone--hasChildren_i675d_43", "DropZone--isDestination": "_DropZone--isDestination_i675d_48", "DropZone-item": "_DropZone-item_i675d_56", "DropZone-hitbox": "_DropZone-hitbox_i675d_60" };
29777
-
29778
30022
  // components/DropZone/context.tsx
29779
30023
  init_react_import();
29780
- var import_react7 = require("react");
30024
+ var import_react8 = require("react");
29781
30025
  var import_use_debounce = require("use-debounce");
29782
30026
 
29783
30027
  // lib/get-zone-id.ts
@@ -29793,30 +30037,30 @@ var getZoneId = (zoneCompound) => {
29793
30037
  };
29794
30038
 
29795
30039
  // components/DropZone/context.tsx
29796
- var import_jsx_runtime6 = require("react/jsx-runtime");
29797
- var dropZoneContext = (0, import_react7.createContext)(null);
30040
+ var import_jsx_runtime8 = require("react/jsx-runtime");
30041
+ var dropZoneContext = (0, import_react8.createContext)(null);
29798
30042
  var DropZoneProvider = ({
29799
30043
  children,
29800
30044
  value
29801
30045
  }) => {
29802
- const [hoveringArea, setHoveringArea] = (0, import_react7.useState)(null);
29803
- const [hoveringZone, setHoveringZone] = (0, import_react7.useState)(
30046
+ const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
30047
+ const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
29804
30048
  rootDroppableId
29805
30049
  );
29806
- const [hoveringComponent, setHoveringComponent] = (0, import_react7.useState)();
30050
+ const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
29807
30051
  const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
29808
- const [areasWithZones, setAreasWithZones] = (0, import_react7.useState)(
30052
+ const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
29809
30053
  {}
29810
30054
  );
29811
- const [activeZones, setActiveZones] = (0, import_react7.useState)({});
30055
+ const [activeZones, setActiveZones] = (0, import_react8.useState)({});
29812
30056
  const { dispatch = null } = value ? value : {};
29813
- const registerZoneArea = (0, import_react7.useCallback)(
30057
+ const registerZoneArea = (0, import_react8.useCallback)(
29814
30058
  (area) => {
29815
30059
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
29816
30060
  },
29817
30061
  [setAreasWithZones]
29818
30062
  );
29819
- const registerZone = (0, import_react7.useCallback)(
30063
+ const registerZone = (0, import_react8.useCallback)(
29820
30064
  (zoneCompound) => {
29821
30065
  if (!dispatch) {
29822
30066
  return;
@@ -29829,7 +30073,7 @@ var DropZoneProvider = ({
29829
30073
  },
29830
30074
  [setActiveZones, dispatch]
29831
30075
  );
29832
- const unregisterZone = (0, import_react7.useCallback)(
30076
+ const unregisterZone = (0, import_react8.useCallback)(
29833
30077
  (zoneCompound) => {
29834
30078
  if (!dispatch) {
29835
30079
  return;
@@ -29844,8 +30088,8 @@ var DropZoneProvider = ({
29844
30088
  },
29845
30089
  [setActiveZones, dispatch]
29846
30090
  );
29847
- const [pathData, setPathData] = (0, import_react7.useState)();
29848
- const registerPath = (0, import_react7.useCallback)(
30091
+ const [pathData, setPathData] = (0, import_react8.useState)();
30092
+ const registerPath = (0, import_react8.useCallback)(
29849
30093
  (selector) => {
29850
30094
  if (!(value == null ? void 0 : value.data)) {
29851
30095
  return;
@@ -29870,7 +30114,8 @@ var DropZoneProvider = ({
29870
30114
  },
29871
30115
  [value, setPathData]
29872
30116
  );
29873
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
30117
+ const [zoneWillDrag, setZoneWillDrag] = (0, import_react8.useState)("");
30118
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
29874
30119
  dropZoneContext.Provider,
29875
30120
  {
29876
30121
  value: __spreadValues({
@@ -29886,58 +30131,18 @@ var DropZoneProvider = ({
29886
30131
  unregisterZone,
29887
30132
  activeZones,
29888
30133
  registerPath,
29889
- pathData
30134
+ pathData,
30135
+ zoneWillDrag,
30136
+ setZoneWillDrag
29890
30137
  }, value),
29891
30138
  children
29892
30139
  }
29893
30140
  ) });
29894
30141
  };
29895
30142
 
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
30143
  // components/DropZone/index.tsx
29939
- var import_jsx_runtime7 = require("react/jsx-runtime");
29940
- var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
30144
+ var import_jsx_runtime9 = require("react/jsx-runtime");
30145
+ var getClassName5 = get_class_name_factory_default("DropZone", styles_default4);
29941
30146
  function DropZoneEdit({ zone, allow, disallow, style }) {
29942
30147
  var _a;
29943
30148
  const appContext2 = useAppContext();
@@ -29955,7 +30160,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29955
30160
  registerZoneArea,
29956
30161
  areasWithZones,
29957
30162
  hoveringComponent,
29958
- disableZoom = false
30163
+ zoneWillDrag,
30164
+ setZoneWillDrag = () => null
29959
30165
  } = ctx || {};
29960
30166
  let content = data.content || [];
29961
30167
  let zoneCompound = rootDroppableId;
@@ -29985,12 +30191,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29985
30191
  const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
29986
30192
  const [zoneArea] = getZoneId(zoneCompound);
29987
30193
  const [draggedSourceArea] = getZoneId(draggedSourceId);
29988
- const [userWillDrag, setUserWillDrag] = (0, import_react9.useState)(false);
30194
+ const userWillDrag = zoneWillDrag === zone;
29989
30195
  const userIsDragging = !!draggedItem;
29990
30196
  const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
29991
30197
  const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
29992
30198
  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." });
30199
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "DropZone requires context to work." });
29994
30200
  }
29995
30201
  const {
29996
30202
  hoveringArea = "root",
@@ -30027,7 +30233,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30027
30233
  }
30028
30234
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
30029
30235
  const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
30030
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30236
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30031
30237
  "div",
30032
30238
  {
30033
30239
  className: getClassName5({
@@ -30039,17 +30245,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30039
30245
  isDestination: draggedDestinationId === zoneCompound,
30040
30246
  isDisabled: !isEnabled,
30041
30247
  isAreaSelected,
30042
- hasChildren: content.length > 0,
30043
- zoomEnabled: !disableZoom
30248
+ hasChildren: content.length > 0
30044
30249
  }),
30045
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30046
- import_dnd4.Droppable,
30250
+ onMouseUp: () => {
30251
+ setZoneWillDrag("");
30252
+ },
30253
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30254
+ Droppable,
30047
30255
  {
30048
30256
  droppableId: zoneCompound,
30049
30257
  direction: "vertical",
30050
30258
  isDropDisabled: !isEnabled,
30051
30259
  children: (provided, snapshot) => {
30052
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30260
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30053
30261
  "div",
30054
30262
  __spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
30055
30263
  className: getClassName5("content"),
@@ -30063,7 +30271,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30063
30271
  },
30064
30272
  children: [
30065
30273
  content.map((item, i) => {
30066
- var _a2, _b;
30274
+ var _a2, _b, _c;
30067
30275
  const componentId = item.props.id;
30068
30276
  const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
30069
30277
  puck: { renderDropZone: DropZone },
@@ -30074,33 +30282,33 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30074
30282
  "draggable-"
30075
30283
  )[1] === componentId;
30076
30284
  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: [
30285
+ 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
30286
  "No configuration for ",
30079
30287
  item.type
30080
30288
  ] });
30081
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30289
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30082
30290
  "div",
30083
30291
  {
30084
30292
  className: getClassName5("item"),
30085
30293
  style: { zIndex: isDragging ? 1 : void 0 },
30086
30294
  children: [
30087
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30295
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30088
30296
  DropZoneProvider,
30089
30297
  {
30090
30298
  value: __spreadProps(__spreadValues({}, ctx), {
30091
30299
  areaId: componentId
30092
30300
  }),
30093
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30301
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30094
30302
  DraggableComponent,
30095
30303
  {
30096
- label: item.type.toString(),
30304
+ label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
30097
30305
  id: `draggable-${componentId}`,
30098
30306
  index: i,
30099
30307
  isSelected,
30100
30308
  isLocked: userIsDragging,
30101
30309
  forceHover: hoveringComponent === componentId && !userIsDragging,
30102
30310
  indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
30103
- isLoading: (_b = appContext2.componentState[componentId]) == null ? void 0 : _b.loading,
30311
+ isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
30104
30312
  onMount: () => {
30105
30313
  ctx.registerPath({
30106
30314
  index: i,
@@ -30116,11 +30324,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30116
30324
  },
30117
30325
  onMouseDown: (e) => {
30118
30326
  e.stopPropagation();
30119
- setUserWillDrag(true);
30120
- },
30121
- onMouseUp: (e) => {
30122
- e.stopPropagation();
30123
- setUserWillDrag(false);
30327
+ setZoneWillDrag(zone);
30124
30328
  },
30125
30329
  onMouseOver: (e) => {
30126
30330
  e.stopPropagation();
@@ -30161,12 +30365,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30161
30365
  style: {
30162
30366
  pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
30163
30367
  },
30164
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30368
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30165
30369
  }
30166
30370
  )
30167
30371
  }
30168
30372
  ),
30169
- userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30373
+ userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30170
30374
  "div",
30171
30375
  {
30172
30376
  className: getClassName5("hitbox"),
@@ -30183,12 +30387,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30183
30387
  );
30184
30388
  }),
30185
30389
  provided == null ? void 0 : provided.placeholder,
30186
- (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30390
+ (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30187
30391
  "div",
30188
30392
  {
30189
30393
  "data-puck-placeholder": true,
30190
30394
  style: __spreadProps(__spreadValues({}, placeholderStyle), {
30191
- background: "var(--puck-color-azure-5)",
30395
+ background: "var(--puck-color-azure-06)",
30192
30396
  opacity: 0.3,
30193
30397
  zIndex: 0
30194
30398
  })
@@ -30215,14 +30419,14 @@ function DropZoneRender({ zone }) {
30215
30419
  zoneCompound = `${areaId}:${zone}`;
30216
30420
  content = setupZone(data, zoneCompound).zones[zoneCompound];
30217
30421
  }
30218
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: content.map((item) => {
30422
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content.map((item) => {
30219
30423
  const Component = config.components[item.type];
30220
30424
  if (Component) {
30221
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30425
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30222
30426
  DropZoneProvider,
30223
30427
  {
30224
30428
  value: { data, config, areaId: item.props.id },
30225
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30429
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30226
30430
  Component.render,
30227
30431
  __spreadProps(__spreadValues({}, item.props), {
30228
30432
  puck: { renderDropZone: DropZone }
@@ -30238,9 +30442,9 @@ function DropZoneRender({ zone }) {
30238
30442
  function DropZone(props) {
30239
30443
  const ctx = (0, import_react9.useContext)(dropZoneContext);
30240
30444
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
30241
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneEdit, __spreadValues({}, props));
30445
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneEdit, __spreadValues({}, props));
30242
30446
  }
30243
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneRender, __spreadValues({}, props));
30447
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
30244
30448
  }
30245
30449
 
30246
30450
  // components/IconButton/index.ts
@@ -30250,14 +30454,17 @@ init_react_import();
30250
30454
  init_react_import();
30251
30455
  var import_react10 = require("react");
30252
30456
 
30253
- // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
30254
- init_react_import();
30255
- var IconButton_module_default = { "IconButton": "_IconButton_38xdr_1", "IconButton-title": "_IconButton-title_38xdr_18" };
30457
+ // components/IconButton/IconButton.module.css
30458
+ var IconButton_default = {
30459
+ IconButton: "IconButton_IconButton",
30460
+ "IconButton--disabled": "IconButton_IconButton--disabled",
30461
+ "IconButton-title": "IconButton_IconButton-title"
30462
+ };
30256
30463
 
30257
30464
  // components/IconButton/IconButton.tsx
30258
30465
  var import_react_spinners3 = require("react-spinners");
30259
- var import_jsx_runtime8 = require("react/jsx-runtime");
30260
- var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
30466
+ var import_jsx_runtime10 = require("react/jsx-runtime");
30467
+ var getClassName6 = get_class_name_factory_default("IconButton", IconButton_default);
30261
30468
  var IconButton = ({
30262
30469
  children,
30263
30470
  href,
@@ -30272,7 +30479,7 @@ var IconButton = ({
30272
30479
  }) => {
30273
30480
  const [loading, setLoading] = (0, import_react10.useState)(false);
30274
30481
  const ElementType = href ? "a" : "button";
30275
- const el = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30482
+ const el = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30276
30483
  ElementType,
30277
30484
  {
30278
30485
  className: getClassName6({
@@ -30297,11 +30504,11 @@ var IconButton = ({
30297
30504
  href,
30298
30505
  title,
30299
30506
  children: [
30300
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: getClassName6("title"), children: title }),
30507
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName6("title"), children: title }),
30301
30508
  children,
30302
- loading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
30509
+ loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
30303
30510
  "\xA0\xA0",
30304
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30511
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30305
30512
  ] })
30306
30513
  ]
30307
30514
  }
@@ -30311,12 +30518,23 @@ var IconButton = ({
30311
30518
 
30312
30519
  // components/Puck/index.tsx
30313
30520
  init_react_import();
30314
- var import_react26 = require("react");
30315
- var import_dnd7 = require("@hello-pangea/dnd");
30521
+ var import_react28 = require("react");
30316
30522
 
30317
30523
  // lib/use-placeholder-style.ts
30318
30524
  init_react_import();
30319
30525
  var import_react11 = require("react");
30526
+
30527
+ // lib/get-frame.ts
30528
+ init_react_import();
30529
+ var getFrame = () => {
30530
+ let frame = document.querySelector("#preview-frame");
30531
+ if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
30532
+ frame = frame.contentDocument;
30533
+ }
30534
+ return frame;
30535
+ };
30536
+
30537
+ // lib/use-placeholder-style.ts
30320
30538
  var usePlaceholderStyle = () => {
30321
30539
  const queryAttr = "data-rfd-drag-handle-draggable-id";
30322
30540
  const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
@@ -30326,11 +30544,12 @@ var usePlaceholderStyle = () => {
30326
30544
  const destinationIndex = (draggedItem.destination || draggedItem.source).index;
30327
30545
  const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
30328
30546
  const domQuery = `[${queryAttr}='${draggableId}']`;
30329
- const draggedDOM = document.querySelector(domQuery);
30547
+ const frame = getFrame();
30548
+ const draggedDOM = document.querySelector(domQuery) || (frame == null ? void 0 : frame.querySelector(domQuery));
30330
30549
  if (!draggedDOM) {
30331
30550
  return;
30332
30551
  }
30333
- const targetListElement = document.querySelector(
30552
+ const targetListElement = frame == null ? void 0 : frame.querySelector(
30334
30553
  `[data-rfd-droppable-id='${droppableId}']`
30335
30554
  );
30336
30555
  const { clientHeight } = draggedDOM;
@@ -30365,23 +30584,42 @@ var usePlaceholderStyle = () => {
30365
30584
  // components/SidebarSection/index.tsx
30366
30585
  init_react_import();
30367
30586
 
30368
- // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
30369
- init_react_import();
30370
- var styles_module_default5 = { "SidebarSection": "_SidebarSection_170gs_1", "SidebarSection-title": "_SidebarSection-title_170gs_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_170gs_20", "SidebarSection-content": "_SidebarSection-content_170gs_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_170gs_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_170gs_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_170gs_52", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_170gs_41", "SidebarSection-heading": "_SidebarSection-heading_170gs_64", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_170gs_68" };
30587
+ // components/SidebarSection/styles.module.css
30588
+ var styles_default5 = {
30589
+ SidebarSection: "styles_SidebarSection",
30590
+ "SidebarSection-title": "styles_SidebarSection-title",
30591
+ "SidebarSection--noBorderTop": "styles_SidebarSection--noBorderTop",
30592
+ "SidebarSection-content": "styles_SidebarSection-content",
30593
+ "SidebarSection--noPadding": "styles_SidebarSection--noPadding",
30594
+ "SidebarSection-breadcrumbLabel": "styles_SidebarSection-breadcrumbLabel",
30595
+ "SidebarSection-breadcrumbs": "styles_SidebarSection-breadcrumbs",
30596
+ "SidebarSection-breadcrumb": "styles_SidebarSection-breadcrumb",
30597
+ "SidebarSection-heading": "styles_SidebarSection-heading",
30598
+ "SidebarSection-loadingOverlay": "styles_SidebarSection-loadingOverlay"
30599
+ };
30371
30600
 
30372
30601
  // components/Heading/index.tsx
30373
30602
  init_react_import();
30374
30603
 
30375
- // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
30376
- init_react_import();
30377
- var styles_module_default6 = { "Heading": "_Heading_1bvy5_1", "Heading--xxxxl": "_Heading--xxxxl_1bvy5_13", "Heading--xxxl": "_Heading--xxxl_1bvy5_19", "Heading--xxl": "_Heading--xxl_1bvy5_23", "Heading--xl": "_Heading--xl_1bvy5_27", "Heading--l": "_Heading--l_1bvy5_31", "Heading--m": "_Heading--m_1bvy5_35", "Heading--s": "_Heading--s_1bvy5_39", "Heading--xs": "_Heading--xs_1bvy5_43" };
30604
+ // components/Heading/styles.module.css
30605
+ var styles_default6 = {
30606
+ Heading: "styles_Heading",
30607
+ "Heading--xxxxl": "styles_Heading--xxxxl",
30608
+ "Heading--xxxl": "styles_Heading--xxxl",
30609
+ "Heading--xxl": "styles_Heading--xxl",
30610
+ "Heading--xl": "styles_Heading--xl",
30611
+ "Heading--l": "styles_Heading--l",
30612
+ "Heading--m": "styles_Heading--m",
30613
+ "Heading--s": "styles_Heading--s",
30614
+ "Heading--xs": "styles_Heading--xs"
30615
+ };
30378
30616
 
30379
30617
  // components/Heading/index.tsx
30380
- var import_jsx_runtime9 = require("react/jsx-runtime");
30381
- var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
30618
+ var import_jsx_runtime11 = require("react/jsx-runtime");
30619
+ var getClassName7 = get_class_name_factory_default("Heading", styles_default6);
30382
30620
  var Heading = ({ children, rank, size = "m" }) => {
30383
30621
  const Tag = rank ? `h${rank}` : "span";
30384
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30622
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
30385
30623
  Tag,
30386
30624
  {
30387
30625
  className: getClassName7({
@@ -30460,8 +30698,8 @@ var useBreadcrumbs = (renderCount) => {
30460
30698
 
30461
30699
  // components/SidebarSection/index.tsx
30462
30700
  var import_react_spinners4 = require("react-spinners");
30463
- var import_jsx_runtime10 = require("react/jsx-runtime");
30464
- var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
30701
+ var import_jsx_runtime12 = require("react/jsx-runtime");
30702
+ var getClassName8 = get_class_name_factory_default("SidebarSection", styles_default5);
30465
30703
  var SidebarSection = ({
30466
30704
  children,
30467
30705
  title,
@@ -30473,28 +30711,28 @@ var SidebarSection = ({
30473
30711
  }) => {
30474
30712
  const { setUi } = useAppContext();
30475
30713
  const breadcrumbs = useBreadcrumbs(1);
30476
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30714
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
30477
30715
  "div",
30478
30716
  {
30479
30717
  className: getClassName8({ noBorderTop, noPadding }),
30480
30718
  style: { background },
30481
30719
  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)(
30485
- "div",
30720
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30721
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30722
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
30723
+ "button",
30486
30724
  {
30487
30725
  className: getClassName8("breadcrumbLabel"),
30488
30726
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
30489
30727
  children: breadcrumb.label
30490
30728
  }
30491
30729
  ),
30492
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChevronRight, { size: 16 })
30730
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRight, { size: 16 })
30493
30731
  ] }, 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 }) })
30732
+ /* @__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
30733
  ] }) }),
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" }) })
30734
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("content"), children }),
30735
+ 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
30736
  ]
30499
30737
  }
30500
30738
  );
@@ -31000,7 +31238,10 @@ var useResolvedData = (appState, config, dispatch) => {
31000
31238
  );
31001
31239
  const runResolvers = () => __async(void 0, null, function* () {
31002
31240
  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);
31241
+ const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
31242
+ var _a;
31243
+ return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
31244
+ });
31004
31245
  const applyIfChange = (dynamicDataMap, dynamicRoot) => {
31005
31246
  const processed = applyDynamicProps(
31006
31247
  appState.data,
@@ -31068,13 +31309,17 @@ var useResolvedData = (appState, config, dispatch) => {
31068
31309
  // components/MenuBar/index.tsx
31069
31310
  init_react_import();
31070
31311
 
31071
- // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
31072
- init_react_import();
31073
- var styles_module_default7 = { "MenuBar": "_MenuBar_12sp7_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_12sp7_14", "MenuBar-inner": "_MenuBar-inner_12sp7_29", "MenuBar-history": "_MenuBar-history_12sp7_45" };
31312
+ // components/MenuBar/styles.module.css
31313
+ var styles_default7 = {
31314
+ MenuBar: "styles_MenuBar",
31315
+ "MenuBar--menuOpen": "styles_MenuBar--menuOpen",
31316
+ "MenuBar-inner": "styles_MenuBar-inner",
31317
+ "MenuBar-history": "styles_MenuBar-history"
31318
+ };
31074
31319
 
31075
31320
  // components/MenuBar/index.tsx
31076
- var import_jsx_runtime11 = require("react/jsx-runtime");
31077
- var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
31321
+ var import_jsx_runtime13 = require("react/jsx-runtime");
31322
+ var getClassName9 = get_class_name_factory_default("MenuBar", styles_default7);
31078
31323
  var MenuBar = ({
31079
31324
  appState,
31080
31325
  data = { content: [], root: { props: { title: "" } } },
@@ -31088,7 +31333,7 @@ var MenuBar = ({
31088
31333
  history: { back, forward, historyStore }
31089
31334
  } = useAppContext();
31090
31335
  const { hasFuture = false, hasPast = false } = historyStore || {};
31091
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31336
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31092
31337
  "div",
31093
31338
  {
31094
31339
  className: getClassName9({ menuOpen }),
@@ -31102,34 +31347,34 @@ var MenuBar = ({
31102
31347
  setMenuOpen(false);
31103
31348
  }
31104
31349
  },
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)(
31350
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("inner"), children: [
31351
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("history"), children: [
31352
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31108
31353
  ChevronLeft,
31109
31354
  {
31110
31355
  size: 21,
31111
- stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
31356
+ stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
31112
31357
  }
31113
31358
  ) }),
31114
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31359
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31115
31360
  ChevronRight,
31116
31361
  {
31117
31362
  size: 21,
31118
- stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
31363
+ stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
31119
31364
  }
31120
31365
  ) })
31121
31366
  ] }),
31122
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: renderHeaderActions && renderHeaderActions({
31367
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
31123
31368
  state: appState,
31124
31369
  dispatch
31125
31370
  }) }),
31126
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31371
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31127
31372
  Button,
31128
31373
  {
31129
31374
  onClick: () => {
31130
31375
  onPublish && onPublish(data);
31131
31376
  },
31132
- icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Globe, { size: "14px" }),
31377
+ icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
31133
31378
  children: "Publish"
31134
31379
  }
31135
31380
  ) })
@@ -31138,9 +31383,24 @@ var MenuBar = ({
31138
31383
  );
31139
31384
  };
31140
31385
 
31141
- // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
31142
- init_react_import();
31143
- var styles_module_default8 = { "Puck": "_Puck_17hk3_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_17hk3_35", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_17hk3_41", "Puck-header": "_Puck-header_17hk3_95", "Puck-headerInner": "_Puck-headerInner_17hk3_104", "Puck-headerToggle": "_Puck-headerToggle_17hk3_114", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_17hk3_121", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_17hk3_122", "Puck-headerTitle": "_Puck-headerTitle_17hk3_126", "Puck-headerPath": "_Puck-headerPath_17hk3_130", "Puck-headerTools": "_Puck-headerTools_17hk3_137", "Puck-menuButton": "_Puck-menuButton_17hk3_143", "Puck--menuOpen": "_Puck--menuOpen_17hk3_148", "Puck-leftSideBar": "_Puck-leftSideBar_17hk3_122", "Puck-frame": "_Puck-frame_17hk3_167", "Puck-root": "_Puck-root_17hk3_175", "Puck-rightSideBar": "_Puck-rightSideBar_17hk3_121" };
31386
+ // components/Puck/styles.module.css
31387
+ var styles_default8 = {
31388
+ Puck: "styles_Puck",
31389
+ "Puck--leftSideBarVisible": "styles_Puck--leftSideBarVisible",
31390
+ "Puck--rightSideBarVisible": "styles_Puck--rightSideBarVisible",
31391
+ "Puck-header": "styles_Puck-header",
31392
+ "Puck-headerInner": "styles_Puck-headerInner",
31393
+ "Puck-headerToggle": "styles_Puck-headerToggle",
31394
+ "Puck-rightSideBarToggle": "styles_Puck-rightSideBarToggle",
31395
+ "Puck-leftSideBarToggle": "styles_Puck-leftSideBarToggle",
31396
+ "Puck-headerTitle": "styles_Puck-headerTitle",
31397
+ "Puck-headerPath": "styles_Puck-headerPath",
31398
+ "Puck-headerTools": "styles_Puck-headerTools",
31399
+ "Puck-menuButton": "styles_Puck-menuButton",
31400
+ "Puck--menuOpen": "styles_Puck--menuOpen",
31401
+ "Puck-leftSideBar": "styles_Puck-leftSideBar",
31402
+ "Puck-rightSideBar": "styles_Puck-rightSideBar"
31403
+ };
31144
31404
 
31145
31405
  // components/Puck/components/Fields/index.tsx
31146
31406
  init_react_import();
@@ -31149,9 +31409,19 @@ var import_react_spinners6 = require("react-spinners");
31149
31409
  // components/InputOrGroup/index.tsx
31150
31410
  init_react_import();
31151
31411
 
31152
- // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
31153
- init_react_import();
31154
- var styles_module_default9 = { "Input": "_Input_1v7zr_1", "Input-label": "_Input-label_1v7zr_27", "Input-labelIcon": "_Input-labelIcon_1v7zr_35", "Input-disabledIcon": "_Input-disabledIcon_1v7zr_41", "Input-input": "_Input-input_1v7zr_46", "Input--readOnly": "_Input--readOnly_1v7zr_69", "Input-radioGroupItems": "_Input-radioGroupItems_1v7zr_87", "Input-radio": "_Input-radio_1v7zr_87", "Input-radioInner": "_Input-radioInner_1v7zr_104", "Input-radioInput": "_Input-radioInput_1v7zr_126" };
31412
+ // components/InputOrGroup/styles.module.css
31413
+ var styles_default9 = {
31414
+ Input: "styles_Input",
31415
+ "Input-label": "styles_Input-label",
31416
+ "Input-labelIcon": "styles_Input-labelIcon",
31417
+ "Input-disabledIcon": "styles_Input-disabledIcon",
31418
+ "Input-input": "styles_Input-input",
31419
+ "Input--readOnly": "styles_Input--readOnly",
31420
+ "Input-radioGroupItems": "styles_Input-radioGroupItems",
31421
+ "Input-radio": "styles_Input-radio",
31422
+ "Input-radioInner": "styles_Input-radioInner",
31423
+ "Input-radioInput": "styles_Input-radioInput"
31424
+ };
31155
31425
 
31156
31426
  // components/InputOrGroup/index.tsx
31157
31427
  var import_react18 = require("react");
@@ -31162,17 +31432,41 @@ init_react_import();
31162
31432
  // components/InputOrGroup/fields/ArrayField/index.tsx
31163
31433
  init_react_import();
31164
31434
 
31165
- // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
31166
- init_react_import();
31167
- var styles_module_default10 = { "ArrayField": "_ArrayField_1auyc_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1auyc_13", "ArrayField-addButton": "_ArrayField-addButton_1auyc_17", "ArrayField--hasItems": "_ArrayField--hasItems_1auyc_31", "ArrayFieldItem": "_ArrayFieldItem_1auyc_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1auyc_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1auyc_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1auyc_73", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_1auyc_86", "ArrayFieldItem-body": "_ArrayFieldItem-body_1auyc_107", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1auyc_115", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1auyc_122", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1auyc_128", "ArrayFieldItem-action": "_ArrayFieldItem-action_1auyc_128" };
31435
+ // components/InputOrGroup/fields/ArrayField/styles.module.css
31436
+ var styles_default10 = {
31437
+ ArrayField: "styles_ArrayField",
31438
+ "ArrayField--isDraggingFrom": "styles_ArrayField--isDraggingFrom",
31439
+ "ArrayField-addButton": "styles_ArrayField-addButton",
31440
+ "ArrayField--hasItems": "styles_ArrayField--hasItems",
31441
+ ArrayFieldItem: "styles_ArrayFieldItem",
31442
+ "ArrayFieldItem--isDragging": "styles_ArrayFieldItem--isDragging",
31443
+ "ArrayFieldItem--isExpanded": "styles_ArrayFieldItem--isExpanded",
31444
+ "ArrayFieldItem-summary": "styles_ArrayFieldItem-summary",
31445
+ "ArrayField--addDisabled": "styles_ArrayField--addDisabled",
31446
+ "ArrayFieldItem-body": "styles_ArrayFieldItem-body",
31447
+ "ArrayFieldItem-fieldset": "styles_ArrayFieldItem-fieldset",
31448
+ "ArrayFieldItem-rhs": "styles_ArrayFieldItem-rhs",
31449
+ "ArrayFieldItem-actions": "styles_ArrayFieldItem-actions"
31450
+ };
31168
31451
 
31169
31452
  // components/InputOrGroup/fields/ArrayField/index.tsx
31170
- var import_dnd5 = require("@hello-pangea/dnd");
31171
- var import_dnd6 = require("@hello-pangea/dnd");
31172
31453
  var import_react14 = require("react");
31173
- var import_jsx_runtime12 = require("react/jsx-runtime");
31174
- var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
31175
- var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
31454
+
31455
+ // components/DragDropContext/index.tsx
31456
+ init_react_import();
31457
+ var import_dnd4 = require("@measured/dnd");
31458
+ var import_jsx_runtime14 = require("react/jsx-runtime");
31459
+ var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
31460
+ var DragDropContext = (props) => {
31461
+ const { status } = useAppContext();
31462
+ const El = status !== "LOADING" ? import_dnd4.DragDropContext : DefaultDragDropContext;
31463
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(El, __spreadValues({}, props));
31464
+ };
31465
+
31466
+ // components/InputOrGroup/fields/ArrayField/index.tsx
31467
+ var import_jsx_runtime15 = require("react/jsx-runtime");
31468
+ var getClassName10 = get_class_name_factory_default("ArrayField", styles_default10);
31469
+ var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_default10);
31176
31470
  var ArrayField = ({
31177
31471
  field,
31178
31472
  onChange,
@@ -31234,21 +31528,24 @@ var ArrayField = ({
31234
31528
  [arrayState]
31235
31529
  );
31236
31530
  (0, import_react14.useEffect)(() => {
31237
- setUi(mapArrayStateToUi(arrayState));
31531
+ if (arrayState.items.length > 0) {
31532
+ setUi(mapArrayStateToUi(arrayState));
31533
+ }
31238
31534
  }, []);
31239
31535
  const [hovering, setHovering] = (0, import_react14.useState)(false);
31240
31536
  if (field.type !== "array" || !field.arrayFields) {
31241
31537
  return null;
31242
31538
  }
31243
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31539
+ const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
31540
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31244
31541
  FieldLabelInternal,
31245
31542
  {
31246
31543
  label: label || name,
31247
- icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(List, { size: 16 }),
31544
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { size: 16 }),
31248
31545
  el: "div",
31249
31546
  readOnly,
31250
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31251
- import_dnd6.DragDropContext,
31547
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31548
+ DragDropContext,
31252
31549
  {
31253
31550
  onDragEnd: (event) => {
31254
31551
  var _a, _b;
@@ -31274,14 +31571,15 @@ var ArrayField = ({
31274
31571
  });
31275
31572
  }
31276
31573
  },
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)(
31574
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31575
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31279
31576
  "div",
31280
31577
  __spreadProps(__spreadValues({}, provided.droppableProps), {
31281
31578
  ref: provided.innerRef,
31282
31579
  className: getClassName10({
31283
31580
  isDraggingFrom: !!snapshot.draggingFromThisWith,
31284
- hasItems: Array.isArray(value) && value.length > 0
31581
+ hasItems: Array.isArray(value) && value.length > 0,
31582
+ addDisabled
31285
31583
  }),
31286
31584
  onMouseOver: (e) => {
31287
31585
  e.stopPropagation();
@@ -31295,7 +31593,7 @@ var ArrayField = ({
31295
31593
  localState.arrayState.items.map((item, i) => {
31296
31594
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
31297
31595
  const data = Array.from(localState.value || [])[i] || {};
31298
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31596
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31299
31597
  Draggable,
31300
31598
  {
31301
31599
  id: _arrayId,
@@ -31306,8 +31604,8 @@ var ArrayField = ({
31306
31604
  readOnly
31307
31605
  }),
31308
31606
  isDragDisabled: readOnly || !hovering,
31309
- children: () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
31310
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31607
+ children: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31608
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31311
31609
  "div",
31312
31610
  {
31313
31611
  onClick: () => {
@@ -31328,10 +31626,12 @@ var ArrayField = ({
31328
31626
  className: getClassNameItem2("summary"),
31329
31627
  children: [
31330
31628
  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)(
31629
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31630
+ !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
31631
  IconButton,
31334
31632
  {
31633
+ type: "button",
31634
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
31335
31635
  onClick: (e) => {
31336
31636
  e.stopPropagation();
31337
31637
  const existingValue = [
@@ -31350,20 +31650,20 @@ var ArrayField = ({
31350
31650
  );
31351
31651
  },
31352
31652
  title: "Delete",
31353
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Trash, { size: 16 })
31653
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash, { size: 16 })
31354
31654
  }
31355
31655
  ) }) }),
31356
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DragIcon, {}) })
31656
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragIcon, {}) })
31357
31657
  ] })
31358
31658
  ]
31359
31659
  }
31360
31660
  ),
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(
31661
+ /* @__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
31662
  (fieldName) => {
31363
31663
  const subField = field.arrayFields[fieldName];
31364
31664
  const subFieldName = `${name}[${i}].${fieldName}`;
31365
31665
  const wildcardFieldName = `${name}[*].${fieldName}`;
31366
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31666
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31367
31667
  InputOrGroup,
31368
31668
  {
31369
31669
  name: subFieldName,
@@ -31392,9 +31692,10 @@ var ArrayField = ({
31392
31692
  );
31393
31693
  }),
31394
31694
  provided.placeholder,
31395
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31695
+ !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31396
31696
  "button",
31397
31697
  {
31698
+ type: "button",
31398
31699
  className: getClassName10("addButton"),
31399
31700
  onClick: () => {
31400
31701
  const existingValue = value || [];
@@ -31405,7 +31706,7 @@ var ArrayField = ({
31405
31706
  const newArrayState = regenerateArrayState(newValue);
31406
31707
  onChange(newValue, mapArrayStateToUi(newArrayState));
31407
31708
  },
31408
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: "21" })
31709
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Plus, { size: 21 })
31409
31710
  }
31410
31711
  )
31411
31712
  ]
@@ -31420,8 +31721,8 @@ var ArrayField = ({
31420
31721
 
31421
31722
  // components/InputOrGroup/fields/DefaultField/index.tsx
31422
31723
  init_react_import();
31423
- var import_jsx_runtime13 = require("react/jsx-runtime");
31424
- var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
31724
+ var import_jsx_runtime16 = require("react/jsx-runtime");
31725
+ var getClassName11 = get_class_name_factory_default("Input", styles_default9);
31425
31726
  var DefaultField = ({
31426
31727
  field,
31427
31728
  onChange,
@@ -31431,16 +31732,16 @@ var DefaultField = ({
31431
31732
  label,
31432
31733
  id
31433
31734
  }) => {
31434
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31735
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31435
31736
  FieldLabelInternal,
31436
31737
  {
31437
31738
  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 })
31739
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
31740
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
31741
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Hash, { size: 16 })
31441
31742
  ] }),
31442
31743
  readOnly,
31443
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31744
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31444
31745
  "input",
31445
31746
  {
31446
31747
  className: getClassName11("input"),
@@ -31456,7 +31757,10 @@ var DefaultField = ({
31456
31757
  }
31457
31758
  },
31458
31759
  readOnly,
31459
- id
31760
+ tabIndex: readOnly ? -1 : void 0,
31761
+ id,
31762
+ min: field.type === "number" ? field.min : void 0,
31763
+ max: field.type === "number" ? field.max : void 0
31460
31764
  }
31461
31765
  )
31462
31766
  }
@@ -31471,22 +31775,52 @@ var import_react17 = require("react");
31471
31775
  init_react_import();
31472
31776
  var import_react16 = require("react");
31473
31777
 
31474
- // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
31475
- init_react_import();
31476
- var styles_module_default11 = { "ExternalInput": "_ExternalInput_s6fxy_1", "ExternalInput-actions": "_ExternalInput-actions_s6fxy_5", "ExternalInput-button": "_ExternalInput-button_s6fxy_9", "ExternalInput-detachButton": "_ExternalInput-detachButton_s6fxy_28", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_s6fxy_35", "ExternalInputModal": "_ExternalInputModal_s6fxy_56", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_s6fxy_64", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_s6fxy_72", "ExternalInputModal-table": "_ExternalInputModal-table_s6fxy_72", "ExternalInputModal-thead": "_ExternalInputModal-thead_s6fxy_88", "ExternalInputModal-th": "_ExternalInputModal-th_s6fxy_88", "ExternalInputModal-td": "_ExternalInputModal-td_s6fxy_102", "ExternalInputModal-tr": "_ExternalInputModal-tr_s6fxy_107", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_s6fxy_119", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_s6fxy_138", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_s6fxy_142", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_s6fxy_155", "ExternalInputModal-noContentBanner": "_ExternalInputModal-noContentBanner_s6fxy_159", "ExternalInputModal--loaded": "_ExternalInputModal--loaded_s6fxy_166", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_s6fxy_171", "ExternalInputModal-search": "_ExternalInputModal-search_s6fxy_171", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_s6fxy_194", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_s6fxy_206", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_s6fxy_216" };
31778
+ // components/ExternalInput/styles.module.css
31779
+ var styles_default11 = {
31780
+ "ExternalInput-actions": "styles_ExternalInput-actions",
31781
+ "ExternalInput-button": "styles_ExternalInput-button",
31782
+ "ExternalInput--dataSelected": "styles_ExternalInput--dataSelected",
31783
+ "ExternalInput-detachButton": "styles_ExternalInput-detachButton",
31784
+ ExternalInputModal: "styles_ExternalInputModal",
31785
+ "ExternalInputModal-grid": "styles_ExternalInputModal-grid",
31786
+ "ExternalInputModal--filtersToggled": "styles_ExternalInputModal--filtersToggled",
31787
+ "ExternalInputModal-filters": "styles_ExternalInputModal-filters",
31788
+ "ExternalInputModal-masthead": "styles_ExternalInputModal-masthead",
31789
+ "ExternalInputModal-tableWrapper": "styles_ExternalInputModal-tableWrapper",
31790
+ "ExternalInputModal-table": "styles_ExternalInputModal-table",
31791
+ "ExternalInputModal-thead": "styles_ExternalInputModal-thead",
31792
+ "ExternalInputModal-th": "styles_ExternalInputModal-th",
31793
+ "ExternalInputModal-td": "styles_ExternalInputModal-td",
31794
+ "ExternalInputModal-tr": "styles_ExternalInputModal-tr",
31795
+ "ExternalInputModal-tbody": "styles_ExternalInputModal-tbody",
31796
+ "ExternalInputModal--hasData": "styles_ExternalInputModal--hasData",
31797
+ "ExternalInputModal-loadingBanner": "styles_ExternalInputModal-loadingBanner",
31798
+ "ExternalInputModal--isLoading": "styles_ExternalInputModal--isLoading",
31799
+ "ExternalInputModal-searchForm": "styles_ExternalInputModal-searchForm",
31800
+ "ExternalInputModal-search": "styles_ExternalInputModal-search",
31801
+ "ExternalInputModal-searchIcon": "styles_ExternalInputModal-searchIcon",
31802
+ "ExternalInputModal-searchIconText": "styles_ExternalInputModal-searchIconText",
31803
+ "ExternalInputModal-searchInput": "styles_ExternalInputModal-searchInput",
31804
+ "ExternalInputModal-searchActions": "styles_ExternalInputModal-searchActions",
31805
+ "ExternalInputModal-searchActionIcon": "styles_ExternalInputModal-searchActionIcon",
31806
+ "ExternalInputModal-footer": "styles_ExternalInputModal-footer"
31807
+ };
31477
31808
 
31478
31809
  // components/Modal/index.tsx
31479
31810
  init_react_import();
31480
31811
  var import_react15 = require("react");
31481
31812
 
31482
- // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
31483
- init_react_import();
31484
- var styles_module_default12 = { "Modal": "_Modal_hx2u6_1", "Modal--isOpen": "_Modal--isOpen_hx2u6_15", "Modal-inner": "_Modal-inner_hx2u6_19" };
31813
+ // components/Modal/styles.module.css
31814
+ var styles_default12 = {
31815
+ Modal: "styles_Modal",
31816
+ "Modal--isOpen": "styles_Modal--isOpen",
31817
+ "Modal-inner": "styles_Modal-inner"
31818
+ };
31485
31819
 
31486
31820
  // components/Modal/index.tsx
31487
31821
  var import_react_dom = __toESM(require_react_dom());
31488
- var import_jsx_runtime14 = require("react/jsx-runtime");
31489
- var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
31822
+ var import_jsx_runtime17 = require("react/jsx-runtime");
31823
+ var getClassName12 = get_class_name_factory_default("Modal", styles_default12);
31490
31824
  var Modal = ({
31491
31825
  children,
31492
31826
  onClose,
@@ -31497,10 +31831,10 @@ var Modal = ({
31497
31831
  setRootEl(document.getElementById("puck-portal-root"));
31498
31832
  }, []);
31499
31833
  if (!rootEl) {
31500
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", {});
31834
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {});
31501
31835
  }
31502
31836
  return (0, import_react_dom.createPortal)(
31503
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31837
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31504
31838
  "div",
31505
31839
  {
31506
31840
  className: getClassName12("inner"),
@@ -31514,9 +31848,9 @@ var Modal = ({
31514
31848
 
31515
31849
  // components/ExternalInput/index.tsx
31516
31850
  var import_react_spinners5 = require("react-spinners");
31517
- var import_jsx_runtime15 = require("react/jsx-runtime");
31518
- var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
31519
- var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
31851
+ var import_jsx_runtime18 = require("react/jsx-runtime");
31852
+ var getClassName13 = get_class_name_factory_default("ExternalInput", styles_default11);
31853
+ var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_default11);
31520
31854
  var dataCache = {};
31521
31855
  var ExternalInput = ({
31522
31856
  field,
@@ -31525,13 +31859,23 @@ var ExternalInput = ({
31525
31859
  name,
31526
31860
  id
31527
31861
  }) => {
31528
- const { mapProp = (val) => val } = field || {};
31862
+ const {
31863
+ mapProp = (val) => val,
31864
+ mapRow = (val) => val,
31865
+ filterFields
31866
+ } = field || {};
31529
31867
  const [data, setData] = (0, import_react16.useState)([]);
31530
31868
  const [isOpen, setOpen] = (0, import_react16.useState)(false);
31531
31869
  const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
31870
+ const hasFilterFields = !!filterFields;
31871
+ const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
31872
+ const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
31873
+ const mappedData = (0, import_react16.useMemo)(() => {
31874
+ return data.map(mapRow);
31875
+ }, [data]);
31532
31876
  const keys = (0, import_react16.useMemo)(() => {
31533
31877
  const validKeys = /* @__PURE__ */ new Set();
31534
- for (const item of data) {
31878
+ for (const item of mappedData) {
31535
31879
  for (const key of Object.keys(item)) {
31536
31880
  if (typeof item[key] === "string" || typeof item[key] === "number") {
31537
31881
  validKeys.add(key);
@@ -31539,13 +31883,13 @@ var ExternalInput = ({
31539
31883
  }
31540
31884
  }
31541
31885
  return Array.from(validKeys);
31542
- }, [data]);
31886
+ }, [mappedData]);
31543
31887
  const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
31544
31888
  const search = (0, import_react16.useCallback)(
31545
- (query) => __async(void 0, null, function* () {
31889
+ (query, filters2) => __async(void 0, null, function* () {
31546
31890
  setIsLoading(true);
31547
- const cacheKey = `${id}-${name}-${query}`;
31548
- const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
31891
+ const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
31892
+ const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
31549
31893
  if (listData) {
31550
31894
  setData(listData);
31551
31895
  setIsLoading(false);
@@ -31555,9 +31899,9 @@ var ExternalInput = ({
31555
31899
  [name, field]
31556
31900
  );
31557
31901
  (0, import_react16.useEffect)(() => {
31558
- search(searchQuery);
31902
+ search(searchQuery, filters);
31559
31903
  }, []);
31560
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31904
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31561
31905
  "div",
31562
31906
  {
31563
31907
  className: getClassName13({
@@ -31566,102 +31910,134 @@ var ExternalInput = ({
31566
31910
  }),
31567
31911
  id,
31568
31912
  children: [
31569
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassName13("actions"), children: [
31570
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31913
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName13("actions"), children: [
31914
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31571
31915
  "button",
31572
31916
  {
31917
+ type: "button",
31573
31918
  onClick: () => setOpen(true),
31574
31919
  className: getClassName13("button"),
31575
- children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31576
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: "16" }),
31577
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: field.placeholder })
31920
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
31921
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Link, { size: "16" }),
31922
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: field.placeholder })
31578
31923
  ] })
31579
31924
  }
31580
31925
  ),
31581
- value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31926
+ value && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31582
31927
  "button",
31583
31928
  {
31584
31929
  className: getClassName13("detachButton"),
31585
31930
  onClick: () => {
31586
31931
  onChange(null);
31587
31932
  },
31588
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Unlock, { size: 16 })
31933
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Unlock, { size: 16 })
31589
31934
  }
31590
31935
  )
31591
31936
  ] }),
31592
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31593
- "div",
31937
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31938
+ "form",
31594
31939
  {
31595
31940
  className: getClassNameModal({
31596
31941
  isLoading,
31597
31942
  loaded: !isLoading,
31598
- hasData: data.length > 0
31943
+ hasData: mappedData.length > 0,
31944
+ filtersToggled
31599
31945
  }),
31946
+ onSubmit: (e) => {
31947
+ e.preventDefault();
31948
+ search(searchQuery, filters);
31949
+ },
31600
31950
  children: [
31601
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("masthead"), children: [
31602
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { rank: 2, size: "xxl", children: "Select content" }),
31603
- field.showSearch && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31604
- "form",
31605
- {
31606
- className: getClassNameModal("searchForm"),
31607
- onSubmit: (e) => {
31608
- e.preventDefault();
31609
- search(searchQuery);
31610
- },
31611
- children: [
31612
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
31613
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31614
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
31615
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31616
- "input",
31617
- {
31618
- className: getClassNameModal("searchInput"),
31619
- name: "q",
31620
- type: "search",
31621
- placeholder: "Search",
31622
- onChange: (e) => {
31623
- setSearchQuery(e.currentTarget.value);
31624
- },
31625
- autoComplete: "off",
31626
- value: searchQuery
31627
- }
31628
- )
31629
- ] }),
31630
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, disabled: isLoading, children: "Search" })
31631
- ]
31632
- }
31633
- )
31634
- ] }),
31635
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31636
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
31637
- /* @__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)(
31638
- "th",
31951
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
31952
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: getClassNameModal("search"), children: [
31953
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31954
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Search, { size: "18" }) }),
31955
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31956
+ "input",
31957
+ {
31958
+ className: getClassNameModal("searchInput"),
31959
+ name: "q",
31960
+ type: "search",
31961
+ placeholder: field.placeholder,
31962
+ onChange: (e) => {
31963
+ setSearchQuery(e.currentTarget.value);
31964
+ },
31965
+ autoComplete: "off",
31966
+ value: searchQuery
31967
+ }
31968
+ )
31969
+ ] }),
31970
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
31971
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
31972
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31973
+ IconButton,
31639
31974
  {
31640
- className: getClassNameModal("th"),
31641
- style: { textAlign: "left" },
31642
- children: key
31975
+ title: "Toggle filters",
31976
+ onClick: (e) => {
31977
+ e.preventDefault();
31978
+ e.stopPropagation();
31979
+ setFiltersToggled(!filtersToggled);
31980
+ },
31981
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlidersHorizontal, { size: 20 })
31982
+ }
31983
+ ) })
31984
+ ] })
31985
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
31986
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("grid"), children: [
31987
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
31988
+ const filterField = filterFields[fieldName];
31989
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31990
+ InputOrGroup,
31991
+ {
31992
+ field: filterField,
31993
+ name: fieldName,
31994
+ id: `external_field_${fieldName}_filter`,
31995
+ label: filterField.label || fieldName,
31996
+ value: filters[fieldName],
31997
+ onChange: (value2) => {
31998
+ const newFilters = __spreadProps(__spreadValues({}, filters), { [fieldName]: value2 });
31999
+ setFilters(newFilters);
32000
+ search(searchQuery, newFilters);
32001
+ }
31643
32002
  },
31644
- key
31645
- )) }) }),
31646
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i) => {
31647
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31648
- "tr",
32003
+ fieldName
32004
+ );
32005
+ }) }),
32006
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
32007
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: getClassNameModal("table"), children: [
32008
+ /* @__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)(
32009
+ "th",
31649
32010
  {
31650
- style: { whiteSpace: "nowrap" },
31651
- className: getClassNameModal("tr"),
31652
- onClick: (e) => {
31653
- onChange(mapProp(item));
31654
- setOpen(false);
31655
- },
31656
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
32011
+ className: getClassNameModal("th"),
32012
+ style: { textAlign: "left" },
32013
+ children: key
31657
32014
  },
31658
- i
31659
- );
31660
- }) })
31661
- ] }),
31662
- /* @__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" }) })
32015
+ key
32016
+ )) }) }),
32017
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
32018
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32019
+ "tr",
32020
+ {
32021
+ style: { whiteSpace: "nowrap" },
32022
+ className: getClassNameModal("tr"),
32023
+ onClick: () => {
32024
+ onChange(mapProp(data[i]));
32025
+ setOpen(false);
32026
+ },
32027
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
32028
+ },
32029
+ i
32030
+ );
32031
+ }) })
32032
+ ] }),
32033
+ /* @__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" }) })
32034
+ ] })
31663
32035
  ] }),
31664
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No results." })
32036
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("footer"), children: [
32037
+ mappedData.length,
32038
+ " result",
32039
+ mappedData.length === 1 ? "" : "s"
32040
+ ] })
31665
32041
  ]
31666
32042
  }
31667
32043
  ) })
@@ -31671,7 +32047,7 @@ var ExternalInput = ({
31671
32047
  };
31672
32048
 
31673
32049
  // components/InputOrGroup/fields/ExternalField/index.tsx
31674
- var import_jsx_runtime16 = require("react/jsx-runtime");
32050
+ var import_jsx_runtime19 = require("react/jsx-runtime");
31675
32051
  var ExternalField = ({
31676
32052
  field,
31677
32053
  onChange,
@@ -31693,13 +32069,13 @@ var ExternalField = ({
31693
32069
  if (field.type !== "external") {
31694
32070
  return null;
31695
32071
  }
31696
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
32072
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31697
32073
  FieldLabelInternal,
31698
32074
  {
31699
32075
  label: label || name,
31700
- icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { size: 16 }),
32076
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Link, { size: 16 }),
31701
32077
  el: "div",
31702
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
32078
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31703
32079
  ExternalInput,
31704
32080
  {
31705
32081
  name,
@@ -31707,6 +32083,7 @@ var ExternalField = ({
31707
32083
  // DEPRECATED
31708
32084
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
31709
32085
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
32086
+ mapRow: validField.mapRow,
31710
32087
  fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
31711
32088
  return yield deprecatedField.adaptor.fetchList(
31712
32089
  deprecatedField.adaptorParams
@@ -31724,8 +32101,8 @@ var ExternalField = ({
31724
32101
 
31725
32102
  // components/InputOrGroup/fields/RadioField/index.tsx
31726
32103
  init_react_import();
31727
- var import_jsx_runtime17 = require("react/jsx-runtime");
31728
- var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
32104
+ var import_jsx_runtime20 = require("react/jsx-runtime");
32105
+ var getClassName14 = get_class_name_factory_default("Input", styles_default9);
31729
32106
  var RadioField = ({
31730
32107
  field,
31731
32108
  onChange,
@@ -31738,19 +32115,19 @@ var RadioField = ({
31738
32115
  if (field.type !== "radio" || !field.options) {
31739
32116
  return null;
31740
32117
  }
31741
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
32118
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31742
32119
  FieldLabelInternal,
31743
32120
  {
31744
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CheckCircle, { size: 16 }),
32121
+ icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckCircle, { size: 16 }),
31745
32122
  label: label || name,
31746
32123
  readOnly,
31747
32124
  el: "div",
31748
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
32125
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
31749
32126
  "label",
31750
32127
  {
31751
32128
  className: getClassName14("radio"),
31752
32129
  children: [
31753
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
32130
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31754
32131
  "input",
31755
32132
  {
31756
32133
  type: "radio",
@@ -31768,7 +32145,7 @@ var RadioField = ({
31768
32145
  defaultChecked: value === option.value
31769
32146
  }
31770
32147
  ),
31771
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
32148
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
31772
32149
  ]
31773
32150
  },
31774
32151
  option.label + option.value
@@ -31779,8 +32156,8 @@ var RadioField = ({
31779
32156
 
31780
32157
  // components/InputOrGroup/fields/SelectField/index.tsx
31781
32158
  init_react_import();
31782
- var import_jsx_runtime18 = require("react/jsx-runtime");
31783
- var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
32159
+ var import_jsx_runtime21 = require("react/jsx-runtime");
32160
+ var getClassName15 = get_class_name_factory_default("Input", styles_default9);
31784
32161
  var SelectField = ({
31785
32162
  field,
31786
32163
  onChange,
@@ -31793,13 +32170,13 @@ var SelectField = ({
31793
32170
  if (field.type !== "select" || !field.options) {
31794
32171
  return null;
31795
32172
  }
31796
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32173
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31797
32174
  FieldLabelInternal,
31798
32175
  {
31799
32176
  label: label || name,
31800
- icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDown, { size: 16 }),
32177
+ icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDown, { size: 16 }),
31801
32178
  readOnly,
31802
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32179
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31803
32180
  "select",
31804
32181
  {
31805
32182
  id,
@@ -31813,7 +32190,7 @@ var SelectField = ({
31813
32190
  onChange(e.currentTarget.value);
31814
32191
  },
31815
32192
  value,
31816
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32193
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31817
32194
  "option",
31818
32195
  {
31819
32196
  label: option.label,
@@ -31829,8 +32206,8 @@ var SelectField = ({
31829
32206
 
31830
32207
  // components/InputOrGroup/fields/TextareaField/index.tsx
31831
32208
  init_react_import();
31832
- var import_jsx_runtime19 = require("react/jsx-runtime");
31833
- var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
32209
+ var import_jsx_runtime22 = require("react/jsx-runtime");
32210
+ var getClassName16 = get_class_name_factory_default("Input", styles_default9);
31834
32211
  var TextareaField = ({
31835
32212
  onChange,
31836
32213
  readOnly,
@@ -31839,13 +32216,13 @@ var TextareaField = ({
31839
32216
  label,
31840
32217
  id
31841
32218
  }) => {
31842
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32219
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
31843
32220
  FieldLabelInternal,
31844
32221
  {
31845
32222
  label: label || name,
31846
- icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Type, { size: 16 }),
32223
+ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Type, { size: 16 }),
31847
32224
  readOnly,
31848
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32225
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
31849
32226
  "textarea",
31850
32227
  {
31851
32228
  id,
@@ -31855,6 +32232,7 @@ var TextareaField = ({
31855
32232
  value: typeof value === "undefined" ? "" : value,
31856
32233
  onChange: (e) => onChange(e.currentTarget.value),
31857
32234
  readOnly,
32235
+ tabIndex: readOnly ? -1 : void 0,
31858
32236
  rows: 5
31859
32237
  }
31860
32238
  )
@@ -31868,14 +32246,16 @@ var import_use_debounce2 = require("use-debounce");
31868
32246
  // components/InputOrGroup/fields/ObjectField/index.tsx
31869
32247
  init_react_import();
31870
32248
 
31871
- // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ObjectField/styles.module.css#css-module
31872
- init_react_import();
31873
- var styles_module_default13 = { "ObjectField": "_ObjectField_56z4t_5", "ObjectField-fieldset": "_ObjectField-fieldset_56z4t_13" };
32249
+ // components/InputOrGroup/fields/ObjectField/styles.module.css
32250
+ var styles_default13 = {
32251
+ ObjectField: "styles_ObjectField",
32252
+ "ObjectField-fieldset": "styles_ObjectField-fieldset"
32253
+ };
31874
32254
 
31875
32255
  // components/InputOrGroup/fields/ObjectField/index.tsx
31876
- var import_jsx_runtime20 = require("react/jsx-runtime");
31877
- var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
31878
- var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
32256
+ var import_jsx_runtime23 = require("react/jsx-runtime");
32257
+ var getClassName17 = get_class_name_factory_default("ObjectField", styles_default13);
32258
+ var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_default13);
31879
32259
  var ObjectField = ({
31880
32260
  field,
31881
32261
  onChange,
@@ -31890,18 +32270,18 @@ var ObjectField = ({
31890
32270
  return null;
31891
32271
  }
31892
32272
  const data = value || {};
31893
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32273
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
31894
32274
  FieldLabelInternal,
31895
32275
  {
31896
32276
  label: label || name,
31897
- icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MoreVertical, { size: 16 }),
32277
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MoreVertical, { size: 16 }),
31898
32278
  el: "div",
31899
32279
  readOnly,
31900
- 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) => {
32280
+ 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) => {
31901
32281
  const subField = field.objectFields[fieldName];
31902
32282
  const subFieldName = `${name}.${fieldName}`;
31903
32283
  const wildcardFieldName = `${name}.${fieldName}`;
31904
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32284
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
31905
32285
  InputOrGroup,
31906
32286
  {
31907
32287
  name: subFieldName,
@@ -31928,8 +32308,8 @@ var ObjectField = ({
31928
32308
  };
31929
32309
 
31930
32310
  // components/InputOrGroup/index.tsx
31931
- var import_jsx_runtime21 = require("react/jsx-runtime");
31932
- var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
32311
+ var import_jsx_runtime24 = require("react/jsx-runtime");
32312
+ var getClassName18 = get_class_name_factory_default("Input", styles_default9);
31933
32313
  var FieldLabel = ({
31934
32314
  children,
31935
32315
  icon,
@@ -31939,11 +32319,11 @@ var FieldLabel = ({
31939
32319
  className
31940
32320
  }) => {
31941
32321
  const El = el;
31942
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(El, { className, children: [
31943
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassName18("label"), children: [
31944
- icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {}),
32322
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(El, { className, children: [
32323
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("label"), children: [
32324
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, {}),
31945
32325
  label,
31946
- readOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Lock, { size: "12" }) })
32326
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Lock, { size: "12" }) })
31947
32327
  ] }),
31948
32328
  children
31949
32329
  ] });
@@ -31960,7 +32340,7 @@ var FieldLabelInternal = ({
31960
32340
  () => overrides.fieldLabel || FieldLabel,
31961
32341
  [overrides]
31962
32342
  );
31963
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
32343
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
31964
32344
  Wrapper,
31965
32345
  {
31966
32346
  label,
@@ -32000,7 +32380,7 @@ var InputOrGroup = (_a) => {
32000
32380
  if (!field.render) {
32001
32381
  return null;
32002
32382
  }
32003
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32383
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32004
32384
  field,
32005
32385
  name,
32006
32386
  readOnly
@@ -32029,17 +32409,19 @@ var InputOrGroup = (_a) => {
32029
32409
  const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
32030
32410
  const children = defaultFields[field.type](mergedProps);
32031
32411
  const Render2 = render[field.type];
32032
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32412
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32033
32413
  };
32034
32414
 
32035
- // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
32036
- init_react_import();
32037
- var styles_module_default14 = { "PuckFields": "_PuckFields_1276r_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_1276r_5" };
32415
+ // components/Puck/components/Fields/styles.module.css
32416
+ var styles_default14 = {
32417
+ PuckFields: "styles_PuckFields",
32418
+ "PuckFields-loadingOverlay": "styles_PuckFields-loadingOverlay"
32419
+ };
32038
32420
 
32039
32421
  // components/Puck/components/Fields/index.tsx
32040
32422
  var import_react19 = require("react");
32041
- var import_jsx_runtime22 = require("react/jsx-runtime");
32042
- var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
32423
+ var import_jsx_runtime25 = require("react/jsx-runtime");
32424
+ var getClassName19 = get_class_name_factory_default("PuckFields", styles_default14);
32043
32425
  var defaultPageFields = {
32044
32426
  title: { type: "text" }
32045
32427
  };
@@ -32047,9 +32429,9 @@ var DefaultFields = ({
32047
32429
  children,
32048
32430
  isLoading
32049
32431
  }) => {
32050
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName19(), children: [
32432
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
32051
32433
  children,
32052
- 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" }) })
32434
+ 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" }) })
32053
32435
  ] });
32054
32436
  };
32055
32437
  var Fields = () => {
@@ -32070,14 +32452,14 @@ var Fields = () => {
32070
32452
  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;
32071
32453
  const rootProps = data.root.props || data.root;
32072
32454
  const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32073
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32455
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32074
32456
  "form",
32075
32457
  {
32076
32458
  className: getClassName19(),
32077
32459
  onSubmit: (e) => {
32078
32460
  e.preventDefault();
32079
32461
  },
32080
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32462
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32081
32463
  const field = fields[fieldName];
32082
32464
  const onChange = (value, updatedUi) => {
32083
32465
  var _a2, _b2;
@@ -32143,7 +32525,7 @@ var Fields = () => {
32143
32525
  };
32144
32526
  if (selectedItem && itemSelector) {
32145
32527
  const { readOnly = {} } = selectedItem;
32146
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32528
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32147
32529
  InputOrGroup,
32148
32530
  {
32149
32531
  field,
@@ -32159,7 +32541,7 @@ var Fields = () => {
32159
32541
  );
32160
32542
  } else {
32161
32543
  const { readOnly = {} } = data.root;
32162
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32544
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32163
32545
  InputOrGroup,
32164
32546
  {
32165
32547
  field,
@@ -32189,19 +32571,25 @@ var import_react20 = require("react");
32189
32571
  // components/ComponentList/index.tsx
32190
32572
  init_react_import();
32191
32573
 
32192
- // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
32193
- init_react_import();
32194
- var styles_module_default15 = { "ComponentList": "_ComponentList_1di93_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1di93_6", "ComponentList-content": "_ComponentList-content_1di93_10", "ComponentList-title": "_ComponentList-title_1di93_18", "ComponentList-titleIcon": "_ComponentList-titleIcon_1di93_39" };
32574
+ // components/ComponentList/styles.module.css
32575
+ var styles_default15 = {
32576
+ ComponentList: "styles_ComponentList",
32577
+ "ComponentList--isExpanded": "styles_ComponentList--isExpanded",
32578
+ "ComponentList-content": "styles_ComponentList-content",
32579
+ "ComponentList-title": "styles_ComponentList-title",
32580
+ "ComponentList-titleIcon": "styles_ComponentList-titleIcon"
32581
+ };
32195
32582
 
32196
32583
  // components/ComponentList/index.tsx
32197
- var import_jsx_runtime23 = require("react/jsx-runtime");
32198
- var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
32584
+ var import_jsx_runtime26 = require("react/jsx-runtime");
32585
+ var getClassName20 = get_class_name_factory_default("ComponentList", styles_default15);
32199
32586
  var ComponentListItem = ({
32200
32587
  name,
32588
+ label,
32201
32589
  index
32202
32590
  }) => {
32203
32591
  const { overrides } = useAppContext();
32204
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer.Item, { name, index, children: overrides.componentItem });
32592
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
32205
32593
  };
32206
32594
  var ComponentList = ({
32207
32595
  children,
@@ -32210,9 +32598,9 @@ var ComponentList = ({
32210
32598
  }) => {
32211
32599
  const { config, state, setUi } = useAppContext();
32212
32600
  const { expanded = true } = state.ui.componentList[id] || {};
32213
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32214
- title && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
32215
- "div",
32601
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32602
+ title && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
32603
+ "button",
32216
32604
  {
32217
32605
  className: getClassName20("title"),
32218
32606
  onClick: () => setUi({
@@ -32224,15 +32612,17 @@ var ComponentList = ({
32224
32612
  }),
32225
32613
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
32226
32614
  children: [
32227
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: title }),
32228
- /* @__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 }) })
32615
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: title }),
32616
+ /* @__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 }) })
32229
32617
  ]
32230
32618
  }
32231
32619
  ),
32232
- /* @__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) => {
32233
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32620
+ /* @__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) => {
32621
+ var _a;
32622
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32234
32623
  ComponentListItem,
32235
32624
  {
32625
+ label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
32236
32626
  name: componentKey,
32237
32627
  index: i
32238
32628
  },
@@ -32244,7 +32634,7 @@ var ComponentList = ({
32244
32634
  ComponentList.Item = ComponentListItem;
32245
32635
 
32246
32636
  // lib/use-component-list.tsx
32247
- var import_jsx_runtime24 = require("react/jsx-runtime");
32637
+ var import_jsx_runtime27 = require("react/jsx-runtime");
32248
32638
  var useComponentList = (config, ui) => {
32249
32639
  const [componentList, setComponentList] = (0, import_react20.useState)();
32250
32640
  (0, import_react20.useEffect)(() => {
@@ -32257,16 +32647,18 @@ var useComponentList = (config, ui) => {
32257
32647
  if (category.visible === false || !category.components) {
32258
32648
  return null;
32259
32649
  }
32260
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32650
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32261
32651
  ComponentList,
32262
32652
  {
32263
32653
  id: categoryKey,
32264
32654
  title: category.title || categoryKey,
32265
32655
  children: category.components.map((componentName, i) => {
32656
+ var _a2;
32266
32657
  matchedComponents.push(componentName);
32267
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32658
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32268
32659
  ComponentList.Item,
32269
32660
  {
32661
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32270
32662
  name: componentName,
32271
32663
  index: i
32272
32664
  },
@@ -32283,16 +32675,18 @@ var useComponentList = (config, ui) => {
32283
32675
  );
32284
32676
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
32285
32677
  _componentList.push(
32286
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32678
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32287
32679
  ComponentList,
32288
32680
  {
32289
32681
  id: "other",
32290
32682
  title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
32291
32683
  children: remainingComponents.map((componentName, i) => {
32292
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32684
+ var _a2;
32685
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32293
32686
  ComponentList.Item,
32294
32687
  {
32295
32688
  name: componentName,
32689
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32296
32690
  index: i
32297
32691
  },
32298
32692
  componentName
@@ -32305,44 +32699,71 @@ var useComponentList = (config, ui) => {
32305
32699
  }
32306
32700
  setComponentList(_componentList);
32307
32701
  }
32308
- }, [config.categories, ui.componentList]);
32702
+ }, [config.categories, config.components, ui.componentList]);
32309
32703
  return componentList;
32310
32704
  };
32311
32705
 
32312
32706
  // components/Puck/components/Components/index.tsx
32313
32707
  var import_react21 = require("react");
32314
- var import_jsx_runtime25 = require("react/jsx-runtime");
32708
+ var import_jsx_runtime28 = require("react/jsx-runtime");
32315
32709
  var Components = () => {
32316
32710
  const { config, state, overrides } = useAppContext();
32317
32711
  const componentList = useComponentList(config, state.ui);
32318
32712
  const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
32319
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComponentList, { id: "all" }) });
32713
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
32320
32714
  };
32321
32715
 
32322
32716
  // components/Puck/components/Preview/index.tsx
32323
32717
  init_react_import();
32324
32718
  var import_react22 = require("react");
32325
- var import_jsx_runtime26 = require("react/jsx-runtime");
32719
+ var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
32720
+
32721
+ // components/Puck/components/Preview/styles.module.css
32722
+ var styles_default16 = {
32723
+ PuckPreview: "styles_PuckPreview",
32724
+ "PuckPreview-frame": "styles_PuckPreview-frame"
32725
+ };
32726
+
32727
+ // components/Puck/components/Preview/index.tsx
32728
+ var import_jsx_runtime29 = require("react/jsx-runtime");
32729
+ var getClassName21 = get_class_name_factory_default("PuckPreview", styles_default16);
32326
32730
  var Preview = ({ id = "puck-preview" }) => {
32327
- const { config, dispatch, state } = useAppContext();
32731
+ const { config, dispatch, state, setStatus, iframe } = useAppContext();
32328
32732
  const Page = (0, import_react22.useCallback)(
32329
32733
  (pageProps) => {
32330
32734
  var _a, _b;
32331
- return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({}, pageProps), { editMode: true })) : pageProps.children;
32735
+ return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
32736
+ id: "puck-root"
32737
+ }, pageProps), {
32738
+ editMode: true,
32739
+ puck: { renderDropZone: DropZone }
32740
+ })) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: pageProps.children });
32332
32741
  },
32333
32742
  [config.root]
32334
32743
  );
32335
32744
  const rootProps = state.data.root.props || state.data.root;
32336
- const { disableZoom = false } = (0, import_react22.useContext)(dropZoneContext) || {};
32337
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32745
+ const ref = (0, import_react22.useRef)(null);
32746
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32338
32747
  "div",
32339
32748
  {
32749
+ className: getClassName21(),
32340
32750
  id,
32341
32751
  onClick: () => {
32342
32752
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
32343
32753
  },
32344
- style: { zoom: disableZoom ? 1 : 0.75 },
32345
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZone, { zone: rootDroppableId }) }))
32754
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32755
+ import_auto_frame_component.default,
32756
+ {
32757
+ id: "preview-frame",
32758
+ className: getClassName21("frame"),
32759
+ "data-rfd-iframe": true,
32760
+ ref,
32761
+ onStylesLoaded: () => {
32762
+ setStatus("READY");
32763
+ },
32764
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) }))
32765
+ }
32766
+ ) : /* @__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 }) })) })
32346
32767
  }
32347
32768
  );
32348
32769
  };
@@ -32374,9 +32795,24 @@ var areaContainsZones = (data, area) => {
32374
32795
  // components/LayerTree/index.tsx
32375
32796
  init_react_import();
32376
32797
 
32377
- // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
32378
- init_react_import();
32379
- var styles_module_default16 = { "LayerTree": "_LayerTree_o89yt_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_o89yt_11", "LayerTree-helper": "_LayerTree-helper_o89yt_17", "Layer": "_Layer_o89yt_1", "Layer-inner": "_Layer-inner_o89yt_29", "Layer--containsZone": "_Layer--containsZone_o89yt_35", "Layer-clickable": "_Layer-clickable_o89yt_39", "Layer--isSelected": "_Layer--isSelected_o89yt_48", "Layer--isHovering": "_Layer--isHovering_o89yt_49", "Layer-chevron": "_Layer-chevron_o89yt_65", "Layer--childIsSelected": "_Layer--childIsSelected_o89yt_66", "Layer-zones": "_Layer-zones_o89yt_70", "Layer-title": "_Layer-title_o89yt_84", "Layer-name": "_Layer-name_o89yt_93", "Layer-icon": "_Layer-icon_o89yt_99", "Layer-zoneIcon": "_Layer-zoneIcon_o89yt_104" };
32798
+ // components/LayerTree/styles.module.css
32799
+ var styles_default17 = {
32800
+ LayerTree: "styles_LayerTree",
32801
+ "LayerTree-zoneTitle": "styles_LayerTree-zoneTitle",
32802
+ "LayerTree-helper": "styles_LayerTree-helper",
32803
+ Layer: "styles_Layer",
32804
+ "Layer-inner": "styles_Layer-inner",
32805
+ "Layer--containsZone": "styles_Layer--containsZone",
32806
+ "Layer-clickable": "styles_Layer-clickable",
32807
+ "Layer--isSelected": "styles_Layer--isSelected",
32808
+ "Layer-chevron": "styles_Layer-chevron",
32809
+ "Layer--childIsSelected": "styles_Layer--childIsSelected",
32810
+ "Layer-zones": "styles_Layer-zones",
32811
+ "Layer-title": "styles_Layer-title",
32812
+ "Layer-name": "styles_Layer-name",
32813
+ "Layer-icon": "styles_Layer-icon",
32814
+ "Layer-zoneIcon": "styles_Layer-zoneIcon"
32815
+ };
32380
32816
 
32381
32817
  // lib/scroll-into-view.ts
32382
32818
  init_react_import();
@@ -32404,11 +32840,12 @@ var isChildOfZone = (item, maybeChild, ctx) => {
32404
32840
  };
32405
32841
 
32406
32842
  // components/LayerTree/index.tsx
32407
- var import_jsx_runtime27 = require("react/jsx-runtime");
32408
- var getClassName21 = get_class_name_factory_default("LayerTree", styles_module_default16);
32409
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default16);
32843
+ var import_jsx_runtime30 = require("react/jsx-runtime");
32844
+ var getClassName22 = get_class_name_factory_default("LayerTree", styles_default17);
32845
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_default17);
32410
32846
  var LayerTree = ({
32411
32847
  data,
32848
+ config,
32412
32849
  zoneContent,
32413
32850
  itemSelector,
32414
32851
  setItemSelector,
@@ -32417,15 +32854,16 @@ var LayerTree = ({
32417
32854
  }) => {
32418
32855
  const zones = data.zones || {};
32419
32856
  const ctx = (0, import_react23.useContext)(dropZoneContext);
32420
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
32421
- label && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName21("zoneTitle"), children: [
32422
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Layers, { size: "16" }) }),
32857
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
32858
+ label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
32859
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
32423
32860
  " ",
32424
32861
  label
32425
32862
  ] }),
32426
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("ul", { className: getClassName21(), children: [
32427
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("helper"), children: "No items" }),
32863
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName22(), children: [
32864
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
32428
32865
  zoneContent.map((item, i) => {
32866
+ var _a;
32429
32867
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
32430
32868
  const zonesForItem = findZonesForArea(data, item.props.id);
32431
32869
  const containsZone = Object.keys(zonesForItem).length > 0;
@@ -32439,7 +32877,7 @@ var LayerTree = ({
32439
32877
  const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
32440
32878
  const isHovering = hoveringComponent === item.props.id;
32441
32879
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
32442
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32880
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32443
32881
  "li",
32444
32882
  {
32445
32883
  className: getClassNameLayer({
@@ -32449,8 +32887,8 @@ var LayerTree = ({
32449
32887
  childIsSelected
32450
32888
  }),
32451
32889
  children: [
32452
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32453
- "div",
32890
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32891
+ "button",
32454
32892
  {
32455
32893
  className: getClassNameLayer("clickable"),
32456
32894
  onClick: () => {
@@ -32463,8 +32901,9 @@ var LayerTree = ({
32463
32901
  zone
32464
32902
  });
32465
32903
  const id = zoneContent[i].props.id;
32904
+ const frame = getFrame();
32466
32905
  scrollIntoView(
32467
- document.querySelector(
32906
+ frame == null ? void 0 : frame.querySelector(
32468
32907
  `[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
32469
32908
  )
32470
32909
  );
@@ -32480,24 +32919,25 @@ var LayerTree = ({
32480
32919
  setHoveringComponent(null);
32481
32920
  },
32482
32921
  children: [
32483
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32922
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32484
32923
  "div",
32485
32924
  {
32486
32925
  className: getClassNameLayer("chevron"),
32487
32926
  title: isSelected ? "Collapse" : "Expand",
32488
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDown, { size: "12" })
32927
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
32489
32928
  }
32490
32929
  ),
32491
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassNameLayer("title"), children: [
32492
- /* @__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" }) }),
32493
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
32930
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
32931
+ /* @__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" }) }),
32932
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
32494
32933
  ] })
32495
32934
  ]
32496
32935
  }
32497
32936
  ) }),
32498
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32937
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32499
32938
  LayerTree,
32500
32939
  {
32940
+ config,
32501
32941
  data,
32502
32942
  zoneContent: zones[zoneKey],
32503
32943
  setItemSelector,
@@ -32517,9 +32957,9 @@ var LayerTree = ({
32517
32957
 
32518
32958
  // components/Puck/components/Outline/index.tsx
32519
32959
  var import_react24 = require("react");
32520
- var import_jsx_runtime28 = require("react/jsx-runtime");
32960
+ var import_jsx_runtime31 = require("react/jsx-runtime");
32521
32961
  var Outline = () => {
32522
- const { dispatch, state, overrides } = useAppContext();
32962
+ const { dispatch, state, overrides, config } = useAppContext();
32523
32963
  const { data, ui } = state;
32524
32964
  const { itemSelector } = ui;
32525
32965
  const setItemSelector = (0, import_react24.useCallback)(
@@ -32532,10 +32972,11 @@ var Outline = () => {
32532
32972
  []
32533
32973
  );
32534
32974
  const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
32535
- 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: [
32536
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32975
+ 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: [
32976
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32537
32977
  LayerTree,
32538
32978
  {
32979
+ config,
32539
32980
  data,
32540
32981
  label: areaContainsZones(data, "root") ? rootDroppableId : "",
32541
32982
  zoneContent: data.content,
@@ -32545,9 +32986,10 @@ var Outline = () => {
32545
32986
  ),
32546
32987
  Object.entries(findZonesForArea(data, "root")).map(
32547
32988
  ([zoneKey, zone]) => {
32548
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32989
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32549
32990
  LayerTree,
32550
32991
  {
32992
+ config,
32551
32993
  data,
32552
32994
  label: zoneKey,
32553
32995
  zone: zoneKey,
@@ -32671,14 +33113,441 @@ function useHistoryStore() {
32671
33113
  };
32672
33114
  }
32673
33115
 
33116
+ // components/Puck/components/Canvas/index.tsx
33117
+ init_react_import();
33118
+
33119
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
33120
+ init_react_import();
33121
+
33122
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
33123
+ init_react_import();
33124
+ var isProduction = process.env.NODE_ENV === "production";
33125
+ var prefix = "Invariant failed";
33126
+ function invariant(condition, message) {
33127
+ if (condition) {
33128
+ return;
33129
+ }
33130
+ if (isProduction) {
33131
+ throw new Error(prefix);
33132
+ }
33133
+ var provided = typeof message === "function" ? message() : message;
33134
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
33135
+ throw new Error(value);
33136
+ }
33137
+
33138
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
33139
+ var getRect = function getRect2(_ref) {
33140
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
33141
+ var width = right - left;
33142
+ var height = bottom - top;
33143
+ var rect = {
33144
+ top,
33145
+ right,
33146
+ bottom,
33147
+ left,
33148
+ width,
33149
+ height,
33150
+ x: left,
33151
+ y: top,
33152
+ center: {
33153
+ x: (right + left) / 2,
33154
+ y: (bottom + top) / 2
33155
+ }
33156
+ };
33157
+ return rect;
33158
+ };
33159
+ var expand = function expand2(target, expandBy) {
33160
+ return {
33161
+ top: target.top - expandBy.top,
33162
+ left: target.left - expandBy.left,
33163
+ bottom: target.bottom + expandBy.bottom,
33164
+ right: target.right + expandBy.right
33165
+ };
33166
+ };
33167
+ var shrink = function shrink2(target, shrinkBy) {
33168
+ return {
33169
+ top: target.top + shrinkBy.top,
33170
+ left: target.left + shrinkBy.left,
33171
+ bottom: target.bottom - shrinkBy.bottom,
33172
+ right: target.right - shrinkBy.right
33173
+ };
33174
+ };
33175
+ var noSpacing = {
33176
+ top: 0,
33177
+ right: 0,
33178
+ bottom: 0,
33179
+ left: 0
33180
+ };
33181
+ var createBox = function createBox2(_ref2) {
33182
+ 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;
33183
+ var marginBox = getRect(expand(borderBox, margin));
33184
+ var paddingBox = getRect(shrink(borderBox, border));
33185
+ var contentBox = getRect(shrink(paddingBox, padding));
33186
+ return {
33187
+ marginBox,
33188
+ borderBox: getRect(borderBox),
33189
+ paddingBox,
33190
+ contentBox,
33191
+ margin,
33192
+ border,
33193
+ padding
33194
+ };
33195
+ };
33196
+ var parse = function parse2(raw) {
33197
+ var value = raw.slice(0, -2);
33198
+ var suffix = raw.slice(-2);
33199
+ if (suffix !== "px") {
33200
+ return 0;
33201
+ }
33202
+ var result = Number(value);
33203
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
33204
+ return result;
33205
+ };
33206
+ var calculateBox = function calculateBox2(borderBox, styles) {
33207
+ var margin = {
33208
+ top: parse(styles.marginTop),
33209
+ right: parse(styles.marginRight),
33210
+ bottom: parse(styles.marginBottom),
33211
+ left: parse(styles.marginLeft)
33212
+ };
33213
+ var padding = {
33214
+ top: parse(styles.paddingTop),
33215
+ right: parse(styles.paddingRight),
33216
+ bottom: parse(styles.paddingBottom),
33217
+ left: parse(styles.paddingLeft)
33218
+ };
33219
+ var border = {
33220
+ top: parse(styles.borderTopWidth),
33221
+ right: parse(styles.borderRightWidth),
33222
+ bottom: parse(styles.borderBottomWidth),
33223
+ left: parse(styles.borderLeftWidth)
33224
+ };
33225
+ return createBox({
33226
+ borderBox,
33227
+ margin,
33228
+ padding,
33229
+ border
33230
+ });
33231
+ };
33232
+ var getBox = function getBox2(el) {
33233
+ var borderBox = el.getBoundingClientRect();
33234
+ var styles = window.getComputedStyle(el);
33235
+ return calculateBox(borderBox, styles);
33236
+ };
33237
+
33238
+ // components/Puck/components/Canvas/index.tsx
33239
+ var import_react27 = require("react");
33240
+
33241
+ // components/ViewportControls/index.tsx
33242
+ init_react_import();
33243
+ var import_react26 = require("react");
33244
+
33245
+ // components/ViewportControls/styles.module.css
33246
+ var styles_default18 = {
33247
+ ViewportControls: "styles_ViewportControls",
33248
+ "ViewportControls-divider": "styles_ViewportControls-divider",
33249
+ "ViewportControls-zoomSelect": "styles_ViewportControls-zoomSelect",
33250
+ "ViewportButton--isActive": "styles_ViewportButton--isActive",
33251
+ "ViewportButton-inner": "styles_ViewportButton-inner"
33252
+ };
33253
+
33254
+ // components/ViewportControls/index.tsx
33255
+ var import_jsx_runtime32 = require("react/jsx-runtime");
33256
+ var icons = {
33257
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Smartphone, { size: 16 }),
33258
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tablet, { size: 16 }),
33259
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Monitor, { size: 16 })
33260
+ };
33261
+ var getClassName23 = get_class_name_factory_default("ViewportControls", styles_default18);
33262
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_default18);
33263
+ var ViewportButton = ({
33264
+ children,
33265
+ height = "auto",
33266
+ title,
33267
+ width,
33268
+ onClick
33269
+ }) => {
33270
+ const { state } = useAppContext();
33271
+ const [isActive, setIsActive] = (0, import_react26.useState)(false);
33272
+ (0, import_react26.useEffect)(() => {
33273
+ setIsActive(width === state.ui.viewports.current.width);
33274
+ }, [width, state.ui.viewports.current.width]);
33275
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33276
+ IconButton,
33277
+ {
33278
+ title,
33279
+ disabled: isActive,
33280
+ onClick: (e) => {
33281
+ e.stopPropagation();
33282
+ onClick({ width, height });
33283
+ },
33284
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton("inner"), children })
33285
+ }
33286
+ ) });
33287
+ };
33288
+ var defaultZoomOptions = [
33289
+ { label: "25%", value: 0.25 },
33290
+ { label: "50%", value: 0.5 },
33291
+ { label: "75%", value: 0.75 },
33292
+ { label: "100%", value: 1 },
33293
+ { label: "125%", value: 1.25 },
33294
+ { label: "150%", value: 1.5 },
33295
+ { label: "200%", value: 2 }
33296
+ ];
33297
+ var ViewportControls = ({
33298
+ autoZoom,
33299
+ zoom,
33300
+ onViewportChange,
33301
+ onZoom
33302
+ }) => {
33303
+ const { viewports } = useAppContext();
33304
+ const defaultsContainAutoZoom = defaultZoomOptions.find(
33305
+ (option) => option.value === autoZoom
33306
+ );
33307
+ const zoomOptions = (0, import_react26.useMemo)(
33308
+ () => [
33309
+ ...defaultZoomOptions,
33310
+ ...defaultsContainAutoZoom ? [] : [
33311
+ {
33312
+ value: autoZoom,
33313
+ label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
33314
+ }
33315
+ ]
33316
+ ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
33317
+ [autoZoom]
33318
+ );
33319
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName23(), children: [
33320
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33321
+ ViewportButton,
33322
+ {
33323
+ height: viewport.height,
33324
+ width: viewport.width,
33325
+ title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
33326
+ onClick: onViewportChange,
33327
+ children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
33328
+ },
33329
+ i
33330
+ )),
33331
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33332
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33333
+ IconButton,
33334
+ {
33335
+ title: "Zoom viewport out",
33336
+ disabled: zoom <= zoomOptions[0].value,
33337
+ onClick: (e) => {
33338
+ e.stopPropagation();
33339
+ onZoom(
33340
+ zoomOptions[Math.max(
33341
+ zoomOptions.findIndex((option) => option.value === zoom) - 1,
33342
+ 0
33343
+ )].value
33344
+ );
33345
+ },
33346
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomOut, { size: 16 })
33347
+ }
33348
+ ),
33349
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33350
+ IconButton,
33351
+ {
33352
+ title: "Zoom viewport in",
33353
+ disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
33354
+ onClick: (e) => {
33355
+ e.stopPropagation();
33356
+ onZoom(
33357
+ zoomOptions[Math.min(
33358
+ zoomOptions.findIndex((option) => option.value === zoom) + 1,
33359
+ zoomOptions.length - 1
33360
+ )].value
33361
+ );
33362
+ },
33363
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomIn, { size: 16 })
33364
+ }
33365
+ ),
33366
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33367
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33368
+ "select",
33369
+ {
33370
+ className: getClassName23("zoomSelect"),
33371
+ value: zoom.toString(),
33372
+ onChange: (e) => {
33373
+ onZoom(parseFloat(e.currentTarget.value));
33374
+ },
33375
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33376
+ "option",
33377
+ {
33378
+ value: option.value,
33379
+ label: option.label
33380
+ },
33381
+ option.label
33382
+ ))
33383
+ }
33384
+ )
33385
+ ] });
33386
+ };
33387
+
33388
+ // components/Puck/components/Canvas/styles.module.css
33389
+ var styles_default19 = {
33390
+ PuckCanvas: "styles_PuckCanvas",
33391
+ "PuckCanvas-controls": "styles_PuckCanvas-controls",
33392
+ "PuckCanvas-inner": "styles_PuckCanvas-inner",
33393
+ "PuckCanvas-root": "styles_PuckCanvas-root",
33394
+ "PuckCanvas--ready": "styles_PuckCanvas--ready"
33395
+ };
33396
+
33397
+ // lib/get-zoom-config.ts
33398
+ init_react_import();
33399
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
33400
+ var getZoomConfig = (uiViewport, frame, zoom) => {
33401
+ const box = getBox(frame);
33402
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
33403
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
33404
+ let rootHeight = 0;
33405
+ let autoZoom = 1;
33406
+ if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
33407
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
33408
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
33409
+ zoom = widthZoom;
33410
+ if (widthZoom < heightZoom) {
33411
+ rootHeight = viewportHeight / zoom;
33412
+ } else {
33413
+ rootHeight = viewportHeight;
33414
+ zoom = heightZoom;
33415
+ }
33416
+ autoZoom = zoom;
33417
+ } else {
33418
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
33419
+ autoZoom = 1;
33420
+ zoom = 1;
33421
+ rootHeight = viewportHeight;
33422
+ }
33423
+ }
33424
+ return { autoZoom, rootHeight, zoom };
33425
+ };
33426
+
33427
+ // components/Puck/components/Canvas/index.tsx
33428
+ var import_jsx_runtime33 = require("react/jsx-runtime");
33429
+ var getClassName24 = get_class_name_factory_default("PuckCanvas", styles_default19);
33430
+ var ZOOM_ON_CHANGE = true;
33431
+ var Canvas = () => {
33432
+ const { status, iframe } = useAppContext();
33433
+ const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
33434
+ const { ui } = state;
33435
+ const frameRef = (0, import_react27.useRef)(null);
33436
+ const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
33437
+ const defaultRender = (0, import_react27.useMemo)(() => {
33438
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
33439
+ return PuckDefault;
33440
+ }, []);
33441
+ const CustomPreview = (0, import_react27.useMemo)(
33442
+ () => overrides.preview || defaultRender,
33443
+ [overrides]
33444
+ );
33445
+ const getFrameDimensions = (0, import_react27.useCallback)(() => {
33446
+ if (frameRef.current) {
33447
+ const frame = frameRef.current;
33448
+ const box = getBox(frame);
33449
+ return { width: box.contentBox.width, height: box.contentBox.height };
33450
+ }
33451
+ return { width: 0, height: 0 };
33452
+ }, [frameRef]);
33453
+ const resetAutoZoom = (0, import_react27.useCallback)(
33454
+ (ui2 = state.ui) => {
33455
+ if (frameRef.current) {
33456
+ setZoomConfig(
33457
+ getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
33458
+ );
33459
+ }
33460
+ },
33461
+ [frameRef, zoomConfig, state.ui]
33462
+ );
33463
+ (0, import_react27.useEffect)(() => {
33464
+ setShowTransition(false);
33465
+ resetAutoZoom();
33466
+ }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
33467
+ (0, import_react27.useEffect)(() => {
33468
+ const { height: frameHeight } = getFrameDimensions();
33469
+ if (ui.viewports.current.height === "auto") {
33470
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
33471
+ rootHeight: frameHeight / zoomConfig.zoom
33472
+ }));
33473
+ }
33474
+ }, [zoomConfig.zoom]);
33475
+ (0, import_react27.useEffect)(() => {
33476
+ const observer = new ResizeObserver(() => {
33477
+ setShowTransition(false);
33478
+ resetAutoZoom();
33479
+ });
33480
+ if (document.body) {
33481
+ observer.observe(document.body);
33482
+ }
33483
+ return () => {
33484
+ observer.disconnect();
33485
+ };
33486
+ }, []);
33487
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
33488
+ "div",
33489
+ {
33490
+ className: getClassName24({
33491
+ ready: status === "READY" || !iframe.enabled
33492
+ }),
33493
+ onClick: () => dispatch({
33494
+ type: "setUi",
33495
+ ui: { itemSelector: null },
33496
+ recordHistory: true
33497
+ }),
33498
+ children: [
33499
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33500
+ ViewportControls,
33501
+ {
33502
+ autoZoom: zoomConfig.autoZoom,
33503
+ zoom: zoomConfig.zoom,
33504
+ onViewportChange: (viewport) => {
33505
+ setShowTransition(true);
33506
+ const uiViewport = __spreadProps(__spreadValues({}, viewport), {
33507
+ height: viewport.height || "auto",
33508
+ zoom: zoomConfig.zoom
33509
+ });
33510
+ const newUi = __spreadProps(__spreadValues({}, ui), {
33511
+ viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
33512
+ });
33513
+ setUi(newUi);
33514
+ if (ZOOM_ON_CHANGE) {
33515
+ resetAutoZoom(newUi);
33516
+ }
33517
+ },
33518
+ onZoom: (zoom) => {
33519
+ setShowTransition(true);
33520
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
33521
+ }
33522
+ }
33523
+ ) }),
33524
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33525
+ "div",
33526
+ {
33527
+ className: getClassName24("root"),
33528
+ style: {
33529
+ width: iframe.enabled ? ui.viewports.current.width : void 0,
33530
+ height: zoomConfig.rootHeight,
33531
+ transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
33532
+ transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
33533
+ overflow: iframe.enabled ? void 0 : "auto"
33534
+ },
33535
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
33536
+ }
33537
+ ) })
33538
+ ]
33539
+ }
33540
+ );
33541
+ };
33542
+
32674
33543
  // components/Puck/index.tsx
32675
- var import_jsx_runtime29 = require("react/jsx-runtime");
32676
- var getClassName22 = get_class_name_factory_default("Puck", styles_module_default8);
33544
+ var import_jsx_runtime34 = require("react/jsx-runtime");
33545
+ var getClassName25 = get_class_name_factory_default("Puck", styles_default8);
32677
33546
  function Puck({
32678
33547
  children,
32679
33548
  config,
32680
33549
  data: initialData = { content: [], root: { props: { title: "" } } },
32681
- ui: initialUi = defaultAppState.ui,
33550
+ ui: initialUi,
32682
33551
  onChange,
32683
33552
  onPublish,
32684
33553
  plugins = [],
@@ -32686,32 +33555,63 @@ function Puck({
32686
33555
  renderHeader,
32687
33556
  renderHeaderActions,
32688
33557
  headerTitle,
32689
- headerPath
33558
+ headerPath,
33559
+ viewports = defaultViewports,
33560
+ iframe = {
33561
+ enabled: true
33562
+ }
32690
33563
  }) {
33564
+ var _a;
32691
33565
  const historyStore = useHistoryStore();
32692
- const [reducer] = (0, import_react26.useState)(
33566
+ const [reducer] = (0, import_react28.useState)(
32693
33567
  () => createReducer({ config, record: historyStore.record })
32694
33568
  );
32695
- const [initialAppState] = (0, import_react26.useState)(() => __spreadProps(__spreadValues({}, defaultAppState), {
32696
- data: initialData,
32697
- ui: __spreadProps(__spreadValues(__spreadValues({}, defaultAppState.ui), initialUi), {
32698
- // Store categories under componentList on state to allow render functions and plugins to modify
32699
- componentList: config.categories ? Object.entries(config.categories).reduce(
32700
- (acc, [categoryName, category]) => {
32701
- return __spreadProps(__spreadValues({}, acc), {
32702
- [categoryName]: {
32703
- title: category.title,
32704
- components: category.components,
32705
- expanded: category.defaultExpanded,
32706
- visible: category.visible
32707
- }
32708
- });
32709
- },
32710
- {}
32711
- ) : {}
32712
- })
32713
- }));
32714
- const [appState, dispatch] = (0, import_react26.useReducer)(
33569
+ const [initialAppState] = (0, import_react28.useState)(() => {
33570
+ var _a2, _b, _c, _d;
33571
+ const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
33572
+ let clientUiState = {};
33573
+ if (typeof window !== "undefined") {
33574
+ const viewportWidth = window.innerWidth;
33575
+ const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
33576
+ key,
33577
+ diff: Math.abs(viewportWidth - value.width)
33578
+ })).sort((a, b) => a.diff > b.diff ? 1 : -1);
33579
+ const closestViewport = viewportDifferences[0].key;
33580
+ if (iframe.enabled) {
33581
+ clientUiState = __spreadProps(__spreadValues({}, window.matchMedia("(min-width: 638px)").matches ? {} : {
33582
+ leftSideBarVisible: false,
33583
+ rightSideBarVisible: false
33584
+ }), {
33585
+ viewports: __spreadProps(__spreadValues({}, initial.viewports), {
33586
+ current: __spreadProps(__spreadValues({}, initial.viewports.current), {
33587
+ height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
33588
+ width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
33589
+ })
33590
+ })
33591
+ });
33592
+ }
33593
+ }
33594
+ return __spreadProps(__spreadValues({}, defaultAppState), {
33595
+ data: initialData,
33596
+ ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
33597
+ // Store categories under componentList on state to allow render functions and plugins to modify
33598
+ componentList: config.categories ? Object.entries(config.categories).reduce(
33599
+ (acc, [categoryName, category]) => {
33600
+ return __spreadProps(__spreadValues({}, acc), {
33601
+ [categoryName]: {
33602
+ title: category.title,
33603
+ components: category.components,
33604
+ expanded: category.defaultExpanded,
33605
+ visible: category.visible
33606
+ }
33607
+ });
33608
+ },
33609
+ {}
33610
+ ) : {}
33611
+ })
33612
+ });
33613
+ });
33614
+ const [appState, dispatch] = (0, import_react28.useReducer)(
32715
33615
  reducer,
32716
33616
  flushZones(initialAppState)
32717
33617
  );
@@ -32722,9 +33622,9 @@ function Puck({
32722
33622
  config,
32723
33623
  dispatch
32724
33624
  );
32725
- const [menuOpen, setMenuOpen] = (0, import_react26.useState)(false);
33625
+ const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
32726
33626
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
32727
- const setItemSelector = (0, import_react26.useCallback)(
33627
+ const setItemSelector = (0, import_react28.useCallback)(
32728
33628
  (newItemSelector) => {
32729
33629
  if (newItemSelector === itemSelector)
32730
33630
  return;
@@ -32737,21 +33637,21 @@ function Puck({
32737
33637
  [itemSelector]
32738
33638
  );
32739
33639
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
32740
- (0, import_react26.useEffect)(() => {
33640
+ (0, import_react28.useEffect)(() => {
32741
33641
  if (onChange)
32742
33642
  onChange(data);
32743
33643
  }, [data]);
32744
33644
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
32745
- const [draggedItem, setDraggedItem] = (0, import_react26.useState)();
33645
+ const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
32746
33646
  const rootProps = data.root.props || data.root;
32747
- (0, import_react26.useEffect)(() => {
33647
+ (0, import_react28.useEffect)(() => {
32748
33648
  if (Object.keys(data.root).length > 0 && !data.root.props) {
32749
33649
  console.error(
32750
33650
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
32751
33651
  );
32752
33652
  }
32753
33653
  }, []);
32754
- const toggleSidebars = (0, import_react26.useCallback)(
33654
+ const toggleSidebars = (0, import_react28.useCallback)(
32755
33655
  (sidebar) => {
32756
33656
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
32757
33657
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -32765,7 +33665,7 @@ function Puck({
32765
33665
  },
32766
33666
  [dispatch, leftSideBarVisible, rightSideBarVisible]
32767
33667
  );
32768
- (0, import_react26.useEffect)(() => {
33668
+ (0, import_react28.useEffect)(() => {
32769
33669
  if (!window.matchMedia("(min-width: 638px)").matches) {
32770
33670
  dispatch({
32771
33671
  type: "setUi",
@@ -32788,59 +33688,54 @@ function Puck({
32788
33688
  window.removeEventListener("resize", handleResize);
32789
33689
  };
32790
33690
  }, []);
32791
- const defaultRender = (0, import_react26.useMemo)(() => {
32792
- const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: children2 });
33691
+ const defaultRender = (0, import_react28.useMemo)(() => {
33692
+ const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
32793
33693
  return PuckDefault;
32794
33694
  }, []);
32795
- const defaultHeaderRender = (0, import_react26.useMemo)(() => {
33695
+ const defaultHeaderRender = (0, import_react28.useMemo)(() => {
32796
33696
  if (renderHeader) {
32797
33697
  console.warn(
32798
33698
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
32799
33699
  );
32800
- const RenderHeader = (_a) => {
32801
- var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
33700
+ const RenderHeader = (_a2) => {
33701
+ var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
32802
33702
  const Comp = renderHeader;
32803
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
33703
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
32804
33704
  };
32805
33705
  return RenderHeader;
32806
33706
  }
32807
33707
  return defaultRender;
32808
33708
  }, [renderHeader]);
32809
- const defaultHeaderActionsRender = (0, import_react26.useMemo)(() => {
33709
+ const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
32810
33710
  if (renderHeaderActions) {
32811
33711
  console.warn(
32812
33712
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
32813
33713
  );
32814
33714
  const RenderHeader = (props) => {
32815
33715
  const Comp = renderHeaderActions;
32816
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
33716
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
32817
33717
  };
32818
33718
  return RenderHeader;
32819
33719
  }
32820
33720
  return defaultRender;
32821
33721
  }, [renderHeader]);
32822
- const loadedOverrides = (0, import_react26.useMemo)(() => {
33722
+ const loadedOverrides = (0, import_react28.useMemo)(() => {
32823
33723
  return loadOverrides({ overrides, plugins });
32824
33724
  }, [plugins]);
32825
- const CustomPuck = (0, import_react26.useMemo)(
33725
+ const CustomPuck = (0, import_react28.useMemo)(
32826
33726
  () => loadedOverrides.puck || defaultRender,
32827
33727
  [loadedOverrides]
32828
33728
  );
32829
- const CustomPreview = (0, import_react26.useMemo)(
32830
- () => loadedOverrides.preview || defaultRender,
32831
- [loadedOverrides]
32832
- );
32833
- const CustomHeader = (0, import_react26.useMemo)(
33729
+ const CustomHeader = (0, import_react28.useMemo)(
32834
33730
  () => loadedOverrides.header || defaultHeaderRender,
32835
33731
  [loadedOverrides]
32836
33732
  );
32837
- const CustomHeaderActions = (0, import_react26.useMemo)(
33733
+ const CustomHeaderActions = (0, import_react28.useMemo)(
32838
33734
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
32839
33735
  [loadedOverrides]
32840
33736
  );
32841
- const disableZoom = children || loadedOverrides.puck ? true : false;
32842
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "Puck", children: [
32843
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33737
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "Puck", children: [
33738
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32844
33739
  AppProvider,
32845
33740
  {
32846
33741
  value: {
@@ -32851,10 +33746,12 @@ function Puck({
32851
33746
  resolveData,
32852
33747
  plugins,
32853
33748
  overrides: loadedOverrides,
32854
- history
33749
+ history,
33750
+ viewports,
33751
+ iframe
32855
33752
  },
32856
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32857
- import_dnd7.DragDropContext,
33753
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33754
+ DragDropContext,
32858
33755
  {
32859
33756
  onDragUpdate: (update) => {
32860
33757
  setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
@@ -32908,7 +33805,7 @@ function Puck({
32908
33805
  });
32909
33806
  }
32910
33807
  },
32911
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33808
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32912
33809
  DropZoneProvider,
32913
33810
  {
32914
33811
  value: {
@@ -32920,77 +33817,75 @@ function Puck({
32920
33817
  draggedItem,
32921
33818
  placeholderStyle,
32922
33819
  mode: "edit",
32923
- areaId: "root",
32924
- disableZoom
33820
+ areaId: "root"
32925
33821
  },
32926
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33822
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
32927
33823
  "div",
32928
33824
  {
32929
- className: getClassName22({
33825
+ className: getClassName25({
32930
33826
  leftSideBarVisible,
32931
33827
  menuOpen,
32932
- rightSideBarVisible,
32933
- disableZoom
33828
+ rightSideBarVisible
32934
33829
  }),
32935
33830
  children: [
32936
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33831
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32937
33832
  CustomHeader,
32938
33833
  {
32939
- actions: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
32940
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
32941
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33834
+ actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33835
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33836
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32942
33837
  Button,
32943
33838
  {
32944
33839
  onClick: () => {
32945
33840
  onPublish && onPublish(data);
32946
33841
  },
32947
- icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Globe, { size: "14px" }),
33842
+ icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
32948
33843
  children: "Publish"
32949
33844
  }
32950
33845
  )
32951
33846
  ] }),
32952
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("header", { className: getClassName22("header"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerInner"), children: [
32953
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerToggle"), children: [
32954
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33847
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
33848
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33849
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32955
33850
  IconButton,
32956
33851
  {
32957
33852
  onClick: () => {
32958
33853
  toggleSidebars("left");
32959
33854
  },
32960
33855
  title: "Toggle left sidebar",
32961
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelLeft, { focusable: "false" })
33856
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
32962
33857
  }
32963
33858
  ) }),
32964
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33859
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32965
33860
  IconButton,
32966
33861
  {
32967
33862
  onClick: () => {
32968
33863
  toggleSidebars("right");
32969
33864
  },
32970
33865
  title: "Toggle right sidebar",
32971
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelRight, { focusable: "false" })
33866
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
32972
33867
  }
32973
33868
  ) })
32974
33869
  ] }),
32975
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Heading, { rank: 2, size: "xs", children: [
33870
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
32976
33871
  headerTitle || rootProps.title || "Page",
32977
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
33872
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
32978
33873
  " ",
32979
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("code", { className: getClassName22("headerPath"), children: headerPath })
33874
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
32980
33875
  ] })
32981
33876
  ] }) }),
32982
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerTools"), children: [
32983
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33877
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
33878
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32984
33879
  IconButton,
32985
33880
  {
32986
33881
  onClick: () => {
32987
33882
  return setMenuOpen(!menuOpen);
32988
33883
  },
32989
33884
  title: "Toggle menu bar",
32990
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { focusable: "false" })
33885
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
32991
33886
  }
32992
33887
  ) }),
32993
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33888
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32994
33889
  MenuBar,
32995
33890
  {
32996
33891
  appState,
@@ -32998,7 +33893,7 @@ function Puck({
32998
33893
  dispatch,
32999
33894
  onPublish,
33000
33895
  menuOpen,
33001
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
33896
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33002
33897
  setMenuOpen
33003
33898
  }
33004
33899
  )
@@ -33006,38 +33901,19 @@ function Puck({
33006
33901
  ] }) })
33007
33902
  }
33008
33903
  ),
33009
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("leftSideBar"), children: [
33010
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Components, {}) }),
33011
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Outline, {}) })
33904
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
33905
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
33906
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
33012
33907
  ] }),
33013
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33014
- "div",
33015
- {
33016
- className: getClassName22("frame"),
33017
- onClick: () => setItemSelector(null),
33018
- children: [
33019
- /* @__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, {}) }) }),
33020
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33021
- "div",
33022
- {
33023
- style: {
33024
- background: "var(--puck-color-grey-10)",
33025
- height: "100%",
33026
- flexGrow: 1
33027
- }
33028
- }
33029
- )
33030
- ]
33031
- }
33032
- ),
33033
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33908
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
33909
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33034
33910
  SidebarSection,
33035
33911
  {
33036
33912
  noPadding: true,
33037
33913
  noBorderTop: true,
33038
33914
  showBreadcrumbs: true,
33039
- title: selectedItem ? selectedItem.type : "Page",
33040
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Fields, {})
33915
+ title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
33916
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
33041
33917
  }
33042
33918
  ) })
33043
33919
  ]
@@ -33049,7 +33925,7 @@ function Puck({
33049
33925
  )
33050
33926
  }
33051
33927
  ),
33052
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "puck-portal-root" })
33928
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { id: "puck-portal-root" })
33053
33929
  ] });
33054
33930
  }
33055
33931
  Puck.Components = Components;
@@ -33059,13 +33935,16 @@ Puck.Preview = Preview;
33059
33935
 
33060
33936
  // components/Render/index.tsx
33061
33937
  init_react_import();
33062
- var import_jsx_runtime30 = require("react/jsx-runtime");
33063
- function Render({ config, data }) {
33938
+ var import_jsx_runtime35 = require("react/jsx-runtime");
33939
+ function Render({
33940
+ config,
33941
+ data
33942
+ }) {
33064
33943
  var _a;
33065
33944
  const rootProps = data.root.props || data.root;
33066
33945
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
33067
33946
  if ((_a = config.root) == null ? void 0 : _a.render) {
33068
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33947
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33069
33948
  config.root.render,
33070
33949
  __spreadProps(__spreadValues({}, rootProps), {
33071
33950
  puck: {
@@ -33074,11 +33953,11 @@ function Render({ config, data }) {
33074
33953
  title,
33075
33954
  editMode: false,
33076
33955
  id: "puck-root",
33077
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId })
33956
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
33078
33957
  })
33079
33958
  ) });
33080
33959
  }
33081
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) });
33960
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
33082
33961
  }
33083
33962
 
33084
33963
  // lib/migrate.ts
@@ -33139,37 +34018,51 @@ function transformProps(data, propTransforms) {
33139
34018
 
33140
34019
  // lib/resolve-all-data.ts
33141
34020
  init_react_import();
33142
- var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
33143
- const dynamicRoot = yield resolveRootData(data, config);
33144
- const { zones = {} } = data;
33145
- const zoneKeys = Object.keys(zones);
33146
- const resolvedZones = {};
33147
- for (let i = 0; i < zoneKeys.length; i++) {
33148
- const zoneKey = zoneKeys[i];
33149
- resolvedZones[zoneKey] = yield resolveAllComponentData(
33150
- zones[zoneKey],
33151
- config,
33152
- onResolveStart,
33153
- onResolveEnd
33154
- );
33155
- }
33156
- return __spreadProps(__spreadValues({}, data), {
33157
- root: dynamicRoot,
33158
- content: yield resolveAllComponentData(
33159
- data.content,
33160
- config,
33161
- onResolveStart,
33162
- onResolveEnd
33163
- ),
33164
- zones: resolvedZones
34021
+ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
34022
+ return __async(this, null, function* () {
34023
+ const dynamicRoot = yield resolveRootData(data, config);
34024
+ const { zones = {} } = data;
34025
+ const zoneKeys = Object.keys(zones);
34026
+ const resolvedZones = {};
34027
+ for (let i = 0; i < zoneKeys.length; i++) {
34028
+ const zoneKey = zoneKeys[i];
34029
+ resolvedZones[zoneKey] = yield resolveAllComponentData(
34030
+ zones[zoneKey],
34031
+ config,
34032
+ onResolveStart,
34033
+ onResolveEnd
34034
+ );
34035
+ }
34036
+ return __spreadProps(__spreadValues({}, data), {
34037
+ root: dynamicRoot,
34038
+ content: yield resolveAllComponentData(
34039
+ data.content,
34040
+ config,
34041
+ onResolveStart,
34042
+ onResolveEnd
34043
+ ),
34044
+ zones: resolvedZones
34045
+ });
33165
34046
  });
33166
- });
34047
+ }
33167
34048
 
33168
34049
  // lib/use-puck.ts
33169
34050
  init_react_import();
33170
34051
  var usePuck = () => {
33171
- const { state: appState, config, dispatch } = useAppContext();
33172
- return { appState, config, dispatch };
34052
+ const {
34053
+ state: appState,
34054
+ config,
34055
+ history,
34056
+ dispatch,
34057
+ selectedItem
34058
+ } = useAppContext();
34059
+ return {
34060
+ appState,
34061
+ config,
34062
+ dispatch,
34063
+ history,
34064
+ selectedItem: selectedItem || null
34065
+ };
33173
34066
  };
33174
34067
  // Annotate the CommonJS export names for ESM import in node:
33175
34068
  0 && (module.exports = {
@@ -33373,6 +34266,14 @@ lucide-react/dist/esm/icons/lock.js:
33373
34266
  * See the LICENSE file in the root directory of this source tree.
33374
34267
  *)
33375
34268
 
34269
+ lucide-react/dist/esm/icons/monitor.js:
34270
+ (**
34271
+ * @license lucide-react v0.298.0 - ISC
34272
+ *
34273
+ * This source code is licensed under the ISC license.
34274
+ * See the LICENSE file in the root directory of this source tree.
34275
+ *)
34276
+
33376
34277
  lucide-react/dist/esm/icons/more-vertical.js:
33377
34278
  (**
33378
34279
  * @license lucide-react v0.298.0 - ISC
@@ -33413,6 +34314,30 @@ lucide-react/dist/esm/icons/search.js:
33413
34314
  * See the LICENSE file in the root directory of this source tree.
33414
34315
  *)
33415
34316
 
34317
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
34318
+ (**
34319
+ * @license lucide-react v0.298.0 - ISC
34320
+ *
34321
+ * This source code is licensed under the ISC license.
34322
+ * See the LICENSE file in the root directory of this source tree.
34323
+ *)
34324
+
34325
+ lucide-react/dist/esm/icons/smartphone.js:
34326
+ (**
34327
+ * @license lucide-react v0.298.0 - ISC
34328
+ *
34329
+ * This source code is licensed under the ISC license.
34330
+ * See the LICENSE file in the root directory of this source tree.
34331
+ *)
34332
+
34333
+ lucide-react/dist/esm/icons/tablet.js:
34334
+ (**
34335
+ * @license lucide-react v0.298.0 - ISC
34336
+ *
34337
+ * This source code is licensed under the ISC license.
34338
+ * See the LICENSE file in the root directory of this source tree.
34339
+ *)
34340
+
33416
34341
  lucide-react/dist/esm/icons/trash.js:
33417
34342
  (**
33418
34343
  * @license lucide-react v0.298.0 - ISC
@@ -33437,6 +34362,22 @@ lucide-react/dist/esm/icons/unlock.js:
33437
34362
  * See the LICENSE file in the root directory of this source tree.
33438
34363
  *)
33439
34364
 
34365
+ lucide-react/dist/esm/icons/zoom-in.js:
34366
+ (**
34367
+ * @license lucide-react v0.298.0 - ISC
34368
+ *
34369
+ * This source code is licensed under the ISC license.
34370
+ * See the LICENSE file in the root directory of this source tree.
34371
+ *)
34372
+
34373
+ lucide-react/dist/esm/icons/zoom-out.js:
34374
+ (**
34375
+ * @license lucide-react v0.298.0 - ISC
34376
+ *
34377
+ * This source code is licensed under the ISC license.
34378
+ * See the LICENSE file in the root directory of this source tree.
34379
+ *)
34380
+
33440
34381
  lucide-react/dist/esm/lucide-react.js:
33441
34382
  (**
33442
34383
  * @license lucide-react v0.298.0 - ISC