@measured/puck 0.10.0-canary.3fe6284 → 0.10.0-canary.6a9145c

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -327,7 +327,7 @@ var require_react_is_development = __commonJS({
327
327
  var ContextProvider = REACT_PROVIDER_TYPE;
328
328
  var Element = REACT_ELEMENT_TYPE;
329
329
  var ForwardRef = REACT_FORWARD_REF_TYPE;
330
- var Fragment9 = REACT_FRAGMENT_TYPE;
330
+ var Fragment11 = REACT_FRAGMENT_TYPE;
331
331
  var Lazy = REACT_LAZY_TYPE;
332
332
  var Memo = REACT_MEMO_TYPE;
333
333
  var Portal = REACT_PORTAL_TYPE;
@@ -386,7 +386,7 @@ var require_react_is_development = __commonJS({
386
386
  exports.ContextProvider = ContextProvider;
387
387
  exports.Element = Element;
388
388
  exports.ForwardRef = ForwardRef;
389
- exports.Fragment = Fragment9;
389
+ exports.Fragment = Fragment11;
390
390
  exports.Lazy = Lazy;
391
391
  exports.Memo = Memo;
392
392
  exports.Portal = Portal;
@@ -760,7 +760,7 @@ var require_factoryWithTypeCheckers = __commonJS({
760
760
  function validate(props, propName, componentName, location, propFullName) {
761
761
  if (!(props[propName] instanceof expectedClass)) {
762
762
  var expectedClassName = expectedClass.name || ANONYMOUS;
763
- var actualClassName = getClassName11(props[propName]);
763
+ var actualClassName = getClassName18(props[propName]);
764
764
  return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
765
765
  }
766
766
  return null;
@@ -1012,7 +1012,7 @@ var require_factoryWithTypeCheckers = __commonJS({
1012
1012
  return type;
1013
1013
  }
1014
1014
  }
1015
- function getClassName11(propValue) {
1015
+ function getClassName18(propValue) {
1016
1016
  if (!propValue.constructor || !propValue.constructor.name) {
1017
1017
  return ANONYMOUS;
1018
1018
  }
@@ -1214,11 +1214,11 @@ var Button = ({
1214
1214
 
1215
1215
  // components/DropZone/index.tsx
1216
1216
  init_react_import();
1217
- var import_react21 = require("react");
1217
+ var import_react22 = require("react");
1218
1218
 
1219
1219
  // components/DraggableComponent/index.tsx
1220
1220
  init_react_import();
1221
- var import_react18 = require("react");
1221
+ var import_react19 = require("react");
1222
1222
  var import_react_beautiful_dnd = require("react-beautiful-dnd");
1223
1223
 
1224
1224
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
@@ -2130,7 +2130,7 @@ List.propTypes = {
2130
2130
  List.displayName = "List";
2131
2131
  var list_default = List;
2132
2132
 
2133
- // ../../node_modules/react-feather/dist/icons/sidebar.js
2133
+ // ../../node_modules/react-feather/dist/icons/plus.js
2134
2134
  init_react_import();
2135
2135
  var import_react14 = __toESM(require("react"));
2136
2136
  var import_prop_types12 = __toESM(require_prop_types());
@@ -2180,7 +2180,7 @@ function _objectWithoutPropertiesLoose12(source, excluded) {
2180
2180
  }
2181
2181
  return target;
2182
2182
  }
2183
- var Sidebar = (0, import_react14.forwardRef)(function(_ref, ref) {
2183
+ var Plus = (0, import_react14.forwardRef)(function(_ref, ref) {
2184
2184
  var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties12(_ref, ["color", "size"]);
2185
2185
  return /* @__PURE__ */ import_react14.default.createElement("svg", _extends12({
2186
2186
  ref,
@@ -2193,28 +2193,26 @@ var Sidebar = (0, import_react14.forwardRef)(function(_ref, ref) {
2193
2193
  strokeWidth: "2",
2194
2194
  strokeLinecap: "round",
2195
2195
  strokeLinejoin: "round"
2196
- }, rest), /* @__PURE__ */ import_react14.default.createElement("rect", {
2197
- x: "3",
2198
- y: "3",
2199
- width: "18",
2200
- height: "18",
2201
- rx: "2",
2202
- ry: "2"
2196
+ }, rest), /* @__PURE__ */ import_react14.default.createElement("line", {
2197
+ x1: "12",
2198
+ y1: "5",
2199
+ x2: "12",
2200
+ y2: "19"
2203
2201
  }), /* @__PURE__ */ import_react14.default.createElement("line", {
2204
- x1: "9",
2205
- y1: "3",
2206
- x2: "9",
2207
- y2: "21"
2202
+ x1: "5",
2203
+ y1: "12",
2204
+ x2: "19",
2205
+ y2: "12"
2208
2206
  }));
2209
2207
  });
2210
- Sidebar.propTypes = {
2208
+ Plus.propTypes = {
2211
2209
  color: import_prop_types12.default.string,
2212
2210
  size: import_prop_types12.default.oneOfType([import_prop_types12.default.string, import_prop_types12.default.number])
2213
2211
  };
2214
- Sidebar.displayName = "Sidebar";
2215
- var sidebar_default = Sidebar;
2212
+ Plus.displayName = "Plus";
2213
+ var plus_default = Plus;
2216
2214
 
2217
- // ../../node_modules/react-feather/dist/icons/trash.js
2215
+ // ../../node_modules/react-feather/dist/icons/sidebar.js
2218
2216
  init_react_import();
2219
2217
  var import_react15 = __toESM(require("react"));
2220
2218
  var import_prop_types13 = __toESM(require_prop_types());
@@ -2264,7 +2262,7 @@ function _objectWithoutPropertiesLoose13(source, excluded) {
2264
2262
  }
2265
2263
  return target;
2266
2264
  }
2267
- var Trash = (0, import_react15.forwardRef)(function(_ref, ref) {
2265
+ var Sidebar = (0, import_react15.forwardRef)(function(_ref, ref) {
2268
2266
  var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties13(_ref, ["color", "size"]);
2269
2267
  return /* @__PURE__ */ import_react15.default.createElement("svg", _extends13({
2270
2268
  ref,
@@ -2277,20 +2275,28 @@ var Trash = (0, import_react15.forwardRef)(function(_ref, ref) {
2277
2275
  strokeWidth: "2",
2278
2276
  strokeLinecap: "round",
2279
2277
  strokeLinejoin: "round"
2280
- }, rest), /* @__PURE__ */ import_react15.default.createElement("polyline", {
2281
- points: "3 6 5 6 21 6"
2282
- }), /* @__PURE__ */ import_react15.default.createElement("path", {
2283
- d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
2278
+ }, rest), /* @__PURE__ */ import_react15.default.createElement("rect", {
2279
+ x: "3",
2280
+ y: "3",
2281
+ width: "18",
2282
+ height: "18",
2283
+ rx: "2",
2284
+ ry: "2"
2285
+ }), /* @__PURE__ */ import_react15.default.createElement("line", {
2286
+ x1: "9",
2287
+ y1: "3",
2288
+ x2: "9",
2289
+ y2: "21"
2284
2290
  }));
2285
2291
  });
2286
- Trash.propTypes = {
2292
+ Sidebar.propTypes = {
2287
2293
  color: import_prop_types13.default.string,
2288
2294
  size: import_prop_types13.default.oneOfType([import_prop_types13.default.string, import_prop_types13.default.number])
2289
2295
  };
2290
- Trash.displayName = "Trash";
2291
- var trash_default = Trash;
2296
+ Sidebar.displayName = "Sidebar";
2297
+ var sidebar_default = Sidebar;
2292
2298
 
2293
- // ../../node_modules/react-feather/dist/icons/type.js
2299
+ // ../../node_modules/react-feather/dist/icons/trash.js
2294
2300
  init_react_import();
2295
2301
  var import_react16 = __toESM(require("react"));
2296
2302
  var import_prop_types14 = __toESM(require_prop_types());
@@ -2340,7 +2346,7 @@ function _objectWithoutPropertiesLoose14(source, excluded) {
2340
2346
  }
2341
2347
  return target;
2342
2348
  }
2343
- var Type = (0, import_react16.forwardRef)(function(_ref, ref) {
2349
+ var Trash = (0, import_react16.forwardRef)(function(_ref, ref) {
2344
2350
  var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties14(_ref, ["color", "size"]);
2345
2351
  return /* @__PURE__ */ import_react16.default.createElement("svg", _extends14({
2346
2352
  ref,
@@ -2354,13 +2360,89 @@ var Type = (0, import_react16.forwardRef)(function(_ref, ref) {
2354
2360
  strokeLinecap: "round",
2355
2361
  strokeLinejoin: "round"
2356
2362
  }, rest), /* @__PURE__ */ import_react16.default.createElement("polyline", {
2363
+ points: "3 6 5 6 21 6"
2364
+ }), /* @__PURE__ */ import_react16.default.createElement("path", {
2365
+ d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
2366
+ }));
2367
+ });
2368
+ Trash.propTypes = {
2369
+ color: import_prop_types14.default.string,
2370
+ size: import_prop_types14.default.oneOfType([import_prop_types14.default.string, import_prop_types14.default.number])
2371
+ };
2372
+ Trash.displayName = "Trash";
2373
+ var trash_default = Trash;
2374
+
2375
+ // ../../node_modules/react-feather/dist/icons/type.js
2376
+ init_react_import();
2377
+ var import_react17 = __toESM(require("react"));
2378
+ var import_prop_types15 = __toESM(require_prop_types());
2379
+ function _extends15() {
2380
+ _extends15 = Object.assign || function(target) {
2381
+ for (var i = 1; i < arguments.length; i++) {
2382
+ var source = arguments[i];
2383
+ for (var key in source) {
2384
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2385
+ target[key] = source[key];
2386
+ }
2387
+ }
2388
+ }
2389
+ return target;
2390
+ };
2391
+ return _extends15.apply(this, arguments);
2392
+ }
2393
+ function _objectWithoutProperties15(source, excluded) {
2394
+ if (source == null)
2395
+ return {};
2396
+ var target = _objectWithoutPropertiesLoose15(source, excluded);
2397
+ var key, i;
2398
+ if (Object.getOwnPropertySymbols) {
2399
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2400
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
2401
+ key = sourceSymbolKeys[i];
2402
+ if (excluded.indexOf(key) >= 0)
2403
+ continue;
2404
+ if (!Object.prototype.propertyIsEnumerable.call(source, key))
2405
+ continue;
2406
+ target[key] = source[key];
2407
+ }
2408
+ }
2409
+ return target;
2410
+ }
2411
+ function _objectWithoutPropertiesLoose15(source, excluded) {
2412
+ if (source == null)
2413
+ return {};
2414
+ var target = {};
2415
+ var sourceKeys = Object.keys(source);
2416
+ var key, i;
2417
+ for (i = 0; i < sourceKeys.length; i++) {
2418
+ key = sourceKeys[i];
2419
+ if (excluded.indexOf(key) >= 0)
2420
+ continue;
2421
+ target[key] = source[key];
2422
+ }
2423
+ return target;
2424
+ }
2425
+ var Type = (0, import_react17.forwardRef)(function(_ref, ref) {
2426
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties15(_ref, ["color", "size"]);
2427
+ return /* @__PURE__ */ import_react17.default.createElement("svg", _extends15({
2428
+ ref,
2429
+ xmlns: "http://www.w3.org/2000/svg",
2430
+ width: size,
2431
+ height: size,
2432
+ viewBox: "0 0 24 24",
2433
+ fill: "none",
2434
+ stroke: color,
2435
+ strokeWidth: "2",
2436
+ strokeLinecap: "round",
2437
+ strokeLinejoin: "round"
2438
+ }, rest), /* @__PURE__ */ import_react17.default.createElement("polyline", {
2357
2439
  points: "4 7 4 4 20 4 20 7"
2358
- }), /* @__PURE__ */ import_react16.default.createElement("line", {
2440
+ }), /* @__PURE__ */ import_react17.default.createElement("line", {
2359
2441
  x1: "9",
2360
2442
  y1: "20",
2361
2443
  x2: "15",
2362
2444
  y2: "20"
2363
- }), /* @__PURE__ */ import_react16.default.createElement("line", {
2445
+ }), /* @__PURE__ */ import_react17.default.createElement("line", {
2364
2446
  x1: "12",
2365
2447
  y1: "4",
2366
2448
  x2: "12",
@@ -2368,18 +2450,18 @@ var Type = (0, import_react16.forwardRef)(function(_ref, ref) {
2368
2450
  }));
2369
2451
  });
2370
2452
  Type.propTypes = {
2371
- color: import_prop_types14.default.string,
2372
- size: import_prop_types14.default.oneOfType([import_prop_types14.default.string, import_prop_types14.default.number])
2453
+ color: import_prop_types15.default.string,
2454
+ size: import_prop_types15.default.oneOfType([import_prop_types15.default.string, import_prop_types15.default.number])
2373
2455
  };
2374
2456
  Type.displayName = "Type";
2375
2457
  var type_default = Type;
2376
2458
 
2377
2459
  // lib/use-modifier-held.ts
2378
2460
  init_react_import();
2379
- var import_react17 = require("react");
2461
+ var import_react18 = require("react");
2380
2462
  var useModifierHeld = (modifier) => {
2381
- const [modifierHeld, setModifierHeld] = (0, import_react17.useState)(false);
2382
- (0, import_react17.useEffect)(() => {
2463
+ const [modifierHeld, setModifierHeld] = (0, import_react18.useState)(false);
2464
+ (0, import_react18.useEffect)(() => {
2383
2465
  function downHandler({ key }) {
2384
2466
  if (key === modifier) {
2385
2467
  setModifierHeld(true);
@@ -2423,7 +2505,7 @@ var DraggableComponent = ({
2423
2505
  style
2424
2506
  }) => {
2425
2507
  const isModifierHeld = useModifierHeld("Alt");
2426
- (0, import_react18.useEffect)(onMount, []);
2508
+ (0, import_react19.useEffect)(onMount, []);
2427
2509
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2428
2510
  import_react_beautiful_dnd.Draggable,
2429
2511
  {
@@ -2467,13 +2549,13 @@ var DraggableComponent = ({
2467
2549
 
2468
2550
  // components/DroppableStrictMode/index.tsx
2469
2551
  init_react_import();
2470
- var import_react19 = require("react");
2552
+ var import_react20 = require("react");
2471
2553
  var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
2472
2554
  var import_jsx_runtime3 = require("react/jsx-runtime");
2473
2555
  var DroppableStrictMode = (_a) => {
2474
2556
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
2475
- const [enabled, setEnabled] = (0, import_react19.useState)(false);
2476
- (0, import_react19.useEffect)(() => {
2557
+ const [enabled, setEnabled] = (0, import_react20.useState)(false);
2558
+ (0, import_react20.useEffect)(() => {
2477
2559
  const animation = requestAnimationFrame(() => setEnabled(true));
2478
2560
  return () => {
2479
2561
  cancelAnimationFrame(animation);
@@ -2552,7 +2634,7 @@ var styles_module_default2 = { "DropZone": "_DropZone_ou0z5_1", "DropZone-conten
2552
2634
 
2553
2635
  // components/DropZone/context.tsx
2554
2636
  init_react_import();
2555
- var import_react20 = require("react");
2637
+ var import_react21 = require("react");
2556
2638
  var import_use_debounce = require("use-debounce");
2557
2639
 
2558
2640
  // lib/get-zone-id.ts
@@ -2564,34 +2646,34 @@ var getZoneId = (zoneCompound) => {
2564
2646
  if (zoneCompound && zoneCompound.indexOf(":") > -1) {
2565
2647
  return zoneCompound.split(":");
2566
2648
  }
2567
- return ["root", zoneCompound];
2649
+ return [rootDroppableId, zoneCompound];
2568
2650
  };
2569
2651
 
2570
2652
  // components/DropZone/context.tsx
2571
2653
  var import_jsx_runtime4 = require("react/jsx-runtime");
2572
- var dropZoneContext = (0, import_react20.createContext)(null);
2654
+ var dropZoneContext = (0, import_react21.createContext)(null);
2573
2655
  var DropZoneProvider = ({
2574
2656
  children,
2575
2657
  value
2576
2658
  }) => {
2577
- const [hoveringArea, setHoveringArea] = (0, import_react20.useState)(null);
2578
- const [hoveringZone, setHoveringZone] = (0, import_react20.useState)(
2659
+ const [hoveringArea, setHoveringArea] = (0, import_react21.useState)(null);
2660
+ const [hoveringZone, setHoveringZone] = (0, import_react21.useState)(
2579
2661
  rootDroppableId
2580
2662
  );
2581
- const [hoveringComponent, setHoveringComponent] = (0, import_react20.useState)();
2663
+ const [hoveringComponent, setHoveringComponent] = (0, import_react21.useState)();
2582
2664
  const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
2583
- const [areasWithZones, setAreasWithZones] = (0, import_react20.useState)(
2665
+ const [areasWithZones, setAreasWithZones] = (0, import_react21.useState)(
2584
2666
  {}
2585
2667
  );
2586
- const [activeZones, setActiveZones] = (0, import_react20.useState)({});
2668
+ const [activeZones, setActiveZones] = (0, import_react21.useState)({});
2587
2669
  const { dispatch = null } = value ? value : {};
2588
- const registerZoneArea = (0, import_react20.useCallback)(
2670
+ const registerZoneArea = (0, import_react21.useCallback)(
2589
2671
  (area) => {
2590
2672
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
2591
2673
  },
2592
2674
  [setAreasWithZones]
2593
2675
  );
2594
- const registerZone = (0, import_react20.useCallback)(
2676
+ const registerZone = (0, import_react21.useCallback)(
2595
2677
  (zoneCompound) => {
2596
2678
  if (!dispatch) {
2597
2679
  return;
@@ -2604,7 +2686,7 @@ var DropZoneProvider = ({
2604
2686
  },
2605
2687
  [setActiveZones, dispatch]
2606
2688
  );
2607
- const unregisterZone = (0, import_react20.useCallback)(
2689
+ const unregisterZone = (0, import_react21.useCallback)(
2608
2690
  (zoneCompound) => {
2609
2691
  if (!dispatch) {
2610
2692
  return;
@@ -2619,8 +2701,8 @@ var DropZoneProvider = ({
2619
2701
  },
2620
2702
  [setActiveZones, dispatch]
2621
2703
  );
2622
- const [pathData, setPathData] = (0, import_react20.useState)();
2623
- const registerPath = (0, import_react20.useCallback)(
2704
+ const [pathData, setPathData] = (0, import_react21.useState)();
2705
+ const registerPath = (0, import_react21.useCallback)(
2624
2706
  (selector) => {
2625
2707
  if (!(value == null ? void 0 : value.data)) {
2626
2708
  return;
@@ -2631,15 +2713,15 @@ var DropZoneProvider = ({
2631
2713
  }
2632
2714
  const [area] = getZoneId(selector.zone);
2633
2715
  setPathData((latestPathData = {}) => {
2634
- const pathData2 = latestPathData[area] || [];
2716
+ const parentPathData = latestPathData[area] || { path: [] };
2635
2717
  return __spreadProps(__spreadValues({}, latestPathData), {
2636
- [item.props.id]: [
2637
- ...pathData2,
2638
- {
2639
- selector,
2640
- label: item.type
2641
- }
2642
- ]
2718
+ [item.props.id]: {
2719
+ path: [
2720
+ ...parentPathData.path,
2721
+ ...selector.zone ? [selector.zone] : []
2722
+ ],
2723
+ label: item.type
2724
+ }
2643
2725
  });
2644
2726
  });
2645
2727
  },
@@ -2673,7 +2755,7 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
2673
2755
  var getClassName3 = get_class_name_factory_default("DropZone", styles_module_default2);
2674
2756
  function DropZoneEdit({ zone, style }) {
2675
2757
  var _a;
2676
- const ctx = (0, import_react21.useContext)(dropZoneContext);
2758
+ const ctx = (0, import_react22.useContext)(dropZoneContext);
2677
2759
  const {
2678
2760
  // These all need setting via context
2679
2761
  data,
@@ -2690,12 +2772,12 @@ function DropZoneEdit({ zone, style }) {
2690
2772
  } = ctx || {};
2691
2773
  let content = data.content || [];
2692
2774
  let zoneCompound = rootDroppableId;
2693
- (0, import_react21.useEffect)(() => {
2775
+ (0, import_react22.useEffect)(() => {
2694
2776
  if (areaId && registerZoneArea) {
2695
2777
  registerZoneArea(areaId);
2696
2778
  }
2697
2779
  }, [areaId]);
2698
- (0, import_react21.useEffect)(() => {
2780
+ (0, import_react22.useEffect)(() => {
2699
2781
  if (ctx == null ? void 0 : ctx.registerZone) {
2700
2782
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
2701
2783
  }
@@ -2907,7 +2989,7 @@ function DropZoneEdit({ zone, style }) {
2907
2989
  );
2908
2990
  }
2909
2991
  function DropZoneRender({ zone }) {
2910
- const ctx = (0, import_react21.useContext)(dropZoneContext);
2992
+ const ctx = (0, import_react22.useContext)(dropZoneContext);
2911
2993
  const { data, areaId = "root", config } = ctx || {};
2912
2994
  let zoneCompound = rootDroppableId;
2913
2995
  let content = (data == null ? void 0 : data.content) || [];
@@ -2934,7 +3016,7 @@ function DropZoneRender({ zone }) {
2934
3016
  }) });
2935
3017
  }
2936
3018
  function DropZone(props) {
2937
- const ctx = (0, import_react21.useContext)(dropZoneContext);
3019
+ const ctx = (0, import_react22.useContext)(dropZoneContext);
2938
3020
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
2939
3021
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DropZoneEdit, __spreadValues({}, props));
2940
3022
  }
@@ -2946,7 +3028,7 @@ init_react_import();
2946
3028
 
2947
3029
  // components/IconButton/IconButton.tsx
2948
3030
  init_react_import();
2949
- var import_react22 = require("react");
3031
+ var import_react23 = require("react");
2950
3032
 
2951
3033
  // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
2952
3034
  init_react_import();
@@ -2968,7 +3050,7 @@ var IconButton = ({
2968
3050
  fullWidth,
2969
3051
  title
2970
3052
  }) => {
2971
- const [loading, setLoading] = (0, import_react22.useState)(false);
3053
+ const [loading, setLoading] = (0, import_react23.useState)(false);
2972
3054
  const ElementType = href ? "a" : "button";
2973
3055
  const el = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
2974
3056
  ElementType,
@@ -3008,38 +3090,377 @@ var IconButton = ({
3008
3090
 
3009
3091
  // components/Puck/index.tsx
3010
3092
  init_react_import();
3011
- var import_react28 = require("react");
3012
- var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
3093
+ var import_react32 = require("react");
3094
+ var import_react_beautiful_dnd5 = require("react-beautiful-dnd");
3013
3095
 
3014
3096
  // components/InputOrGroup/index.tsx
3015
3097
  init_react_import();
3016
3098
 
3099
+ // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
3100
+ init_react_import();
3101
+ var styles_module_default3 = { "Input": "_Input_nkpu6_1", "Input-label": "_Input-label_nkpu6_27", "Input-labelIcon": "_Input-labelIcon_nkpu6_34", "Input-input": "_Input-input_nkpu6_39", "Input--readOnly": "_Input--readOnly_nkpu6_60", "Input-radioGroupItems": "_Input-radioGroupItems_nkpu6_69", "Input-radio": "_Input-radio_nkpu6_69", "Input-radioInner": "_Input-radioInner_nkpu6_86", "Input-radioInput": "_Input-radioInput_nkpu6_98" };
3102
+
3103
+ // components/InputOrGroup/fields/index.tsx
3104
+ init_react_import();
3105
+
3106
+ // components/InputOrGroup/fields/ArrayField/index.tsx
3107
+ init_react_import();
3108
+
3109
+ // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
3110
+ init_react_import();
3111
+ var styles_module_default4 = { "ArrayField": "_ArrayField_zp334_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_zp334_13", "ArrayField-addButton": "_ArrayField-addButton_zp334_17", "ArrayField--hasItems": "_ArrayField--hasItems_zp334_31", "ArrayFieldItem": "_ArrayFieldItem_zp334_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_zp334_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_zp334_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_zp334_72", "ArrayFieldItem-body": "_ArrayFieldItem-body_zp334_104", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_zp334_112", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_zp334_119", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_zp334_125", "ArrayFieldItem-action": "_ArrayFieldItem-action_zp334_125" };
3112
+
3113
+ // components/InputOrGroup/fields/ArrayField/index.tsx
3114
+ var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
3115
+
3116
+ // components/Draggable/index.tsx
3117
+ init_react_import();
3118
+ var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
3119
+ var import_jsx_runtime7 = require("react/jsx-runtime");
3120
+ var Draggable2 = ({
3121
+ className,
3122
+ children,
3123
+ id,
3124
+ index,
3125
+ showShadow,
3126
+ disableAnimations = false
3127
+ }) => {
3128
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_beautiful_dnd3.Draggable, { draggableId: id, index, children: (provided, snapshot) => {
3129
+ var _a;
3130
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3131
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3132
+ "div",
3133
+ __spreadProps(__spreadValues(__spreadValues({
3134
+ className: className && className(provided, snapshot),
3135
+ ref: provided.innerRef
3136
+ }, provided.draggableProps), provided.dragHandleProps), {
3137
+ style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
3138
+ transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
3139
+ }),
3140
+ children: children(provided, snapshot)
3141
+ })
3142
+ ),
3143
+ showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3144
+ "div",
3145
+ {
3146
+ className: className && className(provided, snapshot),
3147
+ style: { transform: "none !important" },
3148
+ children: children(provided, snapshot)
3149
+ }
3150
+ )
3151
+ ] });
3152
+ } });
3153
+ };
3154
+
3155
+ // lib/generate-id.ts
3156
+ init_react_import();
3157
+ var import_crypto = require("crypto");
3158
+ var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toString("hex")}`;
3159
+
3160
+ // components/InputOrGroup/fields/ArrayField/index.tsx
3161
+ var import_react25 = require("react");
3162
+
3163
+ // components/DragIcon/index.tsx
3164
+ init_react_import();
3165
+
3166
+ // css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
3167
+ init_react_import();
3168
+ var styles_module_default5 = { "DragIcon": "_DragIcon_o29on_1" };
3169
+
3170
+ // components/DragIcon/index.tsx
3171
+ var import_jsx_runtime8 = require("react/jsx-runtime");
3172
+ var getClassName5 = get_class_name_factory_default("DragIcon", styles_module_default5);
3173
+ var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName5(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.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" }) }) });
3174
+
3175
+ // components/Puck/context.tsx
3176
+ init_react_import();
3177
+ var import_react24 = require("react");
3178
+ var defaultAppData = {
3179
+ data: { content: [], root: { title: "" } },
3180
+ state: {
3181
+ leftSideBarVisible: true,
3182
+ arrayState: {}
3183
+ }
3184
+ };
3185
+ var appContext = (0, import_react24.createContext)({
3186
+ appData: defaultAppData,
3187
+ dispatch: () => null
3188
+ });
3189
+ var AppProvider = appContext.Provider;
3190
+ var useAppContext = () => {
3191
+ const mainContext = (0, import_react24.useContext)(appContext);
3192
+ const selectedItem = mainContext.appData.state.itemSelector ? getItem(mainContext.appData.state.itemSelector, mainContext.appData.data) : void 0;
3193
+ return __spreadProps(__spreadValues({}, mainContext), {
3194
+ // Helpers
3195
+ selectedItem,
3196
+ setState: (state, recordHistory) => {
3197
+ return mainContext.dispatch({
3198
+ type: "setState",
3199
+ state,
3200
+ recordHistory
3201
+ });
3202
+ }
3203
+ });
3204
+ };
3205
+
3206
+ // components/InputOrGroup/fields/ArrayField/index.tsx
3207
+ var import_jsx_runtime9 = require("react/jsx-runtime");
3208
+ var getClassNameInput = get_class_name_factory_default("Input", styles_module_default3);
3209
+ var getClassName6 = get_class_name_factory_default("ArrayField", styles_module_default4);
3210
+ var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default4);
3211
+ var ArrayField = ({
3212
+ field,
3213
+ onChange,
3214
+ value,
3215
+ name,
3216
+ label
3217
+ }) => {
3218
+ const [arrayFieldId] = (0, import_react25.useState)(generateId("ArrayField"));
3219
+ const { appData, setState } = useAppContext();
3220
+ const arrayState = appData.state.arrayState[arrayFieldId] || {
3221
+ items: Array.from(value).map((v) => ({
3222
+ _arrayId: generateId("ArrayItem"),
3223
+ data: v
3224
+ })),
3225
+ openId: ""
3226
+ };
3227
+ const setArrayState = (0, import_react25.useCallback)(
3228
+ (newArrayState, recordHistory = false) => {
3229
+ setState(
3230
+ {
3231
+ arrayState: __spreadProps(__spreadValues({}, appData.state.arrayState), {
3232
+ [arrayFieldId]: __spreadValues(__spreadValues({}, arrayState), newArrayState)
3233
+ })
3234
+ },
3235
+ recordHistory
3236
+ );
3237
+ },
3238
+ [arrayState]
3239
+ );
3240
+ (0, import_react25.useEffect)(() => {
3241
+ const newItems = Array.from(value).map((item, idx) => {
3242
+ var _a;
3243
+ return {
3244
+ _arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || generateId("ArrayItem"),
3245
+ data: item
3246
+ };
3247
+ });
3248
+ setArrayState({ items: newItems });
3249
+ }, [value]);
3250
+ if (!field.arrayFields) {
3251
+ return null;
3252
+ }
3253
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameInput(), children: [
3254
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("b", { className: getClassNameInput("label"), children: [
3255
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameInput("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(list_default, { size: 16 }) }),
3256
+ label || name
3257
+ ] }),
3258
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3259
+ import_react_beautiful_dnd4.DragDropContext,
3260
+ {
3261
+ onDragEnd: (event) => {
3262
+ var _a;
3263
+ if (event.destination) {
3264
+ const newValue = reorder(
3265
+ arrayState.items,
3266
+ event.source.index,
3267
+ (_a = event.destination) == null ? void 0 : _a.index
3268
+ );
3269
+ setArrayState(__spreadProps(__spreadValues({}, arrayState), { items: newValue }), false);
3270
+ onChange(newValue.map(({ data }) => data));
3271
+ }
3272
+ },
3273
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DroppableStrictMode_default, { droppableId: "array", children: (provided, snapshot) => {
3274
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3275
+ "div",
3276
+ __spreadProps(__spreadValues({}, provided.droppableProps), {
3277
+ ref: provided.innerRef,
3278
+ className: getClassName6({
3279
+ isDraggingFrom: !!snapshot.draggingFromThisWith,
3280
+ hasItems: value.length > 0
3281
+ }),
3282
+ children: [
3283
+ Array.isArray(value) && value.length > 0 ? arrayState.items.map(({ _arrayId, data }, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3284
+ Draggable2,
3285
+ {
3286
+ id: _arrayId,
3287
+ index: i,
3288
+ className: (_, snapshot2) => getClassNameItem({
3289
+ isExpanded: arrayState.openId === _arrayId,
3290
+ isDragging: snapshot2.isDragging
3291
+ }),
3292
+ children: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
3293
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3294
+ "div",
3295
+ {
3296
+ onClick: () => {
3297
+ if (arrayState.openId === _arrayId) {
3298
+ setArrayState({
3299
+ openId: ""
3300
+ });
3301
+ } else {
3302
+ setArrayState({
3303
+ openId: _arrayId
3304
+ });
3305
+ }
3306
+ },
3307
+ className: getClassNameItem("summary"),
3308
+ children: [
3309
+ field.getItemSummary ? field.getItemSummary(data, i) : `Item #${i}`,
3310
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("rhs"), children: [
3311
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3312
+ IconButton,
3313
+ {
3314
+ onClick: () => {
3315
+ const existingValue = [
3316
+ ...value || []
3317
+ ];
3318
+ const existingItems = [
3319
+ ...arrayState.items || []
3320
+ ];
3321
+ existingValue.splice(i, 1);
3322
+ existingItems.splice(i, 1);
3323
+ setArrayState(
3324
+ { items: existingItems },
3325
+ true
3326
+ );
3327
+ onChange(existingValue);
3328
+ },
3329
+ title: "Delete",
3330
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(trash_default, { size: 16 })
3331
+ }
3332
+ ) }) }),
3333
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DragIcon, {}) })
3334
+ ] })
3335
+ ]
3336
+ }
3337
+ ),
3338
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3339
+ "fieldset",
3340
+ {
3341
+ className: getClassNameItem("fieldset"),
3342
+ children: Object.keys(field.arrayFields).map(
3343
+ (fieldName) => {
3344
+ const subField = field.arrayFields[fieldName];
3345
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3346
+ InputOrGroup,
3347
+ {
3348
+ name: `${name}_${i}_${fieldName}`,
3349
+ label: subField.label || fieldName,
3350
+ field: subField,
3351
+ value: data[fieldName],
3352
+ onChange: (val) => onChange(
3353
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
3354
+ [fieldName]: val
3355
+ }))
3356
+ )
3357
+ },
3358
+ `${name}_${i}_${fieldName}`
3359
+ );
3360
+ }
3361
+ )
3362
+ }
3363
+ ) })
3364
+ ] })
3365
+ },
3366
+ _arrayId
3367
+ )) : null,
3368
+ provided.placeholder,
3369
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3370
+ "button",
3371
+ {
3372
+ className: getClassName6("addButton"),
3373
+ onClick: () => {
3374
+ const existingValue = value || [];
3375
+ onChange([...existingValue, field.defaultItemProps || {}]);
3376
+ },
3377
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(plus_default, { size: "21" })
3378
+ }
3379
+ )
3380
+ ]
3381
+ })
3382
+ );
3383
+ } })
3384
+ }
3385
+ )
3386
+ ] });
3387
+ };
3388
+
3389
+ // components/InputOrGroup/fields/DefaultField/index.tsx
3390
+ init_react_import();
3391
+ var import_jsx_runtime10 = require("react/jsx-runtime");
3392
+ var getClassName7 = get_class_name_factory_default("Input", styles_module_default3);
3393
+ var DefaultField = ({
3394
+ field,
3395
+ onChange,
3396
+ readOnly,
3397
+ value,
3398
+ name,
3399
+ label
3400
+ }) => {
3401
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: getClassName7({ readOnly }), children: [
3402
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName7("label"), children: [
3403
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName7("labelIcon"), children: [
3404
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(type_default, { size: 16 }),
3405
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(hash_default, { size: 16 })
3406
+ ] }),
3407
+ label || name
3408
+ ] }),
3409
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3410
+ "input",
3411
+ {
3412
+ className: getClassName7("input"),
3413
+ autoComplete: "off",
3414
+ type: field.type,
3415
+ name,
3416
+ value: typeof value === "undefined" ? "" : value,
3417
+ onChange: (e) => {
3418
+ if (field.type === "number") {
3419
+ onChange(Number(e.currentTarget.value));
3420
+ } else {
3421
+ onChange(e.currentTarget.value);
3422
+ }
3423
+ },
3424
+ readOnly
3425
+ }
3426
+ )
3427
+ ] });
3428
+ };
3429
+
3430
+ // components/InputOrGroup/fields/ExternalField/index.tsx
3431
+ init_react_import();
3432
+
3017
3433
  // components/ExternalInput/index.tsx
3018
3434
  init_react_import();
3019
- var import_react23 = require("react");
3435
+ var import_react26 = require("react");
3020
3436
 
3021
3437
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
3022
3438
  init_react_import();
3023
- var styles_module_default3 = { "ExternalInput": "_ExternalInput_l4bks_1", "ExternalInput-actions": "_ExternalInput-actions_l4bks_5", "ExternalInput-button": "_ExternalInput-button_l4bks_9", "ExternalInput-detachButton": "_ExternalInput-detachButton_l4bks_28", "ExternalInput--hasData": "_ExternalInput--hasData_l4bks_35", "ExternalInput-modal": "_ExternalInput-modal_l4bks_55", "ExternalInput--modalVisible": "_ExternalInput--modalVisible_l4bks_69", "ExternalInput-modalInner": "_ExternalInput-modalInner_l4bks_73", "ExternalInput-modalHeading": "_ExternalInput-modalHeading_l4bks_84", "ExternalInput-modalTableWrapper": "_ExternalInput-modalTableWrapper_l4bks_89" };
3439
+ var styles_module_default6 = { "ExternalInput": "_ExternalInput_l4bks_1", "ExternalInput-actions": "_ExternalInput-actions_l4bks_5", "ExternalInput-button": "_ExternalInput-button_l4bks_9", "ExternalInput-detachButton": "_ExternalInput-detachButton_l4bks_28", "ExternalInput--hasData": "_ExternalInput--hasData_l4bks_35", "ExternalInput-modal": "_ExternalInput-modal_l4bks_55", "ExternalInput--modalVisible": "_ExternalInput--modalVisible_l4bks_69", "ExternalInput-modalInner": "_ExternalInput-modalInner_l4bks_73", "ExternalInput-modalHeading": "_ExternalInput-modalHeading_l4bks_84", "ExternalInput-modalTableWrapper": "_ExternalInput-modalTableWrapper_l4bks_89" };
3024
3440
 
3025
3441
  // components/ExternalInput/index.tsx
3026
- var import_jsx_runtime7 = require("react/jsx-runtime");
3027
- var getClassName5 = get_class_name_factory_default("ExternalInput", styles_module_default3);
3442
+ var import_jsx_runtime11 = require("react/jsx-runtime");
3443
+ var getClassName8 = get_class_name_factory_default("ExternalInput", styles_module_default6);
3028
3444
  var ExternalInput = ({
3029
3445
  field,
3030
3446
  onChange,
3031
3447
  value = null
3032
3448
  }) => {
3033
- const [data, setData] = (0, import_react23.useState)([]);
3034
- const [isOpen, setOpen] = (0, import_react23.useState)(false);
3035
- const [selectedData, setSelectedData] = (0, import_react23.useState)(value);
3036
- const keys = (0, import_react23.useMemo)(
3037
- () => Object.keys(data).filter(
3038
- (key) => typeof data[key] === "string" || typeof data[key] === "number"
3039
- ),
3040
- [data]
3041
- );
3042
- (0, import_react23.useEffect)(() => {
3449
+ const [data, setData] = (0, import_react26.useState)([]);
3450
+ const [isOpen, setOpen] = (0, import_react26.useState)(false);
3451
+ const [selectedData, setSelectedData] = (0, import_react26.useState)(value);
3452
+ const keys = (0, import_react26.useMemo)(() => {
3453
+ const validKeys = /* @__PURE__ */ new Set();
3454
+ for (const item of data) {
3455
+ for (const key of Object.keys(item)) {
3456
+ if (typeof item[key] === "string" || typeof item[key] === "number") {
3457
+ validKeys.add(key);
3458
+ }
3459
+ }
3460
+ }
3461
+ return Array.from(validKeys);
3462
+ }, [data]);
3463
+ (0, import_react26.useEffect)(() => {
3043
3464
  (() => __async(void 0, null, function* () {
3044
3465
  if (field.adaptor) {
3045
3466
  const listData = yield field.adaptor.fetchList(field.adaptorParams);
@@ -3050,35 +3471,35 @@ var ExternalInput = ({
3050
3471
  }))();
3051
3472
  }, [field.adaptor, field.adaptorParams]);
3052
3473
  if (!field.adaptor) {
3053
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "Incorrectly configured" });
3474
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: "Incorrectly configured" });
3054
3475
  }
3055
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3476
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3056
3477
  "div",
3057
3478
  {
3058
- className: getClassName5({
3479
+ className: getClassName8({
3059
3480
  hasData: !!selectedData,
3060
3481
  modalVisible: isOpen
3061
3482
  }),
3062
3483
  children: [
3063
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassName5("actions"), children: [
3064
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3484
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName8("actions"), children: [
3485
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3065
3486
  "button",
3066
3487
  {
3067
3488
  onClick: () => setOpen(true),
3068
- className: getClassName5("button"),
3069
- children: selectedData ? field.getItemSummary ? field.getItemSummary(selectedData) : `${field.adaptor.name} item` : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3070
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(link_default, { size: "16" }),
3071
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
3489
+ className: getClassName8("button"),
3490
+ children: selectedData ? field.getItemSummary ? field.getItemSummary(selectedData) : `${field.adaptor.name} item` : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
3491
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(link_default, { size: "16" }),
3492
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
3072
3493
  "Select from ",
3073
3494
  field.adaptor.name
3074
3495
  ] })
3075
3496
  ] })
3076
3497
  }
3077
3498
  ),
3078
- selectedData && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3499
+ selectedData && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3079
3500
  "button",
3080
3501
  {
3081
- className: getClassName5("detachButton"),
3502
+ className: getClassName8("detachButton"),
3082
3503
  onClick: () => {
3083
3504
  setSelectedData(null);
3084
3505
  onChange(null);
@@ -3087,17 +3508,17 @@ var ExternalInput = ({
3087
3508
  }
3088
3509
  )
3089
3510
  ] }),
3090
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("modal"), onClick: () => setOpen(false), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3511
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("modal"), onClick: () => setOpen(false), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3091
3512
  "div",
3092
3513
  {
3093
- className: getClassName5("modalInner"),
3514
+ className: getClassName8("modalInner"),
3094
3515
  onClick: (e) => e.stopPropagation(),
3095
3516
  children: [
3096
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: getClassName5("modalHeading"), children: "Select content" }),
3097
- data.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("modalTableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("table", { children: [
3098
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("tr", { children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("th", { style: { textAlign: "left" }, children: key }, key)) }) }),
3099
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("tbody", { children: data.map((item, i) => {
3100
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3517
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h2", { className: getClassName8("modalHeading"), children: "Select content" }),
3518
+ data.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("modalTableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("table", { children: [
3519
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { style: { textAlign: "left" }, children: key }, key)) }) }),
3520
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tbody", { children: data.map((item, i) => {
3521
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3101
3522
  "tr",
3102
3523
  {
3103
3524
  style: { whiteSpace: "nowrap" },
@@ -3106,12 +3527,12 @@ var ExternalInput = ({
3106
3527
  setOpen(false);
3107
3528
  setSelectedData(item);
3108
3529
  },
3109
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("td", { children: item[key] }, key))
3530
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { children: item[key] }, key))
3110
3531
  },
3111
3532
  i
3112
3533
  );
3113
3534
  }) })
3114
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { padding: 24 }, children: "No content" })
3535
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { padding: 24 }, children: "No content" })
3115
3536
  ]
3116
3537
  }
3117
3538
  ) })
@@ -3120,204 +3541,189 @@ var ExternalInput = ({
3120
3541
  );
3121
3542
  };
3122
3543
 
3123
- // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
3544
+ // components/InputOrGroup/fields/ExternalField/index.tsx
3545
+ var import_jsx_runtime12 = require("react/jsx-runtime");
3546
+ var getClassName9 = get_class_name_factory_default("Input", styles_module_default3);
3547
+ var ExternalField = ({
3548
+ field,
3549
+ onChange,
3550
+ readOnly,
3551
+ value,
3552
+ name,
3553
+ label
3554
+ }) => {
3555
+ if (!field.adaptor) {
3556
+ return null;
3557
+ }
3558
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName9(""), children: [
3559
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("label"), children: name === "_data" ? "External content" : label || name }),
3560
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ExternalInput, { field, onChange, value })
3561
+ ] });
3562
+ };
3563
+
3564
+ // components/InputOrGroup/fields/RadioField/index.tsx
3124
3565
  init_react_import();
3125
- var styles_module_default4 = { "Input": "_Input_izwhv_1", "Input-label": "_Input-label_izwhv_27", "Input-labelIcon": "_Input-labelIcon_izwhv_34", "Input-input": "_Input-input_izwhv_39", "Input--readOnly": "_Input--readOnly_izwhv_60", "Input-arrayItem": "_Input-arrayItem_izwhv_69", "Input-fieldset": "_Input-fieldset_izwhv_95", "Input-arrayItemAction": "_Input-arrayItemAction_izwhv_116", "Input-addButton": "_Input-addButton_izwhv_135", "Input-array": "_Input-array_izwhv_69", "Input-radioGroupItems": "_Input-radioGroupItems_izwhv_156", "Input-radio": "_Input-radio_izwhv_156", "Input-radioInner": "_Input-radioInner_izwhv_173", "Input-radioInput": "_Input-radioInput_izwhv_185" };
3566
+ var import_jsx_runtime13 = require("react/jsx-runtime");
3567
+ var getClassName10 = get_class_name_factory_default("Input", styles_module_default3);
3568
+ var RadioField = ({
3569
+ field,
3570
+ onChange,
3571
+ readOnly,
3572
+ value,
3573
+ name
3574
+ }) => {
3575
+ if (!field.options) {
3576
+ return null;
3577
+ }
3578
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName10(), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName10("radioGroup"), children: [
3579
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName10("label"), children: [
3580
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName10("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(check_circle_default, { size: 16 }) }),
3581
+ field.label || name
3582
+ ] }),
3583
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName10("radioGroupItems"), children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3584
+ "label",
3585
+ {
3586
+ className: getClassName10("radio"),
3587
+ children: [
3588
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3589
+ "input",
3590
+ {
3591
+ type: "radio",
3592
+ className: getClassName10("radioInput"),
3593
+ value: option.value,
3594
+ name,
3595
+ onChange: (e) => {
3596
+ if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
3597
+ onChange(JSON.parse(e.currentTarget.value));
3598
+ return;
3599
+ }
3600
+ onChange(e.currentTarget.value);
3601
+ },
3602
+ readOnly,
3603
+ defaultChecked: value === option.value
3604
+ }
3605
+ ),
3606
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName10("radioInner"), children: option.label || option.value })
3607
+ ]
3608
+ },
3609
+ option.label + option.value
3610
+ )) })
3611
+ ] }) });
3612
+ };
3613
+
3614
+ // components/InputOrGroup/fields/SelectField/index.tsx
3615
+ init_react_import();
3616
+ var import_jsx_runtime14 = require("react/jsx-runtime");
3617
+ var getClassName11 = get_class_name_factory_default("Input", styles_module_default3);
3618
+ var SelectField = ({
3619
+ field,
3620
+ onChange,
3621
+ label,
3622
+ value,
3623
+ name
3624
+ }) => {
3625
+ if (!field.options) {
3626
+ return null;
3627
+ }
3628
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: getClassName11(), children: [
3629
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName11("label"), children: [
3630
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(chevron_down_default, { size: 16 }) }),
3631
+ label || name
3632
+ ] }),
3633
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3634
+ "select",
3635
+ {
3636
+ className: getClassName11("input"),
3637
+ onChange: (e) => {
3638
+ if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
3639
+ onChange(Boolean(e.currentTarget.value));
3640
+ return;
3641
+ }
3642
+ onChange(e.currentTarget.value);
3643
+ },
3644
+ value,
3645
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3646
+ "option",
3647
+ {
3648
+ label: option.label,
3649
+ value: option.value
3650
+ },
3651
+ option.label + option.value
3652
+ ))
3653
+ }
3654
+ )
3655
+ ] });
3656
+ };
3657
+
3658
+ // components/InputOrGroup/fields/TextareaField/index.tsx
3659
+ init_react_import();
3660
+ var import_jsx_runtime15 = require("react/jsx-runtime");
3661
+ var getClassName12 = get_class_name_factory_default("Input", styles_module_default3);
3662
+ var TextareaField = ({
3663
+ onChange,
3664
+ readOnly,
3665
+ value,
3666
+ name,
3667
+ label
3668
+ }) => {
3669
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassName12({ readOnly }), children: [
3670
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassName12("label"), children: [
3671
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName12("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(type_default, { size: 16 }) }),
3672
+ label || name
3673
+ ] }),
3674
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3675
+ "textarea",
3676
+ {
3677
+ className: getClassName12("input"),
3678
+ autoComplete: "off",
3679
+ name,
3680
+ value: typeof value === "undefined" ? "" : value,
3681
+ onChange: (e) => onChange(e.currentTarget.value),
3682
+ readOnly,
3683
+ rows: 5
3684
+ }
3685
+ )
3686
+ ] });
3687
+ };
3126
3688
 
3127
3689
  // components/InputOrGroup/index.tsx
3128
- var import_jsx_runtime8 = require("react/jsx-runtime");
3129
- var getClassName6 = get_class_name_factory_default("Input", styles_module_default4);
3690
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3691
+ var getClassName13 = get_class_name_factory_default("Input", styles_module_default3);
3130
3692
  var FieldLabel = ({
3131
3693
  children,
3132
3694
  icon,
3133
3695
  label
3134
3696
  }) => {
3135
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
3136
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
3137
- icon ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, {}),
3697
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { children: [
3698
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassName13("label"), children: [
3699
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName13("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, {}),
3138
3700
  label
3139
3701
  ] }),
3140
3702
  children
3141
3703
  ] });
3142
3704
  };
3143
- var InputOrGroup = ({
3144
- name,
3145
- field,
3146
- value,
3147
- label,
3148
- onChange,
3149
- readOnly
3150
- }) => {
3705
+ var InputOrGroup = (props) => {
3706
+ const { name, field, value, onChange, readOnly } = props;
3151
3707
  if (field.type === "array") {
3152
- if (!field.arrayFields) {
3153
- return null;
3154
- }
3155
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6(), children: [
3156
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("b", { className: getClassName6("label"), children: [
3157
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(list_default, { size: 16 }) }),
3158
- label || name
3159
- ] }),
3160
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("array"), children: [
3161
- Array.isArray(value) ? value.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3162
- "details",
3163
- {
3164
- className: getClassName6("arrayItem"),
3165
- children: [
3166
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("summary", { children: [
3167
- field.getItemSummary ? field.getItemSummary(item, i) : `Item #${i}`,
3168
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("arrayItemAction"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3169
- IconButton,
3170
- {
3171
- onClick: () => {
3172
- const existingValue = value || [];
3173
- existingValue.splice(i, 1);
3174
- onChange(existingValue);
3175
- },
3176
- title: "Delete",
3177
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(trash_default, { size: 21 })
3178
- }
3179
- ) })
3180
- ] }),
3181
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("fieldset", { className: getClassName6("fieldset"), children: Object.keys(field.arrayFields).map((fieldName) => {
3182
- const subField = field.arrayFields[fieldName];
3183
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3184
- InputOrGroup,
3185
- {
3186
- name: `${name}_${i}_${fieldName}`,
3187
- label: subField.label || fieldName,
3188
- field: subField,
3189
- value: item[fieldName],
3190
- onChange: (val) => onChange(
3191
- replace(value, i, __spreadProps(__spreadValues({}, item), { [fieldName]: val }))
3192
- )
3193
- },
3194
- `${name}_${i}_${fieldName}`
3195
- );
3196
- }) })
3197
- ]
3198
- },
3199
- `${name}_${i}`
3200
- )) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", {}),
3201
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3202
- "button",
3203
- {
3204
- className: getClassName6("addButton"),
3205
- onClick: () => {
3206
- const existingValue = value || [];
3207
- onChange([...existingValue, field.defaultItemProps || {}]);
3208
- },
3209
- children: "+ Add item"
3210
- }
3211
- )
3212
- ] })
3213
- ] });
3708
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArrayField, __spreadValues({}, props));
3214
3709
  }
3215
3710
  if (field.type === "external") {
3216
- if (!field.adaptor) {
3217
- return null;
3218
- }
3219
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6(""), children: [
3220
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("label"), children: name === "_data" ? "External content" : label || name }),
3221
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExternalInput, { field, onChange, value })
3222
- ] });
3711
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExternalField, __spreadValues({}, props));
3223
3712
  }
3224
3713
  if (field.type === "select") {
3225
- if (!field.options) {
3226
- return null;
3227
- }
3228
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: getClassName6(), children: [
3229
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
3230
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(chevron_down_default, { size: 16 }) }),
3231
- label || name
3232
- ] }),
3233
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3234
- "select",
3235
- {
3236
- className: getClassName6("input"),
3237
- onChange: (e) => {
3238
- if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
3239
- onChange(Boolean(e.currentTarget.value));
3240
- return;
3241
- }
3242
- onChange(e.currentTarget.value);
3243
- },
3244
- value,
3245
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3246
- "option",
3247
- {
3248
- label: option.label,
3249
- value: option.value
3250
- },
3251
- option.label + option.value
3252
- ))
3253
- }
3254
- )
3255
- ] });
3714
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectField, __spreadValues({}, props));
3256
3715
  }
3257
3716
  if (field.type === "textarea") {
3258
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: getClassName6({ readOnly }), children: [
3259
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
3260
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(type_default, { size: 16 }) }),
3261
- label || name
3262
- ] }),
3263
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3264
- "textarea",
3265
- {
3266
- className: getClassName6("input"),
3267
- autoComplete: "off",
3268
- name,
3269
- value: typeof value === "undefined" ? "" : value,
3270
- onChange: (e) => onChange(e.currentTarget.value),
3271
- readOnly,
3272
- rows: 5
3273
- }
3274
- )
3275
- ] });
3717
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextareaField, __spreadValues({}, props));
3276
3718
  }
3277
3719
  if (field.type === "radio") {
3278
- if (!field.options) {
3279
- return null;
3280
- }
3281
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("radioGroup"), children: [
3282
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
3283
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(check_circle_default, { size: 16 }) }),
3284
- field.label || name
3285
- ] }),
3286
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("radioGroupItems"), children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3287
- "label",
3288
- {
3289
- className: getClassName6("radio"),
3290
- children: [
3291
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3292
- "input",
3293
- {
3294
- type: "radio",
3295
- className: getClassName6("radioInput"),
3296
- value: option.value,
3297
- name,
3298
- onChange: (e) => {
3299
- if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
3300
- onChange(JSON.parse(e.currentTarget.value));
3301
- return;
3302
- }
3303
- onChange(e.currentTarget.value);
3304
- },
3305
- readOnly,
3306
- defaultChecked: value === option.value
3307
- }
3308
- ),
3309
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("radioInner"), children: option.label || option.value })
3310
- ]
3311
- },
3312
- option.label + option.value
3313
- )) })
3314
- ] }) });
3720
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RadioField, __spreadValues({}, props));
3315
3721
  }
3316
3722
  if (field.type === "custom") {
3317
3723
  if (!field.render) {
3318
3724
  return null;
3319
3725
  }
3320
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6(), children: field.render({
3726
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName13(), children: field.render({
3321
3727
  field,
3322
3728
  name,
3323
3729
  value,
@@ -3325,96 +3731,46 @@ var InputOrGroup = ({
3325
3731
  readOnly
3326
3732
  }) });
3327
3733
  }
3328
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: getClassName6({ readOnly }), children: [
3329
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
3330
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("labelIcon"), children: [
3331
- field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(type_default, { size: 16 }),
3332
- field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(hash_default, { size: 16 })
3333
- ] }),
3334
- label || name
3335
- ] }),
3336
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3337
- "input",
3338
- {
3339
- className: getClassName6("input"),
3340
- autoComplete: "off",
3341
- type: field.type,
3342
- name,
3343
- value: typeof value === "undefined" ? "" : value,
3344
- onChange: (e) => {
3345
- if (field.type === "number") {
3346
- onChange(Number(e.currentTarget.value));
3347
- } else {
3348
- onChange(e.currentTarget.value);
3349
- }
3350
- },
3351
- readOnly
3352
- }
3353
- )
3354
- ] });
3734
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DefaultField, __spreadValues({}, props));
3355
3735
  };
3356
3736
 
3357
3737
  // components/ComponentList/index.tsx
3358
3738
  init_react_import();
3359
- var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
3360
3739
 
3361
3740
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
3362
3741
  init_react_import();
3363
- var styles_module_default5 = { "ComponentList": "_ComponentList_1ybn0_1", "ComponentList-item": "_ComponentList-item_1ybn0_9", "ComponentList-itemShadow": "_ComponentList-itemShadow_1ybn0_10", "ComponentList-itemIcon": "_ComponentList-itemIcon_1ybn0_28" };
3742
+ var styles_module_default7 = { "ComponentList": "_ComponentList_bvy0z_1", "ComponentList-item": "_ComponentList-item_bvy0z_6", "ComponentList-itemIcon": "_ComponentList-itemIcon_bvy0z_24", "ComponentList--isDraggingFrom": "_ComponentList--isDraggingFrom_bvy0z_28" };
3364
3743
 
3365
3744
  // components/ComponentList/index.tsx
3366
- var import_jsx_runtime9 = require("react/jsx-runtime");
3367
- var getClassName7 = get_class_name_factory_default("ComponentList", styles_module_default5);
3745
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3746
+ var getClassName14 = get_class_name_factory_default("ComponentList", styles_module_default7);
3368
3747
  var ComponentList = ({ config }) => {
3369
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DroppableStrictMode_default, { droppableId: "component-list", isDropDisabled: true, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3748
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DroppableStrictMode_default, { droppableId: "component-list", isDropDisabled: true, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3370
3749
  "div",
3371
3750
  __spreadProps(__spreadValues({}, provided.droppableProps), {
3372
3751
  ref: provided.innerRef,
3373
- className: getClassName7(),
3752
+ className: getClassName14({
3753
+ isDraggingFrom: !!snapshot.draggingFromThisWith
3754
+ }),
3374
3755
  children: [
3375
3756
  Object.keys(config.components).map((componentKey, i) => {
3376
- const componentConfig = config[componentKey];
3377
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3378
- import_react_beautiful_dnd3.Draggable,
3757
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3758
+ Draggable2,
3379
3759
  {
3380
- draggableId: componentKey,
3760
+ id: componentKey,
3381
3761
  index: i,
3382
- children: (provided2, snapshot2) => {
3383
- var _a;
3384
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
3385
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3386
- "div",
3387
- __spreadProps(__spreadValues(__spreadValues({
3388
- ref: provided2.innerRef
3389
- }, provided2.draggableProps), provided2.dragHandleProps), {
3390
- className: getClassName7("item"),
3391
- style: __spreadProps(__spreadValues({}, provided2.draggableProps.style), {
3392
- transform: snapshot2.isDragging ? (_a = provided2.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
3393
- }),
3394
- children: [
3395
- componentKey,
3396
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName7("itemIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(grid_default, { size: 18 }) })
3397
- ]
3398
- })
3399
- ),
3400
- snapshot2.isDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3401
- "div",
3402
- {
3403
- className: getClassName7("itemShadow"),
3404
- style: { transform: "none !important" },
3405
- children: [
3406
- componentKey,
3407
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName7("itemIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(grid_default, { size: 18 }) })
3408
- ]
3409
- }
3410
- )
3411
- ] });
3412
- }
3762
+ showShadow: true,
3763
+ disableAnimations: true,
3764
+ className: () => getClassName14("item"),
3765
+ children: () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3766
+ componentKey,
3767
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("itemIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DragIcon, {}) })
3768
+ ] })
3413
3769
  },
3414
3770
  componentKey
3415
3771
  );
3416
3772
  }),
3417
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { display: "none" }, children: provided.placeholder })
3773
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
3418
3774
  ]
3419
3775
  })
3420
3776
  ) });
@@ -3422,10 +3778,10 @@ var ComponentList = ({ config }) => {
3422
3778
 
3423
3779
  // lib/use-placeholder-style.ts
3424
3780
  init_react_import();
3425
- var import_react24 = require("react");
3781
+ var import_react27 = require("react");
3426
3782
  var usePlaceholderStyle = () => {
3427
3783
  const queryAttr = "data-rbd-drag-handle-draggable-id";
3428
- const [placeholderStyle, setPlaceholderStyle] = (0, import_react24.useState)();
3784
+ const [placeholderStyle, setPlaceholderStyle] = (0, import_react27.useState)();
3429
3785
  const onDragStartOrUpdate = (draggedItem) => {
3430
3786
  var _a;
3431
3787
  const draggableId = draggedItem.draggableId;
@@ -3473,24 +3829,24 @@ init_react_import();
3473
3829
 
3474
3830
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
3475
3831
  init_react_import();
3476
- var styles_module_default6 = { "SidebarSection": "_SidebarSection_f1p35_1", "SidebarSection-title": "_SidebarSection-title_f1p35_12", "SidebarSection-content": "_SidebarSection-content_f1p35_19", "SidebarSection--noPadding": "_SidebarSection--noPadding_f1p35_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_f1p35_33", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_f1p35_44", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_f1p35_33", "SidebarSection-heading": "_SidebarSection-heading_f1p35_56" };
3832
+ var styles_module_default8 = { "SidebarSection": "_SidebarSection_f1p35_1", "SidebarSection-title": "_SidebarSection-title_f1p35_12", "SidebarSection-content": "_SidebarSection-content_f1p35_19", "SidebarSection--noPadding": "_SidebarSection--noPadding_f1p35_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_f1p35_33", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_f1p35_44", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_f1p35_33", "SidebarSection-heading": "_SidebarSection-heading_f1p35_56" };
3477
3833
 
3478
3834
  // components/Heading/index.tsx
3479
3835
  init_react_import();
3480
3836
 
3481
3837
  // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
3482
3838
  init_react_import();
3483
- var styles_module_default7 = { "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" };
3839
+ var styles_module_default9 = { "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" };
3484
3840
 
3485
3841
  // components/Heading/index.tsx
3486
- var import_jsx_runtime10 = require("react/jsx-runtime");
3487
- var getClassName8 = get_class_name_factory_default("Heading", styles_module_default7);
3842
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3843
+ var getClassName15 = get_class_name_factory_default("Heading", styles_module_default9);
3488
3844
  var Heading = ({ children, rank, size = "m" }) => {
3489
3845
  const Tag = rank ? `h${rank}` : "span";
3490
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3846
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3491
3847
  Tag,
3492
3848
  {
3493
- className: getClassName8({
3849
+ className: getClassName15({
3494
3850
  [size]: true
3495
3851
  }),
3496
3852
  children
@@ -3498,33 +3854,100 @@ var Heading = ({ children, rank, size = "m" }) => {
3498
3854
  );
3499
3855
  };
3500
3856
 
3857
+ // lib/use-breadcrumbs.ts
3858
+ init_react_import();
3859
+ var import_react28 = require("react");
3860
+ var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
3861
+ const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
3862
+ const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
3863
+ if (!id) {
3864
+ return [];
3865
+ }
3866
+ return currentPathData == null ? void 0 : currentPathData.path.reduce((acc, zoneCompound) => {
3867
+ const [area] = getZoneId(zoneCompound);
3868
+ if (area === rootDroppableId) {
3869
+ return [
3870
+ {
3871
+ label: "Page",
3872
+ selector: null
3873
+ }
3874
+ ];
3875
+ }
3876
+ const parentZoneCompound = acc.length > 0 ? acc[acc.length - 1].zoneCompound : rootDroppableId;
3877
+ let parentZone = data.content;
3878
+ if (parentZoneCompound && parentZoneCompound !== rootDroppableId) {
3879
+ parentZone = data.zones[parentZoneCompound];
3880
+ }
3881
+ if (!parentZone) {
3882
+ return acc;
3883
+ }
3884
+ const itemIndex = parentZone.findIndex(
3885
+ (queryItem) => queryItem.props.id === area
3886
+ );
3887
+ const item = parentZone[itemIndex];
3888
+ if (!item) {
3889
+ return acc;
3890
+ }
3891
+ return [
3892
+ ...acc,
3893
+ {
3894
+ label: item.type.toString(),
3895
+ selector: {
3896
+ index: itemIndex,
3897
+ zone: parentZoneCompound
3898
+ },
3899
+ zoneCompound
3900
+ }
3901
+ ];
3902
+ }, []);
3903
+ };
3904
+ var useBreadcrumbs = (renderCount) => {
3905
+ const {
3906
+ appData: { data },
3907
+ selectedItem
3908
+ } = useAppContext();
3909
+ const dzContext = (0, import_react28.useContext)(dropZoneContext);
3910
+ return (0, import_react28.useMemo)(() => {
3911
+ const breadcrumbs = convertPathDataToBreadcrumbs(
3912
+ selectedItem,
3913
+ dzContext == null ? void 0 : dzContext.pathData,
3914
+ data
3915
+ );
3916
+ if (renderCount) {
3917
+ return breadcrumbs.slice(breadcrumbs.length - renderCount);
3918
+ }
3919
+ return breadcrumbs;
3920
+ }, [selectedItem, dzContext == null ? void 0 : dzContext.pathData, renderCount]);
3921
+ };
3922
+
3501
3923
  // components/SidebarSection/index.tsx
3502
- var import_jsx_runtime11 = require("react/jsx-runtime");
3503
- var getClassName9 = get_class_name_factory_default("SidebarSection", styles_module_default6);
3924
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3925
+ var getClassName16 = get_class_name_factory_default("SidebarSection", styles_module_default8);
3504
3926
  var SidebarSection = ({
3505
3927
  children,
3506
3928
  title,
3507
3929
  background,
3508
- breadcrumbs = [],
3509
- breadcrumbClick,
3930
+ showBreadcrumbs,
3510
3931
  noPadding
3511
3932
  }) => {
3512
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9({ noPadding }), style: { background }, children: [
3513
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("title"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("breadcrumbs"), children: [
3514
- breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("breadcrumb"), children: [
3515
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3933
+ const { setState } = useAppContext();
3934
+ const breadcrumbs = useBreadcrumbs(1);
3935
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16({ noPadding }), style: { background }, children: [
3936
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("title"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16("breadcrumbs"), children: [
3937
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16("breadcrumb"), children: [
3938
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3516
3939
  "div",
3517
3940
  {
3518
- className: getClassName9("breadcrumbLabel"),
3519
- onClick: () => breadcrumbClick && breadcrumbClick(breadcrumb),
3941
+ className: getClassName16("breadcrumbLabel"),
3942
+ onClick: () => setState({ itemSelector: breadcrumb.selector }),
3520
3943
  children: breadcrumb.label
3521
3944
  }
3522
3945
  ),
3523
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(chevron_right_default, { size: 16 })
3524
- ] }, i)),
3525
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
3946
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(chevron_right_default, { size: 16 })
3947
+ ] }, i)) : null,
3948
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
3526
3949
  ] }) }),
3527
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("content"), children })
3950
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("content"), children })
3528
3951
  ] });
3529
3952
  };
3530
3953
 
@@ -3533,15 +3956,15 @@ init_react_import();
3533
3956
 
3534
3957
  // lib/use-puck-history.ts
3535
3958
  init_react_import();
3536
- var import_react26 = require("react");
3959
+ var import_react30 = require("react");
3537
3960
 
3538
3961
  // lib/use-action-history.ts
3539
3962
  init_react_import();
3540
- var import_react25 = require("react");
3963
+ var import_react29 = require("react");
3541
3964
  var EMPTY_HISTORY_INDEX = -1;
3542
3965
  function useActionHistory() {
3543
- const [histories, setHistories] = (0, import_react25.useState)([]);
3544
- const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react25.useState)(EMPTY_HISTORY_INDEX);
3966
+ const [histories, setHistories] = (0, import_react29.useState)([]);
3967
+ const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react29.useState)(EMPTY_HISTORY_INDEX);
3545
3968
  const currentHistory = histories[currentHistoryIndex];
3546
3969
  const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
3547
3970
  const canForward = currentHistoryIndex < histories.length - 1;
@@ -3582,11 +4005,20 @@ function useActionHistory() {
3582
4005
  var import_react_hotkeys_hook = require("react-hotkeys-hook");
3583
4006
  var import_event_emitter = __toESM(require("event-emitter"));
3584
4007
  var import_use_debounce2 = require("use-debounce");
3585
- var import_deep_diff = require("deep-diff");
3586
4008
  var DEBOUNCE_TIME = 250;
3587
4009
  var RECORD_DIFF = "RECORD_DIFF";
3588
4010
  var historyEmitter = (0, import_event_emitter.default)();
3589
4011
  var recordDiff = (newAppData) => historyEmitter.emit(RECORD_DIFF, newAppData);
4012
+ var _recordHistory = ({ snapshot, newSnapshot, record, dispatch }) => {
4013
+ record({
4014
+ forward: () => {
4015
+ dispatch({ type: "set", appData: newSnapshot });
4016
+ },
4017
+ rewind: () => {
4018
+ dispatch({ type: "set", appData: snapshot });
4019
+ }
4020
+ });
4021
+ };
3590
4022
  function usePuckHistory({
3591
4023
  appData,
3592
4024
  dispatch
@@ -3597,30 +4029,14 @@ function usePuckHistory({
3597
4029
  (0, import_react_hotkeys_hook.useHotkeys)("meta+y", forward, { preventDefault: true });
3598
4030
  const [snapshot] = (0, import_use_debounce2.useDebounce)(appData, DEBOUNCE_TIME);
3599
4031
  const handleRecordDiff = (0, import_use_debounce2.useDebouncedCallback)((newAppData) => {
3600
- const _diff = (0, import_deep_diff.diff)(snapshot, newAppData);
3601
- if (!_diff) {
3602
- return;
3603
- }
3604
- record({
3605
- forward: () => {
3606
- const target = structuredClone(appData);
3607
- _diff.reduce((target2, change) => {
3608
- (0, import_deep_diff.applyChange)(target2, true, change);
3609
- return target2;
3610
- }, target);
3611
- dispatch({ type: "set", appData: target });
3612
- },
3613
- rewind: () => {
3614
- const target = structuredClone(appData);
3615
- _diff.reduce((target2, change) => {
3616
- (0, import_deep_diff.revertChange)(target2, true, change);
3617
- return target2;
3618
- }, target);
3619
- dispatch({ type: "set", appData: target });
3620
- }
4032
+ return _recordHistory({
4033
+ snapshot,
4034
+ newSnapshot: newAppData,
4035
+ record,
4036
+ dispatch
3621
4037
  });
3622
4038
  }, DEBOUNCE_TIME);
3623
- (0, import_react26.useEffect)(() => {
4039
+ (0, import_react30.useEffect)(() => {
3624
4040
  historyEmitter.on(RECORD_DIFF, handleRecordDiff);
3625
4041
  return () => {
3626
4042
  historyEmitter.off(RECORD_DIFF, handleRecordDiff);
@@ -3630,8 +4046,7 @@ function usePuckHistory({
3630
4046
  canForward,
3631
4047
  canRewind,
3632
4048
  rewind,
3633
- forward,
3634
- record
4049
+ forward
3635
4050
  };
3636
4051
  }
3637
4052
 
@@ -3656,13 +4071,6 @@ var remove = (list, index) => {
3656
4071
 
3657
4072
  // lib/reduce-related-zones.ts
3658
4073
  init_react_import();
3659
-
3660
- // lib/generate-id.ts
3661
- init_react_import();
3662
- var import_crypto = require("crypto");
3663
- var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toString("hex")}`;
3664
-
3665
- // lib/reduce-related-zones.ts
3666
4074
  var reduceRelatedZones = (item, data, fn) => {
3667
4075
  return __spreadProps(__spreadValues({}, data), {
3668
4076
  zones: Object.keys(data.zones || {}).reduce(
@@ -3959,7 +4367,7 @@ init_react_import();
3959
4367
 
3960
4368
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
3961
4369
  init_react_import();
3962
- var styles_module_default8 = { "LayerTree": "_LayerTree_1dcmd_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1dcmd_11", "LayerTree-helper": "_LayerTree-helper_1dcmd_17", "Layer": "_Layer_1dcmd_1", "Layer-inner": "_Layer-inner_1dcmd_29", "Layer--containsZone": "_Layer--containsZone_1dcmd_35", "Layer-clickable": "_Layer-clickable_1dcmd_39", "Layer--isSelected": "_Layer--isSelected_1dcmd_48", "Layer--isHovering": "_Layer--isHovering_1dcmd_49", "Layer-chevron": "_Layer-chevron_1dcmd_65", "Layer--childIsSelected": "_Layer--childIsSelected_1dcmd_66", "Layer-zones": "_Layer-zones_1dcmd_70", "Layer-title": "_Layer-title_1dcmd_84", "Layer-icon": "_Layer-icon_1dcmd_92", "Layer-zoneIcon": "_Layer-zoneIcon_1dcmd_97" };
4370
+ var styles_module_default10 = { "LayerTree": "_LayerTree_1dcmd_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1dcmd_11", "LayerTree-helper": "_LayerTree-helper_1dcmd_17", "Layer": "_Layer_1dcmd_1", "Layer-inner": "_Layer-inner_1dcmd_29", "Layer--containsZone": "_Layer--containsZone_1dcmd_35", "Layer-clickable": "_Layer-clickable_1dcmd_39", "Layer--isSelected": "_Layer--isSelected_1dcmd_48", "Layer--isHovering": "_Layer--isHovering_1dcmd_49", "Layer-chevron": "_Layer-chevron_1dcmd_65", "Layer--childIsSelected": "_Layer--childIsSelected_1dcmd_66", "Layer-zones": "_Layer-zones_1dcmd_70", "Layer-title": "_Layer-title_1dcmd_84", "Layer-icon": "_Layer-icon_1dcmd_92", "Layer-zoneIcon": "_Layer-zoneIcon_1dcmd_97" };
3963
4371
 
3964
4372
  // lib/scroll-into-view.ts
3965
4373
  init_react_import();
@@ -3973,7 +4381,7 @@ var scrollIntoView = (el) => {
3973
4381
  };
3974
4382
 
3975
4383
  // components/LayerTree/index.tsx
3976
- var import_react27 = require("react");
4384
+ var import_react31 = require("react");
3977
4385
 
3978
4386
  // lib/find-zones-for-area.ts
3979
4387
  init_react_import();
@@ -3992,19 +4400,16 @@ init_react_import();
3992
4400
  var isChildOfZone = (item, maybeChild, ctx) => {
3993
4401
  var _a;
3994
4402
  const { data, pathData = {} } = ctx || {};
3995
- return maybeChild && data ? !!((_a = pathData[maybeChild.props.id]) == null ? void 0 : _a.find((path) => {
3996
- if (path.selector) {
3997
- const pathItem = getItem(path.selector, data);
3998
- return (pathItem == null ? void 0 : pathItem.props.id) === item.props.id;
3999
- }
4000
- return false;
4403
+ return maybeChild && data ? !!((_a = pathData[maybeChild.props.id]) == null ? void 0 : _a.path.find((zoneCompound) => {
4404
+ const [area] = getZoneId(zoneCompound);
4405
+ return area === item.props.id;
4001
4406
  })) : false;
4002
4407
  };
4003
4408
 
4004
4409
  // components/LayerTree/index.tsx
4005
- var import_jsx_runtime12 = require("react/jsx-runtime");
4006
- var getClassName10 = get_class_name_factory_default("LayerTree", styles_module_default8);
4007
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default8);
4410
+ var import_jsx_runtime20 = require("react/jsx-runtime");
4411
+ var getClassName17 = get_class_name_factory_default("LayerTree", styles_module_default10);
4412
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default10);
4008
4413
  var LayerTree = ({
4009
4414
  data,
4010
4415
  zoneContent,
@@ -4014,15 +4419,15 @@ var LayerTree = ({
4014
4419
  label
4015
4420
  }) => {
4016
4421
  const zones = data.zones || {};
4017
- const ctx = (0, import_react27.useContext)(dropZoneContext);
4018
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
4019
- label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName10("zoneTitle"), children: [
4020
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName10("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(layers_default, { size: "16" }) }),
4422
+ const ctx = (0, import_react31.useContext)(dropZoneContext);
4423
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
4424
+ label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("zoneTitle"), children: [
4425
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(layers_default, { size: "16" }) }),
4021
4426
  " ",
4022
4427
  label
4023
4428
  ] }),
4024
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("ul", { className: getClassName10(), children: [
4025
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName10("helper"), children: "No items" }),
4429
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("ul", { className: getClassName17(), children: [
4430
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("helper"), children: "No items" }),
4026
4431
  zoneContent.map((item, i) => {
4027
4432
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
4028
4433
  const zonesForItem = findZonesForArea(data, item.props.id);
@@ -4037,7 +4442,7 @@ var LayerTree = ({
4037
4442
  const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
4038
4443
  const isHovering = hoveringComponent === item.props.id;
4039
4444
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
4040
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4445
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
4041
4446
  "li",
4042
4447
  {
4043
4448
  className: getClassNameLayer({
@@ -4047,7 +4452,7 @@ var LayerTree = ({
4047
4452
  childIsSelected
4048
4453
  }),
4049
4454
  children: [
4050
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4455
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
4051
4456
  "div",
4052
4457
  {
4053
4458
  className: getClassNameLayer("clickable"),
@@ -4078,22 +4483,22 @@ var LayerTree = ({
4078
4483
  setHoveringComponent(null);
4079
4484
  },
4080
4485
  children: [
4081
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4486
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4082
4487
  "div",
4083
4488
  {
4084
4489
  className: getClassNameLayer("chevron"),
4085
4490
  title: isSelected ? "Collapse" : "Expand",
4086
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(chevron_down_default, { size: "12" })
4491
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(chevron_down_default, { size: "12" })
4087
4492
  }
4088
4493
  ),
4089
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameLayer("title"), children: [
4090
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(type_default, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(grid_default, { size: "16" }) }),
4494
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassNameLayer("title"), children: [
4495
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(type_default, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(grid_default, { size: "16" }) }),
4091
4496
  item.type
4092
4497
  ] })
4093
4498
  ]
4094
4499
  }
4095
4500
  ) }),
4096
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4501
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4097
4502
  LayerTree,
4098
4503
  {
4099
4504
  data,
@@ -4138,7 +4543,7 @@ var flushZones = (appData) => {
4138
4543
  };
4139
4544
 
4140
4545
  // components/Puck/index.tsx
4141
- var import_jsx_runtime13 = require("react/jsx-runtime");
4546
+ var import_jsx_runtime21 = require("react/jsx-runtime");
4142
4547
  var defaultPageFields = {
4143
4548
  title: { type: "text" }
4144
4549
  };
@@ -4149,7 +4554,7 @@ var PluginRenderer = ({
4149
4554
  renderMethod
4150
4555
  }) => {
4151
4556
  return plugins.filter((item) => item[renderMethod]).map((item) => item[renderMethod]).reduce(
4152
- (accChildren, Item) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Item, { data, children: accChildren }),
4557
+ (accChildren, Item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Item, { data, children: accChildren }),
4153
4558
  children
4154
4559
  );
4155
4560
  };
@@ -4165,12 +4570,15 @@ function Puck({
4165
4570
  headerPath
4166
4571
  }) {
4167
4572
  var _a, _b;
4168
- const [reducer] = (0, import_react28.useState)(() => createReducer({ config }));
4573
+ const [reducer] = (0, import_react32.useState)(() => createReducer({ config }));
4169
4574
  const initialAppData = {
4170
4575
  data: initialData,
4171
- state: { leftSideBarVisible: true, itemSelector: null }
4576
+ state: {
4577
+ leftSideBarVisible: true,
4578
+ arrayState: {}
4579
+ }
4172
4580
  };
4173
- const [appData, dispatch] = (0, import_react28.useReducer)(
4581
+ const [appData, dispatch] = (0, import_react32.useReducer)(
4174
4582
  reducer,
4175
4583
  flushZones(initialAppData)
4176
4584
  );
@@ -4180,7 +4588,7 @@ function Puck({
4180
4588
  dispatch
4181
4589
  });
4182
4590
  const { itemSelector, leftSideBarVisible } = state;
4183
- const setItemSelector = (0, import_react28.useCallback)(
4591
+ const setItemSelector = (0, import_react32.useCallback)(
4184
4592
  (newItemSelector) => {
4185
4593
  dispatch({
4186
4594
  type: "setState",
@@ -4190,10 +4598,10 @@ function Puck({
4190
4598
  []
4191
4599
  );
4192
4600
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
4193
- const Page = (0, import_react28.useCallback)(
4601
+ const Page = (0, import_react32.useCallback)(
4194
4602
  (pageProps) => {
4195
4603
  var _a2, _b2;
4196
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4604
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4197
4605
  PluginRenderer,
4198
4606
  {
4199
4607
  plugins,
@@ -4205,8 +4613,8 @@ function Puck({
4205
4613
  },
4206
4614
  [config.root]
4207
4615
  );
4208
- const PageFieldWrapper = (0, import_react28.useCallback)(
4209
- (props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4616
+ const PageFieldWrapper = (0, import_react32.useCallback)(
4617
+ (props) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4210
4618
  PluginRenderer,
4211
4619
  {
4212
4620
  plugins,
@@ -4217,8 +4625,8 @@ function Puck({
4217
4625
  ),
4218
4626
  []
4219
4627
  );
4220
- const ComponentFieldWrapper = (0, import_react28.useCallback)(
4221
- (props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4628
+ const ComponentFieldWrapper = (0, import_react32.useCallback)(
4629
+ (props) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4222
4630
  PluginRenderer,
4223
4631
  {
4224
4632
  plugins,
@@ -4232,14 +4640,14 @@ function Puck({
4232
4640
  const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
4233
4641
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
4234
4642
  let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
4235
- (0, import_react28.useEffect)(() => {
4643
+ (0, import_react32.useEffect)(() => {
4236
4644
  if (onChange)
4237
4645
  onChange(data);
4238
4646
  }, [data]);
4239
4647
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
4240
- const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
4241
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "puck", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4242
- import_react_beautiful_dnd4.DragDropContext,
4648
+ const [draggedItem, setDraggedItem] = (0, import_react32.useState)();
4649
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "puck", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AppProvider, { value: { appData, dispatch }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4650
+ import_react_beautiful_dnd5.DragDropContext,
4243
4651
  {
4244
4652
  onDragUpdate: (update) => {
4245
4653
  setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
@@ -4290,7 +4698,7 @@ function Puck({
4290
4698
  });
4291
4699
  }
4292
4700
  },
4293
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4701
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4294
4702
  DropZoneProvider,
4295
4703
  {
4296
4704
  value: {
@@ -4304,13 +4712,8 @@ function Puck({
4304
4712
  mode: "edit",
4305
4713
  areaId: "root"
4306
4714
  },
4307
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
4308
- let path = (ctx == null ? void 0 : ctx.pathData) && selectedItem ? ctx == null ? void 0 : ctx.pathData[selectedItem == null ? void 0 : selectedItem.props.id] : void 0;
4309
- if (path) {
4310
- path = [{ label: "Page", selector: null }, ...path];
4311
- path = path.slice(path.length - 2, path.length - 1);
4312
- }
4313
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4715
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
4716
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4314
4717
  "div",
4315
4718
  {
4316
4719
  style: {
@@ -4326,7 +4729,7 @@ function Puck({
4326
4729
  right: 0
4327
4730
  },
4328
4731
  children: [
4329
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4732
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4330
4733
  "header",
4331
4734
  {
4332
4735
  style: {
@@ -4336,19 +4739,19 @@ function Puck({
4336
4739
  borderBottom: "1px solid var(--puck-color-grey-8)"
4337
4740
  },
4338
4741
  children: renderHeader ? renderHeader({
4339
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4742
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4340
4743
  Button,
4341
4744
  {
4342
4745
  onClick: () => {
4343
4746
  onPublish(data);
4344
4747
  },
4345
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(globe_default, { size: "14px" }),
4748
+ icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(globe_default, { size: "14px" }),
4346
4749
  children: "Publish"
4347
4750
  }
4348
4751
  ),
4349
4752
  data,
4350
4753
  dispatch
4351
- }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4754
+ }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4352
4755
  "div",
4353
4756
  {
4354
4757
  style: {
@@ -4359,14 +4762,14 @@ function Puck({
4359
4762
  gridTemplateRows: "auto"
4360
4763
  },
4361
4764
  children: [
4362
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4765
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4363
4766
  "div",
4364
4767
  {
4365
4768
  style: {
4366
4769
  display: "flex",
4367
4770
  gap: 16
4368
4771
  },
4369
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4772
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4370
4773
  IconButton,
4371
4774
  {
4372
4775
  onClick: () => dispatch({
@@ -4376,12 +4779,12 @@ function Puck({
4376
4779
  }
4377
4780
  }),
4378
4781
  title: "Toggle left sidebar",
4379
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(sidebar_default, {})
4782
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(sidebar_default, {})
4380
4783
  }
4381
4784
  )
4382
4785
  }
4383
4786
  ),
4384
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4787
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4385
4788
  "div",
4386
4789
  {
4387
4790
  style: {
@@ -4389,13 +4792,19 @@ function Puck({
4389
4792
  justifyContent: "center",
4390
4793
  alignItems: "center"
4391
4794
  },
4392
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Heading, { rank: 2, size: "xs", children: [
4795
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Heading, { rank: 2, size: "xs", children: [
4393
4796
  headerTitle || data.root.title || "Page",
4394
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { style: { fontWeight: 400, marginLeft: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { children: headerPath }) })
4797
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4798
+ "small",
4799
+ {
4800
+ style: { fontWeight: 400, marginLeft: 4 },
4801
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("code", { children: headerPath })
4802
+ }
4803
+ )
4395
4804
  ] })
4396
4805
  }
4397
4806
  ),
4398
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4807
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4399
4808
  "div",
4400
4809
  {
4401
4810
  style: {
@@ -4404,14 +4813,14 @@ function Puck({
4404
4813
  justifyContent: "flex-end"
4405
4814
  },
4406
4815
  children: [
4407
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex" }, children: [
4408
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4816
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex" }, children: [
4817
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4409
4818
  IconButton,
4410
4819
  {
4411
4820
  title: "undo",
4412
4821
  disabled: !canRewind,
4413
4822
  onClick: rewind,
4414
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4823
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4415
4824
  chevron_left_default,
4416
4825
  {
4417
4826
  size: 21,
@@ -4420,13 +4829,13 @@ function Puck({
4420
4829
  )
4421
4830
  }
4422
4831
  ),
4423
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4832
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4424
4833
  IconButton,
4425
4834
  {
4426
4835
  title: "redo",
4427
4836
  disabled: !canForward,
4428
4837
  onClick: forward,
4429
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4838
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4430
4839
  chevron_right_default,
4431
4840
  {
4432
4841
  size: 21,
@@ -4437,13 +4846,13 @@ function Puck({
4437
4846
  )
4438
4847
  ] }),
4439
4848
  renderHeaderActions && renderHeaderActions({ data, dispatch }),
4440
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4849
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4441
4850
  Button,
4442
4851
  {
4443
4852
  onClick: () => {
4444
4853
  onPublish(data);
4445
4854
  },
4446
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(globe_default, { size: "14px" }),
4855
+ icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(globe_default, { size: "14px" }),
4447
4856
  children: "Publish"
4448
4857
  }
4449
4858
  )
@@ -4455,7 +4864,7 @@ function Puck({
4455
4864
  )
4456
4865
  }
4457
4866
  ),
4458
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4867
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4459
4868
  "div",
4460
4869
  {
4461
4870
  style: {
@@ -4467,9 +4876,9 @@ function Puck({
4467
4876
  flexDirection: "column"
4468
4877
  },
4469
4878
  children: [
4470
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ComponentList, { config }) }),
4471
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(SidebarSection, { title: "Outline", children: [
4472
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4879
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComponentList, { config }) }),
4880
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(SidebarSection, { title: "Outline", children: [
4881
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4473
4882
  LayerTree,
4474
4883
  {
4475
4884
  data,
@@ -4481,7 +4890,7 @@ function Puck({
4481
4890
  ),
4482
4891
  Object.entries(findZonesForArea(data, "root")).map(
4483
4892
  ([zoneKey, zone]) => {
4484
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4893
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4485
4894
  LayerTree,
4486
4895
  {
4487
4896
  data,
@@ -4499,7 +4908,7 @@ function Puck({
4499
4908
  ]
4500
4909
  }
4501
4910
  ),
4502
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4911
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4503
4912
  "div",
4504
4913
  {
4505
4914
  style: {
@@ -4512,7 +4921,7 @@ function Puck({
4512
4921
  onClick: () => setItemSelector(null),
4513
4922
  id: "puck-frame",
4514
4923
  children: [
4515
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4924
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4516
4925
  "div",
4517
4926
  {
4518
4927
  className: "puck-root",
@@ -4521,18 +4930,18 @@ function Puck({
4521
4930
  margin: 32,
4522
4931
  zoom: 0.75
4523
4932
  },
4524
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4933
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4525
4934
  "div",
4526
4935
  {
4527
4936
  style: {
4528
4937
  border: "1px solid var(--puck-color-grey-8)"
4529
4938
  },
4530
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Page, __spreadProps(__spreadValues({ data }, data.root), { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropZone, { zone: rootDroppableId }) }))
4939
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Page, __spreadProps(__spreadValues({ data }, data.root), { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropZone, { zone: rootDroppableId }) }))
4531
4940
  }
4532
4941
  )
4533
4942
  }
4534
4943
  ),
4535
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4944
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4536
4945
  "div",
4537
4946
  {
4538
4947
  style: {
@@ -4545,7 +4954,7 @@ function Puck({
4545
4954
  ]
4546
4955
  }
4547
4956
  ),
4548
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4957
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4549
4958
  "div",
4550
4959
  {
4551
4960
  style: {
@@ -4557,12 +4966,11 @@ function Puck({
4557
4966
  flexDirection: "column",
4558
4967
  background: "var(--puck-color-white)"
4559
4968
  },
4560
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FieldWrapper, { data, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4969
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldWrapper, { data, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4561
4970
  SidebarSection,
4562
4971
  {
4563
4972
  noPadding: true,
4564
- breadcrumbs: path,
4565
- breadcrumbClick: (breadcrumb) => setItemSelector(breadcrumb.selector),
4973
+ showBreadcrumbs: true,
4566
4974
  title: selectedItem ? selectedItem.type : "Page",
4567
4975
  children: Object.keys(fields).map((fieldName) => {
4568
4976
  var _a2, _b2, _c, _d;
@@ -4616,7 +5024,7 @@ function Puck({
4616
5024
  }
4617
5025
  };
4618
5026
  if (selectedItem && itemSelector) {
4619
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5027
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4620
5028
  InputOrGroup,
4621
5029
  {
4622
5030
  field,
@@ -4632,13 +5040,15 @@ function Puck({
4632
5040
  `${selectedItem.props.id}_${fieldName}`
4633
5041
  );
4634
5042
  } else {
4635
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5043
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4636
5044
  InputOrGroup,
4637
5045
  {
4638
5046
  field,
4639
5047
  name: fieldName,
4640
5048
  label: field.label,
4641
- readOnly: ((_d = (_c = data.root._meta) == null ? void 0 : _c.locked) == null ? void 0 : _d.indexOf(fieldName)) > -1,
5049
+ readOnly: ((_d = (_c = data.root._meta) == null ? void 0 : _c.locked) == null ? void 0 : _d.indexOf(
5050
+ fieldName
5051
+ )) > -1,
4642
5052
  value: data.root[fieldName],
4643
5053
  onChange: onChange2
4644
5054
  },
@@ -4657,17 +5067,17 @@ function Puck({
4657
5067
  }
4658
5068
  )
4659
5069
  }
4660
- ) });
5070
+ ) }) });
4661
5071
  }
4662
5072
 
4663
5073
  // components/Render/index.tsx
4664
5074
  init_react_import();
4665
- var import_jsx_runtime14 = require("react/jsx-runtime");
5075
+ var import_jsx_runtime22 = require("react/jsx-runtime");
4666
5076
  function Render({ config, data }) {
4667
5077
  if (config.root) {
4668
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(config.root.render, __spreadProps(__spreadValues({}, data.root), { editMode: false, id: "puck-root", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZone, { zone: rootDroppableId }) })) });
5078
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(config.root.render, __spreadProps(__spreadValues({}, data.root), { editMode: false, id: "puck-root", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId }) })) });
4669
5079
  }
4670
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZone, { zone: rootDroppableId }) });
5080
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId }) });
4671
5081
  }
4672
5082
  // Annotate the CommonJS export names for ESM import in node:
4673
5083
  0 && (module.exports = {