@measured/puck 0.18.3-canary.098fdd1 → 0.18.3-canary.1d484ee

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -309,7 +309,7 @@ init_react_import();
309
309
  var styles_module_default2 = { "InputWrapper": "_InputWrapper_g5w3n_1", "Input-label": "_Input-label_g5w3n_5", "Input-labelIcon": "_Input-labelIcon_g5w3n_14", "Input-disabledIcon": "_Input-disabledIcon_g5w3n_21", "Input-input": "_Input-input_g5w3n_26", "Input": "_Input_g5w3n_1", "Input--readOnly": "_Input--readOnly_g5w3n_74", "Input-radioGroupItems": "_Input-radioGroupItems_g5w3n_85", "Input-radio": "_Input-radio_g5w3n_85", "Input-radioInner": "_Input-radioInner_g5w3n_102", "Input-radioInput": "_Input-radioInput_g5w3n_147" };
310
310
 
311
311
  // components/AutoField/index.tsx
312
- var import_react21 = require("react");
312
+ var import_react20 = require("react");
313
313
 
314
314
  // components/AutoField/fields/index.tsx
315
315
  init_react_import();
@@ -769,7 +769,7 @@ var IconButton = ({
769
769
  };
770
770
 
771
771
  // components/AutoField/fields/ArrayField/index.tsx
772
- var import_react13 = require("react");
772
+ var import_react12 = require("react");
773
773
 
774
774
  // components/DragIcon/index.tsx
775
775
  init_react_import();
@@ -1278,7 +1278,6 @@ function useAppContext() {
1278
1278
  // components/Sortable/index.tsx
1279
1279
  init_react_import();
1280
1280
  var import_react10 = require("@dnd-kit/react");
1281
- var import_react11 = require("react");
1282
1281
 
1283
1282
  // lib/dnd/dnd-kit/safe.ts
1284
1283
  init_react_import();
@@ -1301,7 +1300,8 @@ function useDraggableSafe(input) {
1301
1300
  function useSortableSafe(input) {
1302
1301
  if (typeof window === "undefined") {
1303
1302
  return { ref: () => {
1304
- }, status: "idle" };
1303
+ }, status: "idle", handleRef: () => {
1304
+ } };
1305
1305
  }
1306
1306
  return (0, import_sortable.useSortable)(input);
1307
1307
  }
@@ -1576,23 +1576,26 @@ function patchWindow(window2) {
1576
1576
 
1577
1577
  // lib/dnd/use-sensors.ts
1578
1578
  var import_utilities2 = require("@dnd-kit/dom/utilities");
1579
- var useSensors = () => {
1579
+ var useSensors = ({
1580
+ other,
1581
+ mouse,
1582
+ touch
1583
+ } = {
1584
+ touch: { delay: { value: 200, tolerance: 10 } },
1585
+ other: { delay: { value: 200, tolerance: 10 }, distance: { value: 5 } }
1586
+ }) => {
1580
1587
  const [sensors] = (0, import_react9.useState)(() => [
1581
1588
  PointerSensor.configure({
1582
1589
  activationConstraints(event, source) {
1583
1590
  var _a;
1584
1591
  const { pointerType, target } = event;
1585
1592
  if (pointerType === "mouse" && (0, import_utilities2.isElement)(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
1586
- return void 0;
1593
+ return mouse;
1587
1594
  }
1588
- const delay = { value: 200, tolerance: 10 };
1589
1595
  if (pointerType === "touch") {
1590
- return { delay };
1596
+ return touch;
1591
1597
  }
1592
- return {
1593
- delay,
1594
- distance: { value: 5 }
1595
- };
1598
+ return other;
1596
1599
  }
1597
1600
  })
1598
1601
  ]);
@@ -1935,31 +1938,27 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
1935
1938
  };
1936
1939
 
1937
1940
  // components/Sortable/index.tsx
1938
- var import_modifiers = require("@dnd-kit/dom/modifiers");
1939
1941
  var import_jsx_runtime6 = require("react/jsx-runtime");
1940
1942
  var SortableProvider = ({
1941
- container,
1942
1943
  children,
1943
1944
  onDragStart,
1944
1945
  onDragEnd,
1945
1946
  onMove
1946
1947
  }) => {
1947
- const [move, setMove] = (0, import_react11.useState)({ source: -1, target: -1 });
1948
- const sensors = useSensors();
1948
+ const sensors = useSensors({
1949
+ mouse: { distance: { value: 5 } }
1950
+ });
1949
1951
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1950
1952
  import_react10.DragDropProvider,
1951
1953
  {
1952
1954
  sensors,
1953
- modifiers: [
1954
- import_modifiers.RestrictToElement.configure({
1955
- element() {
1956
- return container.current;
1957
- }
1958
- })
1959
- ],
1960
- onDragStart,
1955
+ onDragStart: (event) => {
1956
+ var _a, _b;
1957
+ return onDragStart((_b = (_a = event.operation.source) == null ? void 0 : _a.id.toString()) != null ? _b : "");
1958
+ },
1961
1959
  onDragOver: (event, manager) => {
1962
1960
  var _a, _b;
1961
+ event.preventDefault();
1963
1962
  const { operation } = event;
1964
1963
  const { source, target } = operation;
1965
1964
  if (!source || !target) return;
@@ -1967,14 +1966,14 @@ var SortableProvider = ({
1967
1966
  let targetIndex = target.data.index;
1968
1967
  const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[target.id];
1969
1968
  if (sourceIndex !== targetIndex && source.id !== target.id) {
1970
- const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" ? "before" : "after";
1969
+ const collisionPosition = collisionData.direction === "up" ? "before" : "after";
1971
1970
  if (targetIndex >= sourceIndex) {
1972
1971
  targetIndex = targetIndex - 1;
1973
1972
  }
1974
1973
  if (collisionPosition === "after") {
1975
1974
  targetIndex = targetIndex + 1;
1976
1975
  }
1977
- setMove({
1976
+ onMove({
1978
1977
  source: sourceIndex,
1979
1978
  target: targetIndex
1980
1979
  });
@@ -1982,12 +1981,8 @@ var SortableProvider = ({
1982
1981
  },
1983
1982
  onDragEnd: () => {
1984
1983
  setTimeout(() => {
1985
- if (move.source !== -1 && move.target !== -1) {
1986
- onMove(move);
1987
- }
1988
1984
  onDragEnd();
1989
1985
  }, 250);
1990
- setMove({ source: -1, target: -1 });
1991
1986
  },
1992
1987
  children
1993
1988
  }
@@ -2000,7 +1995,11 @@ var Sortable = ({
2000
1995
  children,
2001
1996
  type = "item"
2002
1997
  }) => {
2003
- const { ref: sortableRef, status } = useSortableSafe({
1998
+ const {
1999
+ ref: sortableRef,
2000
+ status,
2001
+ handleRef
2002
+ } = useSortableSafe({
2004
2003
  id,
2005
2004
  type,
2006
2005
  index,
@@ -2008,16 +2007,16 @@ var Sortable = ({
2008
2007
  data: { index },
2009
2008
  collisionDetector: createDynamicCollisionDetector("y")
2010
2009
  });
2011
- return children({ status, ref: sortableRef });
2010
+ return children({ status, ref: sortableRef, handleRef });
2012
2011
  };
2013
2012
 
2014
2013
  // components/AutoField/context.tsx
2015
2014
  init_react_import();
2016
- var import_react12 = require("react");
2015
+ var import_react11 = require("react");
2017
2016
  var import_jsx_runtime7 = require("react/jsx-runtime");
2018
- var NestedFieldContext = (0, import_react12.createContext)({});
2017
+ var NestedFieldContext = (0, import_react11.createContext)({});
2019
2018
  var useNestedFieldContext = () => {
2020
- const context = (0, import_react12.useContext)(NestedFieldContext);
2019
+ const context = (0, import_react11.useContext)(NestedFieldContext);
2021
2020
  return __spreadProps(__spreadValues({}, context), {
2022
2021
  readOnlyFields: context.readOnlyFields || {}
2023
2022
  });
@@ -2031,7 +2030,7 @@ var NestedFieldProvider = ({
2031
2030
  }) => {
2032
2031
  const subPath = `${name}.${subName}`;
2033
2032
  const wildcardSubPath = `${wildcardName}.${subName}`;
2034
- const subReadOnlyFields = (0, import_react12.useMemo)(
2033
+ const subReadOnlyFields = (0, import_react11.useMemo)(
2035
2034
  () => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
2036
2035
  const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
2037
2036
  if (isLocal) {
@@ -2082,11 +2081,17 @@ var ArrayField = ({
2082
2081
  }),
2083
2082
  openId: ""
2084
2083
  };
2085
- const [localState, setLocalState] = (0, import_react13.useState)({ arrayState, value });
2086
- (0, import_react13.useEffect)(() => {
2087
- setLocalState({ arrayState, value });
2088
- }, [value, state.ui.arrayState[id]]);
2089
- const mapArrayStateToUi = (0, import_react13.useCallback)(
2084
+ const [localState, setLocalState] = (0, import_react12.useState)({ arrayState, value });
2085
+ const updateLocalState = (0, import_react12.useCallback)(
2086
+ (value2) => {
2087
+ setLocalState({ arrayState, value: value2 });
2088
+ },
2089
+ [arrayState]
2090
+ );
2091
+ (0, import_react12.useEffect)(() => {
2092
+ updateLocalState(value);
2093
+ }, [value]);
2094
+ const mapArrayStateToUi = (0, import_react12.useCallback)(
2090
2095
  (partialArrayState) => {
2091
2096
  return {
2092
2097
  arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
@@ -2096,13 +2101,13 @@ var ArrayField = ({
2096
2101
  },
2097
2102
  [arrayState]
2098
2103
  );
2099
- const getHighestIndex = (0, import_react13.useCallback)(() => {
2104
+ const getHighestIndex = (0, import_react12.useCallback)(() => {
2100
2105
  return arrayState.items.reduce(
2101
2106
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
2102
2107
  -1
2103
2108
  );
2104
2109
  }, [arrayState]);
2105
- const regenerateArrayState = (0, import_react13.useCallback)(
2110
+ const regenerateArrayState = (0, import_react12.useCallback)(
2106
2111
  (value2) => {
2107
2112
  let highestIndex = getHighestIndex();
2108
2113
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -2121,13 +2126,13 @@ var ArrayField = ({
2121
2126
  },
2122
2127
  [arrayState]
2123
2128
  );
2124
- (0, import_react13.useEffect)(() => {
2129
+ (0, import_react12.useEffect)(() => {
2125
2130
  if (arrayState.items.length > 0) {
2126
2131
  setUi(mapArrayStateToUi(arrayState));
2127
2132
  }
2128
2133
  }, []);
2129
- const [isDragging, setIsDragging] = (0, import_react13.useState)(false);
2130
- const dndContainerRef = (0, import_react13.useRef)(null);
2134
+ const [draggedItem, setDraggedItem] = (0, import_react12.useState)("");
2135
+ const isDragging = !!draggedItem;
2131
2136
  const forceReadOnly = getPermissions({ item: selectedItem }).edit === false;
2132
2137
  if (field.type !== "array" || !field.arrayFields) {
2133
2138
  return null;
@@ -2143,11 +2148,16 @@ var ArrayField = ({
2143
2148
  children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2144
2149
  SortableProvider,
2145
2150
  {
2146
- container: dndContainerRef,
2147
- onDragStart: () => setIsDragging(true),
2148
- onDragEnd: () => setIsDragging(false),
2151
+ onDragStart: (id2) => setDraggedItem(id2),
2152
+ onDragEnd: () => {
2153
+ setDraggedItem("");
2154
+ onChange(localState.value);
2155
+ },
2149
2156
  onMove: (move) => {
2150
- const newValue = reorder(value, move.source, move.target);
2157
+ if (arrayState.items[move.source]._arrayId !== draggedItem) {
2158
+ return;
2159
+ }
2160
+ const newValue = reorder(localState.value, move.source, move.target);
2151
2161
  const newArrayStateItems = reorder(
2152
2162
  arrayState.items,
2153
2163
  move.source,
@@ -2159,7 +2169,6 @@ var ArrayField = ({
2159
2169
  })
2160
2170
  };
2161
2171
  setUi(newUi, false);
2162
- onChange(newValue, newUi);
2163
2172
  setLocalState({
2164
2173
  value: newValue,
2165
2174
  arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
@@ -2173,172 +2182,156 @@ var ArrayField = ({
2173
2182
  addDisabled
2174
2183
  }),
2175
2184
  children: [
2176
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2177
- "div",
2178
- {
2179
- ref: dndContainerRef,
2180
- className: getClassName5("inner"),
2181
- "data-dnd-container": true,
2182
- children: localState.arrayState.items.map((item, i) => {
2183
- const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
2184
- const data = Array.from(localState.value || [])[i] || {};
2185
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2186
- Sortable,
2185
+ localState.arrayState.items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
2186
+ const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
2187
+ const data = Array.from(localState.value || [])[i] || {};
2188
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2189
+ Sortable,
2190
+ {
2191
+ id: _arrayId,
2192
+ index: i,
2193
+ disabled: readOnly,
2194
+ children: ({ status, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2195
+ "div",
2187
2196
  {
2188
- id: _arrayId,
2189
- index: i,
2190
- disabled: readOnly,
2191
- children: ({ status, ref }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2192
- "div",
2193
- {
2194
- ref,
2195
- className: getClassNameItem({
2196
- isExpanded: arrayState.openId === _arrayId,
2197
- isDragging: status === "dragging",
2198
- readOnly
2199
- }),
2200
- children: [
2201
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2202
- "div",
2203
- {
2204
- onClick: (e) => {
2205
- if (isDragging) return;
2206
- e.preventDefault();
2207
- e.stopPropagation();
2208
- if (arrayState.openId === _arrayId) {
2209
- setUi(
2210
- mapArrayStateToUi({
2211
- openId: ""
2212
- })
2213
- );
2214
- } else {
2215
- setUi(
2216
- mapArrayStateToUi({
2217
- openId: _arrayId
2218
- })
2219
- );
2220
- }
2221
- },
2222
- className: getClassNameItem("summary"),
2223
- children: [
2224
- field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
2225
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("rhs"), children: [
2226
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("actions"), children: [
2227
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2228
- IconButton,
2229
- {
2230
- type: "button",
2231
- disabled: !!addDisabled,
2232
- onClick: (e) => {
2233
- e.stopPropagation();
2234
- const existingValue = [...value || []];
2235
- existingValue.splice(
2236
- i,
2237
- 0,
2238
- existingValue[i]
2239
- );
2240
- onChange(
2241
- existingValue,
2242
- mapArrayStateToUi(
2243
- regenerateArrayState(existingValue)
2244
- )
2245
- );
2246
- },
2247
- title: "Duplicate",
2248
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Copy, { size: 16 })
2249
- }
2250
- ) }),
2251
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2252
- IconButton,
2253
- {
2254
- type: "button",
2255
- disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
2256
- onClick: (e) => {
2257
- e.stopPropagation();
2258
- const existingValue = [...value || []];
2259
- const existingItems = [
2260
- ...arrayState.items || []
2261
- ];
2262
- existingValue.splice(i, 1);
2263
- existingItems.splice(i, 1);
2264
- onChange(
2265
- existingValue,
2266
- mapArrayStateToUi({
2267
- items: existingItems
2268
- })
2269
- );
2270
- },
2271
- title: "Delete",
2272
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Trash, { size: 16 })
2273
- }
2274
- ) })
2275
- ] }),
2276
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DragIcon, {}) })
2277
- ] })
2278
- ]
2197
+ ref,
2198
+ className: getClassNameItem({
2199
+ isExpanded: arrayState.openId === _arrayId,
2200
+ isDragging: status === "dragging",
2201
+ readOnly
2202
+ }),
2203
+ children: [
2204
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2205
+ "div",
2206
+ {
2207
+ ref: handleRef,
2208
+ onClick: (e) => {
2209
+ if (isDragging) return;
2210
+ e.preventDefault();
2211
+ e.stopPropagation();
2212
+ if (arrayState.openId === _arrayId) {
2213
+ setUi(
2214
+ mapArrayStateToUi({
2215
+ openId: ""
2216
+ })
2217
+ );
2218
+ } else {
2219
+ setUi(
2220
+ mapArrayStateToUi({
2221
+ openId: _arrayId
2222
+ })
2223
+ );
2279
2224
  }
2280
- ),
2281
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2282
- "fieldset",
2283
- {
2284
- className: getClassNameItem("fieldset"),
2285
- onPointerDownCapture: (e) => {
2286
- e.stopPropagation();
2287
- },
2288
- children: Object.keys(field.arrayFields).map((subName) => {
2289
- const subField = field.arrayFields[subName];
2290
- const indexName = `${name}[${i}]`;
2291
- const subPath = `${indexName}.${subName}`;
2292
- const localIndexName = `${localName}[${i}]`;
2293
- const localWildcardName = `${localName}[*]`;
2294
- const localSubPath = `${localIndexName}.${subName}`;
2295
- const localWildcardSubPath = `${localWildcardName}.${subName}`;
2296
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2297
- const label2 = subField.label || subName;
2298
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2299
- NestedFieldProvider,
2225
+ },
2226
+ className: getClassNameItem("summary"),
2227
+ children: [
2228
+ field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
2229
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("rhs"), children: [
2230
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("actions"), children: [
2231
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2232
+ IconButton,
2300
2233
  {
2301
- name: localIndexName,
2302
- wildcardName: localWildcardName,
2303
- subName,
2304
- readOnlyFields,
2305
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2306
- AutoFieldPrivate,
2307
- {
2308
- name: subPath,
2309
- label: label2,
2310
- id: `${_arrayId}_${subName}`,
2311
- readOnly: subReadOnly,
2312
- field: __spreadProps(__spreadValues({}, subField), {
2313
- label: label2
2314
- // May be used by custom fields
2315
- }),
2316
- value: data[subName],
2317
- onChange: (val, ui) => {
2318
- onChange(
2319
- replace(value, i, __spreadProps(__spreadValues({}, data), {
2320
- [subName]: val
2321
- })),
2322
- ui
2323
- );
2324
- }
2325
- }
2326
- )
2327
- },
2328
- subPath
2329
- );
2330
- })
2331
- }
2332
- ) })
2333
- ]
2334
- }
2335
- )
2336
- },
2337
- _arrayId
2338
- );
2339
- })
2340
- }
2341
- ),
2234
+ type: "button",
2235
+ disabled: !!addDisabled,
2236
+ onClick: (e) => {
2237
+ e.stopPropagation();
2238
+ const existingValue = [...value || []];
2239
+ existingValue.splice(
2240
+ i,
2241
+ 0,
2242
+ existingValue[i]
2243
+ );
2244
+ onChange(
2245
+ existingValue,
2246
+ mapArrayStateToUi(
2247
+ regenerateArrayState(existingValue)
2248
+ )
2249
+ );
2250
+ },
2251
+ title: "Duplicate",
2252
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Copy, { size: 16 })
2253
+ }
2254
+ ) }),
2255
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2256
+ IconButton,
2257
+ {
2258
+ type: "button",
2259
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
2260
+ onClick: (e) => {
2261
+ e.stopPropagation();
2262
+ const existingValue = [...value || []];
2263
+ const existingItems = [
2264
+ ...arrayState.items || []
2265
+ ];
2266
+ existingValue.splice(i, 1);
2267
+ existingItems.splice(i, 1);
2268
+ onChange(
2269
+ existingValue,
2270
+ mapArrayStateToUi({
2271
+ items: existingItems
2272
+ })
2273
+ );
2274
+ },
2275
+ title: "Delete",
2276
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Trash, { size: 16 })
2277
+ }
2278
+ ) })
2279
+ ] }),
2280
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DragIcon, {}) })
2281
+ ] })
2282
+ ]
2283
+ }
2284
+ ),
2285
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
2286
+ const subField = field.arrayFields[subName];
2287
+ const indexName = `${name}[${i}]`;
2288
+ const subPath = `${indexName}.${subName}`;
2289
+ const localIndexName = `${localName}[${i}]`;
2290
+ const localWildcardName = `${localName}[*]`;
2291
+ const localSubPath = `${localIndexName}.${subName}`;
2292
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
2293
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2294
+ const label2 = subField.label || subName;
2295
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2296
+ NestedFieldProvider,
2297
+ {
2298
+ name: localIndexName,
2299
+ wildcardName: localWildcardName,
2300
+ subName,
2301
+ readOnlyFields,
2302
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2303
+ AutoFieldPrivate,
2304
+ {
2305
+ name: subPath,
2306
+ label: label2,
2307
+ id: `${_arrayId}_${subName}`,
2308
+ readOnly: subReadOnly,
2309
+ field: __spreadProps(__spreadValues({}, subField), {
2310
+ label: label2
2311
+ // May be used by custom fields
2312
+ }),
2313
+ value: data[subName],
2314
+ onChange: (val, ui) => {
2315
+ onChange(
2316
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
2317
+ [subName]: val
2318
+ })),
2319
+ ui
2320
+ );
2321
+ }
2322
+ }
2323
+ )
2324
+ },
2325
+ subPath
2326
+ );
2327
+ }) }) })
2328
+ ]
2329
+ }
2330
+ )
2331
+ },
2332
+ _arrayId
2333
+ );
2334
+ }) }),
2342
2335
  !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2343
2336
  "button",
2344
2337
  {
@@ -2426,11 +2419,11 @@ var DefaultField = ({
2426
2419
 
2427
2420
  // components/AutoField/fields/ExternalField/index.tsx
2428
2421
  init_react_import();
2429
- var import_react17 = require("react");
2422
+ var import_react16 = require("react");
2430
2423
 
2431
2424
  // components/ExternalInput/index.tsx
2432
2425
  init_react_import();
2433
- var import_react16 = require("react");
2426
+ var import_react15 = require("react");
2434
2427
 
2435
2428
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
2436
2429
  init_react_import();
@@ -2438,7 +2431,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
2438
2431
 
2439
2432
  // components/Modal/index.tsx
2440
2433
  init_react_import();
2441
- var import_react14 = require("react");
2434
+ var import_react13 = require("react");
2442
2435
 
2443
2436
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
2444
2437
  init_react_import();
@@ -2453,8 +2446,8 @@ var Modal = ({
2453
2446
  onClose,
2454
2447
  isOpen
2455
2448
  }) => {
2456
- const [rootEl, setRootEl] = (0, import_react14.useState)(null);
2457
- (0, import_react14.useEffect)(() => {
2449
+ const [rootEl, setRootEl] = (0, import_react13.useState)(null);
2450
+ (0, import_react13.useEffect)(() => {
2458
2451
  setRootEl(document.getElementById("puck-portal-root"));
2459
2452
  }, []);
2460
2453
  if (!rootEl) {
@@ -2501,7 +2494,7 @@ init_react_import();
2501
2494
 
2502
2495
  // components/Button/Button.tsx
2503
2496
  init_react_import();
2504
- var import_react15 = require("react");
2497
+ var import_react14 = require("react");
2505
2498
 
2506
2499
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
2507
2500
  init_react_import();
@@ -2551,8 +2544,8 @@ var Button = (_a) => {
2551
2544
  "size",
2552
2545
  "loading"
2553
2546
  ]);
2554
- const [loading, setLoading] = (0, import_react15.useState)(loadingProp);
2555
- (0, import_react15.useEffect)(() => setLoading(loadingProp), [loadingProp]);
2547
+ const [loading, setLoading] = (0, import_react14.useState)(loadingProp);
2548
+ (0, import_react14.useEffect)(() => setLoading(loadingProp), [loadingProp]);
2556
2549
  const ElementType = href ? "a" : type ? "button" : "span";
2557
2550
  const dataAttrs = filterDataAttrs(props);
2558
2551
  const el = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
@@ -2607,28 +2600,28 @@ var ExternalInput = ({
2607
2600
  mapRow = (val) => val,
2608
2601
  filterFields
2609
2602
  } = field || {};
2610
- const [data, setData] = (0, import_react16.useState)([]);
2611
- const [isOpen, setOpen] = (0, import_react16.useState)(false);
2612
- const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
2603
+ const [data, setData] = (0, import_react15.useState)([]);
2604
+ const [isOpen, setOpen] = (0, import_react15.useState)(false);
2605
+ const [isLoading, setIsLoading] = (0, import_react15.useState)(true);
2613
2606
  const hasFilterFields = !!filterFields;
2614
- const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
2615
- const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
2616
- const mappedData = (0, import_react16.useMemo)(() => {
2607
+ const [filters, setFilters] = (0, import_react15.useState)(field.initialFilters || {});
2608
+ const [filtersToggled, setFiltersToggled] = (0, import_react15.useState)(hasFilterFields);
2609
+ const mappedData = (0, import_react15.useMemo)(() => {
2617
2610
  return data.map(mapRow);
2618
2611
  }, [data]);
2619
- const keys = (0, import_react16.useMemo)(() => {
2612
+ const keys = (0, import_react15.useMemo)(() => {
2620
2613
  const validKeys = /* @__PURE__ */ new Set();
2621
2614
  for (const item of mappedData) {
2622
2615
  for (const key of Object.keys(item)) {
2623
- if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react16.isValidElement)(item[key])) {
2616
+ if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react15.isValidElement)(item[key])) {
2624
2617
  validKeys.add(key);
2625
2618
  }
2626
2619
  }
2627
2620
  }
2628
2621
  return Array.from(validKeys);
2629
2622
  }, [mappedData]);
2630
- const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
2631
- const search = (0, import_react16.useCallback)(
2623
+ const [searchQuery, setSearchQuery] = (0, import_react15.useState)(field.initialQuery || "");
2624
+ const search = (0, import_react15.useCallback)(
2632
2625
  (query, filters2) => __async(void 0, null, function* () {
2633
2626
  setIsLoading(true);
2634
2627
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
@@ -2641,7 +2634,7 @@ var ExternalInput = ({
2641
2634
  }),
2642
2635
  [id, field]
2643
2636
  );
2644
- const Footer = (0, import_react16.useCallback)(
2637
+ const Footer = (0, import_react15.useCallback)(
2645
2638
  (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: getClassNameModal("footer"), children: [
2646
2639
  props.items.length,
2647
2640
  " result",
@@ -2649,7 +2642,7 @@ var ExternalInput = ({
2649
2642
  ] }),
2650
2643
  [field.renderFooter]
2651
2644
  );
2652
- (0, import_react16.useEffect)(() => {
2645
+ (0, import_react15.useEffect)(() => {
2653
2646
  search(searchQuery, filters);
2654
2647
  }, []);
2655
2648
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
@@ -2820,7 +2813,7 @@ var ExternalField = ({
2820
2813
  var _a, _b, _c;
2821
2814
  const validField = field;
2822
2815
  const deprecatedField = field;
2823
- (0, import_react17.useEffect)(() => {
2816
+ (0, import_react16.useEffect)(() => {
2824
2817
  if (deprecatedField.adaptor) {
2825
2818
  console.error(
2826
2819
  "Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
@@ -2855,7 +2848,7 @@ var ExternalField = ({
2855
2848
 
2856
2849
  // components/AutoField/fields/RadioField/index.tsx
2857
2850
  init_react_import();
2858
- var import_react18 = require("react");
2851
+ var import_react17 = require("react");
2859
2852
 
2860
2853
  // lib/safe-json-parse.ts
2861
2854
  init_react_import();
@@ -2881,7 +2874,7 @@ var RadioField = ({
2881
2874
  label,
2882
2875
  Label: Label2
2883
2876
  }) => {
2884
- const flatOptions = (0, import_react18.useMemo)(
2877
+ const flatOptions = (0, import_react17.useMemo)(
2885
2878
  () => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
2886
2879
  [field]
2887
2880
  );
@@ -2931,7 +2924,7 @@ var RadioField = ({
2931
2924
 
2932
2925
  // components/AutoField/fields/SelectField/index.tsx
2933
2926
  init_react_import();
2934
- var import_react19 = require("react");
2927
+ var import_react18 = require("react");
2935
2928
  var import_jsx_runtime16 = require("react/jsx-runtime");
2936
2929
  var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
2937
2930
  var SelectField = ({
@@ -2944,7 +2937,7 @@ var SelectField = ({
2944
2937
  readOnly,
2945
2938
  id
2946
2939
  }) => {
2947
- const flatOptions = (0, import_react19.useMemo)(
2940
+ const flatOptions = (0, import_react18.useMemo)(
2948
2941
  () => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
2949
2942
  [field]
2950
2943
  );
@@ -3096,7 +3089,7 @@ var ObjectField = ({
3096
3089
 
3097
3090
  // lib/use-safe-id.ts
3098
3091
  init_react_import();
3099
- var import_react20 = __toESM(require("react"));
3092
+ var import_react19 = __toESM(require("react"));
3100
3093
 
3101
3094
  // lib/generate-id.ts
3102
3095
  init_react_import();
@@ -3105,10 +3098,10 @@ var generateId = (type) => type ? `${type}-${(0, import_uuid.v4)()}` : (0, impor
3105
3098
 
3106
3099
  // lib/use-safe-id.ts
3107
3100
  var useSafeId = () => {
3108
- if (typeof import_react20.default.useId !== "undefined") {
3109
- return import_react20.default.useId();
3101
+ if (typeof import_react19.default.useId !== "undefined") {
3102
+ return import_react19.default.useId();
3110
3103
  }
3111
- const [id] = (0, import_react20.useState)(generateId());
3104
+ const [id] = (0, import_react19.useState)(generateId());
3112
3105
  return id;
3113
3106
  };
3114
3107
 
@@ -3142,7 +3135,7 @@ var FieldLabelInternal = ({
3142
3135
  readOnly
3143
3136
  }) => {
3144
3137
  const { overrides } = useAppContext();
3145
- const Wrapper = (0, import_react21.useMemo)(
3138
+ const Wrapper = (0, import_react20.useMemo)(
3146
3139
  () => overrides.fieldLabel || FieldLabel,
3147
3140
  [overrides]
3148
3141
  );
@@ -3164,7 +3157,7 @@ var FieldLabelInternal = ({
3164
3157
  function AutoFieldInternal(props) {
3165
3158
  var _a, _b, _c, _d, _e, _f, _g, _h;
3166
3159
  const { dispatch, overrides, selectedItem } = useAppContext();
3167
- const nestedFieldContext = (0, import_react21.useContext)(NestedFieldContext);
3160
+ const nestedFieldContext = (0, import_react20.useContext)(NestedFieldContext);
3168
3161
  const { id, Label: Label2 = FieldLabelInternal } = props;
3169
3162
  const field = props.field;
3170
3163
  const label = field.label;
@@ -3196,7 +3189,7 @@ function AutoFieldInternal(props) {
3196
3189
  Label: Label2,
3197
3190
  id: resolvedId
3198
3191
  });
3199
- const onFocus = (0, import_react21.useCallback)(
3192
+ const onFocus = (0, import_react20.useCallback)(
3200
3193
  (e) => {
3201
3194
  if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
3202
3195
  e.stopPropagation();
@@ -3210,7 +3203,7 @@ function AutoFieldInternal(props) {
3210
3203
  },
3211
3204
  [mergedProps.name]
3212
3205
  );
3213
- const onBlur = (0, import_react21.useCallback)((e) => {
3206
+ const onBlur = (0, import_react20.useCallback)((e) => {
3214
3207
  if ("name" in e.target) {
3215
3208
  dispatch({
3216
3209
  type: "setUi",
@@ -3254,7 +3247,7 @@ function AutoFieldInternal(props) {
3254
3247
  function AutoFieldPrivate(props) {
3255
3248
  const { state } = useAppContext();
3256
3249
  const { value, onChange } = props;
3257
- const [localValue, setLocalValue] = (0, import_react21.useState)(value);
3250
+ const [localValue, setLocalValue] = (0, import_react20.useState)(value);
3258
3251
  const onChangeDb = (0, import_use_debounce.useDebouncedCallback)(
3259
3252
  (val, ui) => {
3260
3253
  onChange(val, ui);
@@ -3262,14 +3255,14 @@ function AutoFieldPrivate(props) {
3262
3255
  50,
3263
3256
  { leading: true }
3264
3257
  );
3265
- const onChangeLocal = (0, import_react21.useCallback)(
3258
+ const onChangeLocal = (0, import_react20.useCallback)(
3266
3259
  (val, ui) => {
3267
3260
  setLocalValue(val);
3268
3261
  onChangeDb(val, ui);
3269
3262
  },
3270
3263
  [onChange]
3271
3264
  );
3272
- (0, import_react21.useEffect)(() => {
3265
+ (0, import_react20.useEffect)(() => {
3273
3266
  if (state.ui.field.focus !== props.name) {
3274
3267
  setLocalValue(value);
3275
3268
  }
@@ -3281,7 +3274,7 @@ function AutoFieldPrivate(props) {
3281
3274
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
3282
3275
  }
3283
3276
  function AutoField(props) {
3284
- const DefaultLabel = (0, import_react21.useMemo)(() => {
3277
+ const DefaultLabel = (0, import_react20.useMemo)(() => {
3285
3278
  const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3286
3279
  "div",
3287
3280
  __spreadProps(__spreadValues({}, labelProps), {
@@ -3301,21 +3294,21 @@ init_react_import();
3301
3294
  var styles_module_default10 = { "Drawer": "_Drawer_fkqfo_1", "Drawer-draggable": "_Drawer-draggable_fkqfo_8", "Drawer-draggableBg": "_Drawer-draggableBg_fkqfo_12", "Drawer-draggableFg": "_Drawer-draggableFg_fkqfo_21", "DrawerItem-draggable": "_DrawerItem-draggable_fkqfo_25", "DrawerItem--disabled": "_DrawerItem--disabled_fkqfo_38", "DrawerItem": "_DrawerItem_fkqfo_25", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_fkqfo_48", "DrawerItem-name": "_DrawerItem-name_fkqfo_66" };
3302
3295
 
3303
3296
  // components/Drawer/index.tsx
3304
- var import_react33 = require("react");
3297
+ var import_react32 = require("react");
3305
3298
 
3306
3299
  // components/DragDropContext/index.tsx
3307
3300
  init_react_import();
3308
- var import_react31 = require("@dnd-kit/react");
3309
- var import_react32 = require("react");
3301
+ var import_react30 = require("@dnd-kit/react");
3302
+ var import_react31 = require("react");
3310
3303
  var import_dom = require("@dnd-kit/dom");
3311
3304
 
3312
3305
  // components/DropZone/index.tsx
3313
3306
  init_react_import();
3314
- var import_react30 = require("react");
3307
+ var import_react29 = require("react");
3315
3308
 
3316
3309
  // components/DraggableComponent/index.tsx
3317
3310
  init_react_import();
3318
- var import_react24 = require("react");
3311
+ var import_react23 = require("react");
3319
3312
 
3320
3313
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
3321
3314
  init_react_import();
@@ -3345,11 +3338,11 @@ function getDeepScrollPosition(element) {
3345
3338
 
3346
3339
  // components/DropZone/context.tsx
3347
3340
  init_react_import();
3348
- var import_react22 = require("react");
3341
+ var import_react21 = require("react");
3349
3342
  var import_zustand = require("zustand");
3350
3343
  var import_jsx_runtime20 = require("react/jsx-runtime");
3351
- var dropZoneContext = (0, import_react22.createContext)(null);
3352
- var ZoneStoreContext = (0, import_react22.createContext)(
3344
+ var dropZoneContext = (0, import_react21.createContext)(null);
3345
+ var ZoneStoreContext = (0, import_react21.createContext)(
3353
3346
  (0, import_zustand.createStore)(() => ({
3354
3347
  zoneDepthIndex: {},
3355
3348
  nextZoneDepthIndex: {},
@@ -3369,19 +3362,19 @@ var DropZoneProvider = ({
3369
3362
  children,
3370
3363
  value
3371
3364
  }) => {
3372
- const [hoveringComponent, setHoveringComponent] = (0, import_react22.useState)();
3373
- const [areasWithZones, setAreasWithZones] = (0, import_react22.useState)(
3365
+ const [hoveringComponent, setHoveringComponent] = (0, import_react21.useState)();
3366
+ const [areasWithZones, setAreasWithZones] = (0, import_react21.useState)(
3374
3367
  {}
3375
3368
  );
3376
- const [activeZones, setActiveZones] = (0, import_react22.useState)({});
3369
+ const [activeZones, setActiveZones] = (0, import_react21.useState)({});
3377
3370
  const { dispatch } = useAppContext();
3378
- const registerZoneArea = (0, import_react22.useCallback)(
3371
+ const registerZoneArea = (0, import_react21.useCallback)(
3379
3372
  (area) => {
3380
3373
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
3381
3374
  },
3382
3375
  [setAreasWithZones]
3383
3376
  );
3384
- const registerZone = (0, import_react22.useCallback)(
3377
+ const registerZone = (0, import_react21.useCallback)(
3385
3378
  (zoneCompound) => {
3386
3379
  if (!dispatch) {
3387
3380
  return;
@@ -3394,7 +3387,7 @@ var DropZoneProvider = ({
3394
3387
  },
3395
3388
  [setActiveZones, dispatch]
3396
3389
  );
3397
- const unregisterZone = (0, import_react22.useCallback)(
3390
+ const unregisterZone = (0, import_react21.useCallback)(
3398
3391
  (zoneCompound) => {
3399
3392
  if (!dispatch) {
3400
3393
  return;
@@ -3409,7 +3402,7 @@ var DropZoneProvider = ({
3409
3402
  },
3410
3403
  [setActiveZones, dispatch]
3411
3404
  );
3412
- const memoValue = (0, import_react22.useMemo)(
3405
+ const memoValue = (0, import_react21.useMemo)(
3413
3406
  () => __spreadValues({
3414
3407
  hoveringComponent,
3415
3408
  setHoveringComponent,
@@ -3426,11 +3419,11 @@ var DropZoneProvider = ({
3426
3419
 
3427
3420
  // lib/use-context-store.ts
3428
3421
  init_react_import();
3429
- var import_react23 = require("react");
3422
+ var import_react22 = require("react");
3430
3423
  var import_zustand2 = require("zustand");
3431
3424
  var import_shallow = require("zustand/react/shallow");
3432
3425
  function useContextStore(context, selector) {
3433
- const store = (0, import_react23.useContext)(context);
3426
+ const store = (0, import_react22.useContext)(context);
3434
3427
  if (!store) {
3435
3428
  throw new Error("useContextStore must be used inside context");
3436
3429
  }
@@ -3489,9 +3482,9 @@ var DraggableComponent = ({
3489
3482
  iframe,
3490
3483
  state
3491
3484
  } = useAppContext();
3492
- const ctx = (0, import_react24.useContext)(dropZoneContext);
3493
- const [localZones, setLocalZones] = (0, import_react24.useState)({});
3494
- const registerLocalZone = (0, import_react24.useCallback)(
3485
+ const ctx = (0, import_react23.useContext)(dropZoneContext);
3486
+ const [localZones, setLocalZones] = (0, import_react23.useState)({});
3487
+ const registerLocalZone = (0, import_react23.useCallback)(
3495
3488
  (zoneCompound2, active) => {
3496
3489
  var _a;
3497
3490
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -3501,7 +3494,7 @@ var DraggableComponent = ({
3501
3494
  },
3502
3495
  [setLocalZones]
3503
3496
  );
3504
- const unregisterLocalZone = (0, import_react24.useCallback)(
3497
+ const unregisterLocalZone = (0, import_react23.useCallback)(
3505
3498
  (zoneCompound2) => {
3506
3499
  var _a;
3507
3500
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -3515,8 +3508,8 @@ var DraggableComponent = ({
3515
3508
  );
3516
3509
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
3517
3510
  const { path = [] } = ctx || {};
3518
- const [canDrag, setCanDrag] = (0, import_react24.useState)(false);
3519
- (0, import_react24.useEffect)(() => {
3511
+ const [canDrag, setCanDrag] = (0, import_react23.useState)(false);
3512
+ (0, import_react23.useEffect)(() => {
3520
3513
  var _a;
3521
3514
  const item = getItem({ index, zone: zoneCompound }, state.data);
3522
3515
  if (item) {
@@ -3532,7 +3525,7 @@ var DraggableComponent = ({
3532
3525
  );
3533
3526
  const canCollide = canDrag || userIsDragging;
3534
3527
  const disabled = !isEnabled || !canCollide;
3535
- const [dragAxis, setDragAxis] = (0, import_react24.useState)(userDragAxis || autoDragAxis);
3528
+ const [dragAxis, setDragAxis] = (0, import_react23.useState)(userDragAxis || autoDragAxis);
3536
3529
  const { ref: sortableRef, status } = useSortableSafe({
3537
3530
  id,
3538
3531
  index,
@@ -3558,8 +3551,8 @@ var DraggableComponent = ({
3558
3551
  }
3559
3552
  });
3560
3553
  const thisIsDragging = status === "dragging";
3561
- const ref = (0, import_react24.useRef)(null);
3562
- const refSetter = (0, import_react24.useCallback)(
3554
+ const ref = (0, import_react23.useRef)(null);
3555
+ const refSetter = (0, import_react23.useCallback)(
3563
3556
  (el) => {
3564
3557
  sortableRef(el);
3565
3558
  if (el) {
@@ -3568,14 +3561,14 @@ var DraggableComponent = ({
3568
3561
  },
3569
3562
  [sortableRef]
3570
3563
  );
3571
- const [portalEl, setPortalEl] = (0, import_react24.useState)();
3572
- (0, import_react24.useEffect)(() => {
3564
+ const [portalEl, setPortalEl] = (0, import_react23.useState)();
3565
+ (0, import_react23.useEffect)(() => {
3573
3566
  var _a, _b, _c;
3574
3567
  setPortalEl(
3575
3568
  iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
3576
3569
  );
3577
3570
  }, [iframe.enabled, ref.current]);
3578
- const getStyle = (0, import_react24.useCallback)(() => {
3571
+ const getStyle = (0, import_react23.useCallback)(() => {
3579
3572
  var _a, _b, _c;
3580
3573
  if (!ref.current) return;
3581
3574
  const rect = ref.current.getBoundingClientRect();
@@ -3595,11 +3588,11 @@ var DraggableComponent = ({
3595
3588
  };
3596
3589
  return style2;
3597
3590
  }, [ref.current]);
3598
- const [style, setStyle] = (0, import_react24.useState)();
3599
- const sync = (0, import_react24.useCallback)(() => {
3591
+ const [style, setStyle] = (0, import_react23.useState)();
3592
+ const sync = (0, import_react23.useCallback)(() => {
3600
3593
  setStyle(getStyle());
3601
3594
  }, [ref.current, iframe]);
3602
- (0, import_react24.useEffect)(() => {
3595
+ (0, import_react23.useEffect)(() => {
3603
3596
  if (ref.current && !userIsDragging) {
3604
3597
  const observer = new ResizeObserver(sync);
3605
3598
  observer.observe(ref.current);
@@ -3608,7 +3601,7 @@ var DraggableComponent = ({
3608
3601
  };
3609
3602
  }
3610
3603
  }, [ref.current, userIsDragging]);
3611
- (0, import_react24.useEffect)(() => {
3604
+ (0, import_react23.useEffect)(() => {
3612
3605
  ctx == null ? void 0 : ctx.registerPath(
3613
3606
  id,
3614
3607
  {
@@ -3622,14 +3615,14 @@ var DraggableComponent = ({
3622
3615
  (_a = ctx == null ? void 0 : ctx.unregisterPath) == null ? void 0 : _a.call(ctx, id);
3623
3616
  };
3624
3617
  }, [id, zoneCompound, index, componentType]);
3625
- const CustomActionBar = (0, import_react24.useMemo)(
3618
+ const CustomActionBar = (0, import_react23.useMemo)(
3626
3619
  () => overrides.actionBar || DefaultActionBar,
3627
3620
  [overrides.actionBar]
3628
3621
  );
3629
3622
  const permissions = getPermissions({
3630
3623
  item: selectedItem
3631
3624
  });
3632
- const onClick = (0, import_react24.useCallback)(
3625
+ const onClick = (0, import_react23.useCallback)(
3633
3626
  (e) => {
3634
3627
  e.stopPropagation();
3635
3628
  dispatch({
@@ -3641,7 +3634,7 @@ var DraggableComponent = ({
3641
3634
  },
3642
3635
  [index, zoneCompound, id]
3643
3636
  );
3644
- const onSelectParent = (0, import_react24.useCallback)(() => {
3637
+ const onSelectParent = (0, import_react23.useCallback)(() => {
3645
3638
  if (!(ctx == null ? void 0 : ctx.areaId)) {
3646
3639
  return;
3647
3640
  }
@@ -3659,23 +3652,23 @@ var DraggableComponent = ({
3659
3652
  }
3660
3653
  });
3661
3654
  }, [ctx, path]);
3662
- const onDuplicate = (0, import_react24.useCallback)(() => {
3655
+ const onDuplicate = (0, import_react23.useCallback)(() => {
3663
3656
  dispatch({
3664
3657
  type: "duplicate",
3665
3658
  sourceIndex: index,
3666
3659
  sourceZone: zoneCompound
3667
3660
  });
3668
3661
  }, [index, zoneCompound]);
3669
- const onDelete = (0, import_react24.useCallback)(() => {
3662
+ const onDelete = (0, import_react23.useCallback)(() => {
3670
3663
  dispatch({
3671
3664
  type: "remove",
3672
3665
  index,
3673
3666
  zone: zoneCompound
3674
3667
  });
3675
3668
  }, [index, zoneCompound]);
3676
- const [hover, setHover] = (0, import_react24.useState)(false);
3669
+ const [hover, setHover] = (0, import_react23.useState)(false);
3677
3670
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
3678
- (0, import_react24.useEffect)(() => {
3671
+ (0, import_react23.useEffect)(() => {
3679
3672
  if (!ref.current) {
3680
3673
  return;
3681
3674
  }
@@ -3725,7 +3718,7 @@ var DraggableComponent = ({
3725
3718
  thisIsDragging,
3726
3719
  inDroppableZone
3727
3720
  ]);
3728
- (0, import_react24.useEffect)(() => {
3721
+ (0, import_react23.useEffect)(() => {
3729
3722
  if (ref.current && disabled) {
3730
3723
  ref.current.setAttribute("data-puck-disabled", "");
3731
3724
  return () => {
@@ -3734,8 +3727,8 @@ var DraggableComponent = ({
3734
3727
  };
3735
3728
  }
3736
3729
  }, [disabled, ref]);
3737
- const [isVisible, setIsVisible] = (0, import_react24.useState)(false);
3738
- (0, import_react24.useEffect)(() => {
3730
+ const [isVisible, setIsVisible] = (0, import_react23.useState)(false);
3731
+ (0, import_react23.useEffect)(() => {
3739
3732
  sync();
3740
3733
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
3741
3734
  setIsVisible(true);
@@ -3743,7 +3736,7 @@ var DraggableComponent = ({
3743
3736
  setIsVisible(false);
3744
3737
  }
3745
3738
  }, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
3746
- const syncActionsPosition = (0, import_react24.useCallback)(
3739
+ const syncActionsPosition = (0, import_react23.useCallback)(
3747
3740
  (el) => {
3748
3741
  if (el) {
3749
3742
  const view = el.ownerDocument.defaultView;
@@ -3751,16 +3744,24 @@ var DraggableComponent = ({
3751
3744
  const rect = el.getBoundingClientRect();
3752
3745
  const diffLeft = rect.x;
3753
3746
  const exceedsBoundsLeft = diffLeft < 0;
3747
+ const diffTop = rect.y;
3748
+ const exceedsBoundsTop = diffTop < 0;
3754
3749
  if (exceedsBoundsLeft) {
3755
3750
  el.style.transformOrigin = "left top";
3756
3751
  el.style.left = "0px";
3757
3752
  }
3753
+ if (exceedsBoundsTop) {
3754
+ el.style.top = "12px";
3755
+ if (!exceedsBoundsLeft) {
3756
+ el.style.transformOrigin = "right top";
3757
+ }
3758
+ }
3758
3759
  }
3759
3760
  }
3760
3761
  },
3761
3762
  [zoomConfig]
3762
3763
  );
3763
- (0, import_react24.useEffect)(() => {
3764
+ (0, import_react23.useEffect)(() => {
3764
3765
  if (userDragAxis) {
3765
3766
  setDragAxis(userDragAxis);
3766
3767
  return;
@@ -3854,14 +3855,14 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
3854
3855
 
3855
3856
  // components/DropZone/lib/use-min-empty-height.ts
3856
3857
  init_react_import();
3857
- var import_react25 = require("react");
3858
+ var import_react24 = require("react");
3858
3859
  var useMinEmptyHeight = ({
3859
3860
  zoneCompound,
3860
3861
  userMinEmptyHeight,
3861
3862
  ref
3862
3863
  }) => {
3863
- const [prevHeight, setPrevHeight] = (0, import_react25.useState)(0);
3864
- const [isAnimating, setIsAnimating] = (0, import_react25.useState)(false);
3864
+ const [prevHeight, setPrevHeight] = (0, import_react24.useState)(0);
3865
+ const [isAnimating, setIsAnimating] = (0, import_react24.useState)(false);
3865
3866
  const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
3866
3867
  var _a, _b;
3867
3868
  return {
@@ -3869,7 +3870,7 @@ var useMinEmptyHeight = ({
3869
3870
  isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
3870
3871
  };
3871
3872
  });
3872
- (0, import_react25.useEffect)(() => {
3873
+ (0, import_react24.useEffect)(() => {
3873
3874
  if (draggedItem && ref.current) {
3874
3875
  if (isZone) {
3875
3876
  const rect = ref.current.getBoundingClientRect();
@@ -3903,15 +3904,15 @@ function assignRefs(refs, node) {
3903
3904
 
3904
3905
  // components/DropZone/lib/use-content-with-preview.ts
3905
3906
  init_react_import();
3906
- var import_react28 = require("react");
3907
+ var import_react27 = require("react");
3907
3908
 
3908
3909
  // lib/dnd/use-rendered-callback.ts
3909
3910
  init_react_import();
3910
- var import_react26 = require("@dnd-kit/react");
3911
- var import_react27 = require("react");
3911
+ var import_react25 = require("@dnd-kit/react");
3912
+ var import_react26 = require("react");
3912
3913
  function useRenderedCallback(callback, deps) {
3913
- const manager = (0, import_react26.useDragDropManager)();
3914
- return (0, import_react27.useCallback)(
3914
+ const manager = (0, import_react25.useDragDropManager)();
3915
+ return (0, import_react26.useCallback)(
3915
3916
  (...args) => __async(this, null, function* () {
3916
3917
  yield manager == null ? void 0 : manager.renderer.rendering;
3917
3918
  return callback(...args);
@@ -3946,8 +3947,8 @@ var useContentWithPreview = (content, zoneCompound) => {
3946
3947
  ui: { isDragging }
3947
3948
  }
3948
3949
  } = useAppContext();
3949
- const [contentWithPreview, setContentWithPreview] = (0, import_react28.useState)(content);
3950
- const [localPreview, setLocalPreview] = (0, import_react28.useState)(
3950
+ const [contentWithPreview, setContentWithPreview] = (0, import_react27.useState)(content);
3951
+ const [localPreview, setLocalPreview] = (0, import_react27.useState)(
3951
3952
  preview
3952
3953
  );
3953
3954
  const updateContent = useRenderedCallback(
@@ -3988,7 +3989,7 @@ var useContentWithPreview = (content, zoneCompound) => {
3988
3989
  },
3989
3990
  [draggedItemId, previewExists]
3990
3991
  );
3991
- (0, import_react28.useEffect)(() => {
3992
+ (0, import_react27.useEffect)(() => {
3992
3993
  updateContent(content, preview, isDragging);
3993
3994
  }, [content, preview, isDragging]);
3994
3995
  return [contentWithPreview, localPreview];
@@ -3996,16 +3997,16 @@ var useContentWithPreview = (content, zoneCompound) => {
3996
3997
 
3997
3998
  // components/DropZone/lib/use-drag-axis.ts
3998
3999
  init_react_import();
3999
- var import_react29 = require("react");
4000
+ var import_react28 = require("react");
4000
4001
  var GRID_DRAG_AXIS = "dynamic";
4001
4002
  var FLEX_ROW_DRAG_AXIS = "x";
4002
4003
  var DEFAULT_DRAG_AXIS = "y";
4003
4004
  var useDragAxis = (ref, collisionAxis) => {
4004
4005
  const { status } = useAppContext();
4005
- const [dragAxis, setDragAxis] = (0, import_react29.useState)(
4006
+ const [dragAxis, setDragAxis] = (0, import_react28.useState)(
4006
4007
  collisionAxis || DEFAULT_DRAG_AXIS
4007
4008
  );
4008
- const calculateDragAxis = (0, import_react29.useCallback)(() => {
4009
+ const calculateDragAxis = (0, import_react28.useCallback)(() => {
4009
4010
  if (ref.current) {
4010
4011
  const computedStyle = window.getComputedStyle(ref.current);
4011
4012
  if (computedStyle.display === "grid") {
@@ -4017,7 +4018,7 @@ var useDragAxis = (ref, collisionAxis) => {
4017
4018
  }
4018
4019
  }
4019
4020
  }, [ref.current]);
4020
- (0, import_react29.useEffect)(() => {
4021
+ (0, import_react28.useEffect)(() => {
4021
4022
  const onViewportChange = () => {
4022
4023
  calculateDragAxis();
4023
4024
  };
@@ -4026,7 +4027,7 @@ var useDragAxis = (ref, collisionAxis) => {
4026
4027
  window.removeEventListener("viewportchange", onViewportChange);
4027
4028
  };
4028
4029
  }, []);
4029
- (0, import_react29.useEffect)(calculateDragAxis, [status, collisionAxis]);
4030
+ (0, import_react28.useEffect)(calculateDragAxis, [status, collisionAxis]);
4030
4031
  return [dragAxis, calculateDragAxis];
4031
4032
  };
4032
4033
 
@@ -4036,7 +4037,7 @@ var getClassName17 = get_class_name_factory_default("DropZone", styles_module_de
4036
4037
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
4037
4038
  var RENDER_DEBUG = false;
4038
4039
  var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadValues({}, props));
4039
- var DropZoneEdit = (0, import_react30.forwardRef)(
4040
+ var DropZoneEdit = (0, import_react29.forwardRef)(
4040
4041
  function DropZoneEditInternal({
4041
4042
  zone,
4042
4043
  allow,
@@ -4047,7 +4048,7 @@ var DropZoneEdit = (0, import_react30.forwardRef)(
4047
4048
  collisionAxis
4048
4049
  }, userRef) {
4049
4050
  const appContext2 = useAppContext();
4050
- const ctx = (0, import_react30.useContext)(dropZoneContext);
4051
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
4051
4052
  const {
4052
4053
  // These all need setting via context
4053
4054
  data,
@@ -4083,12 +4084,12 @@ var DropZoneEdit = (0, import_react30.forwardRef)(
4083
4084
  };
4084
4085
  });
4085
4086
  const { itemSelector } = appContext2.state.ui;
4086
- (0, import_react30.useEffect)(() => {
4087
+ (0, import_react29.useEffect)(() => {
4087
4088
  if (areaId && registerZoneArea) {
4088
4089
  registerZoneArea(areaId);
4089
4090
  }
4090
4091
  }, [areaId]);
4091
- (0, import_react30.useEffect)(() => {
4092
+ (0, import_react29.useEffect)(() => {
4092
4093
  if (ctx == null ? void 0 : ctx.registerZone) {
4093
4094
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
4094
4095
  }
@@ -4098,14 +4099,14 @@ var DropZoneEdit = (0, import_react30.forwardRef)(
4098
4099
  }
4099
4100
  };
4100
4101
  }, []);
4101
- const content = (0, import_react30.useMemo)(() => {
4102
+ const content = (0, import_react29.useMemo)(() => {
4102
4103
  if (areaId && zone !== rootDroppableId) {
4103
4104
  return setupZone(data, zoneCompound).zones[zoneCompound];
4104
4105
  }
4105
4106
  return data.content || [];
4106
4107
  }, [data, zoneCompound]);
4107
- const ref = (0, import_react30.useRef)(null);
4108
- const acceptsTarget = (0, import_react30.useCallback)(
4108
+ const ref = (0, import_react29.useRef)(null);
4109
+ const acceptsTarget = (0, import_react29.useCallback)(
4109
4110
  (componentType) => {
4110
4111
  if (!componentType) {
4111
4112
  return true;
@@ -4127,7 +4128,7 @@ var DropZoneEdit = (0, import_react30.forwardRef)(
4127
4128
  },
4128
4129
  [allow, disallow]
4129
4130
  );
4130
- (0, import_react30.useEffect)(() => {
4131
+ (0, import_react29.useEffect)(() => {
4131
4132
  if (registerLocalZone) {
4132
4133
  registerLocalZone(zoneCompound, acceptsTarget(draggedComponentType));
4133
4134
  }
@@ -4262,13 +4263,13 @@ var DropZoneEdit = (0, import_react30.forwardRef)(
4262
4263
  }
4263
4264
  );
4264
4265
  var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRender, __spreadValues({}, props));
4265
- var DropZoneRender = (0, import_react30.forwardRef)(
4266
+ var DropZoneRender = (0, import_react29.forwardRef)(
4266
4267
  function DropZoneRenderInternal({ className, style, zone }, ref) {
4267
- const ctx = (0, import_react30.useContext)(dropZoneContext);
4268
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
4268
4269
  const { data, areaId = "root", config } = ctx || {};
4269
4270
  let zoneCompound = rootDroppableId;
4270
4271
  let content = (data == null ? void 0 : data.content) || [];
4271
- (0, import_react30.useEffect)(() => {
4272
+ (0, import_react29.useEffect)(() => {
4272
4273
  if (ctx == null ? void 0 : ctx.registerZone) {
4273
4274
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
4274
4275
  }
@@ -4315,9 +4316,9 @@ var DropZoneRender = (0, import_react30.forwardRef)(
4315
4316
  }
4316
4317
  );
4317
4318
  var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, __spreadValues({}, props));
4318
- var DropZone = (0, import_react30.forwardRef)(
4319
+ var DropZone = (0, import_react29.forwardRef)(
4319
4320
  function DropZone2(props, ref) {
4320
- const ctx = (0, import_react30.useContext)(dropZoneContext);
4321
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
4321
4322
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
4322
4323
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
4323
4324
  }
@@ -5012,12 +5013,12 @@ function getDeepDir(el) {
5012
5013
  // components/DragDropContext/index.tsx
5013
5014
  var import_jsx_runtime23 = require("react/jsx-runtime");
5014
5015
  var DEBUG3 = false;
5015
- var dragListenerContext = (0, import_react32.createContext)({
5016
+ var dragListenerContext = (0, import_react31.createContext)({
5016
5017
  dragListeners: {}
5017
5018
  });
5018
5019
  function useDragListener(type, fn, deps = []) {
5019
- const { setDragListeners } = (0, import_react32.useContext)(dragListenerContext);
5020
- (0, import_react32.useEffect)(() => {
5020
+ const { setDragListeners } = (0, import_react31.useContext)(dragListenerContext);
5021
+ (0, import_react31.useEffect)(() => {
5021
5022
  if (setDragListeners) {
5022
5023
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
5023
5024
  [type]: [...old[type] || [], fn]
@@ -5027,8 +5028,8 @@ function useDragListener(type, fn, deps = []) {
5027
5028
  }
5028
5029
  var AREA_CHANGE_DEBOUNCE_MS = 100;
5029
5030
  var useTempDisableFallback = (timeout3) => {
5030
- const lastFallbackDisable = (0, import_react32.useRef)(null);
5031
- return (0, import_react32.useCallback)((manager) => {
5031
+ const lastFallbackDisable = (0, import_react31.useRef)(null);
5032
+ return (0, import_react31.useCallback)((manager) => {
5032
5033
  collisionStore.setState({ fallbackEnabled: false });
5033
5034
  const fallbackId = generateId();
5034
5035
  lastFallbackDisable.current = fallbackId;
@@ -5047,9 +5048,9 @@ var DragDropContextClient = ({
5047
5048
  const { state, config, dispatch, resolveData } = useAppContext();
5048
5049
  const id = useSafeId();
5049
5050
  const { data } = state;
5050
- const debouncedParamsRef = (0, import_react32.useRef)(null);
5051
+ const debouncedParamsRef = (0, import_react31.useRef)(null);
5051
5052
  const tempDisableFallback = useTempDisableFallback(100);
5052
- const [zoneStore] = (0, import_react32.useState)(
5053
+ const [zoneStore] = (0, import_react31.useState)(
5053
5054
  () => (0, import_zustand3.createStore)(() => ({
5054
5055
  zoneDepthIndex: {},
5055
5056
  nextZoneDepthIndex: {},
@@ -5059,7 +5060,7 @@ var DragDropContextClient = ({
5059
5060
  previewIndex: {}
5060
5061
  }))
5061
5062
  );
5062
- const getChanged2 = (0, import_react32.useCallback)(
5063
+ const getChanged2 = (0, import_react31.useCallback)(
5063
5064
  (params, id2) => {
5064
5065
  const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
5065
5066
  const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
@@ -5080,7 +5081,7 @@ var DragDropContextClient = ({
5080
5081
  },
5081
5082
  [zoneStore]
5082
5083
  );
5083
- const setDeepestAndCollide = (0, import_react32.useCallback)(
5084
+ const setDeepestAndCollide = (0, import_react31.useCallback)(
5084
5085
  (params, manager) => {
5085
5086
  const { zoneChanged, areaChanged } = getChanged2(params, id);
5086
5087
  if (!zoneChanged && !areaChanged) return;
@@ -5104,7 +5105,7 @@ var DragDropContextClient = ({
5104
5105
  setDeepestDb.cancel();
5105
5106
  debouncedParamsRef.current = null;
5106
5107
  };
5107
- (0, import_react32.useEffect)(() => {
5108
+ (0, import_react31.useEffect)(() => {
5108
5109
  if (DEBUG3) {
5109
5110
  zoneStore.subscribe(
5110
5111
  (s) => {
@@ -5118,7 +5119,7 @@ var DragDropContextClient = ({
5118
5119
  );
5119
5120
  }
5120
5121
  }, []);
5121
- const [plugins] = (0, import_react32.useState)(() => [
5122
+ const [plugins] = (0, import_react31.useState)(() => [
5122
5123
  ...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
5123
5124
  createNestedDroppablePlugin(
5124
5125
  {
@@ -5166,10 +5167,10 @@ var DragDropContextClient = ({
5166
5167
  )
5167
5168
  ]);
5168
5169
  const sensors = useSensors();
5169
- const [dragListeners, setDragListeners] = (0, import_react32.useState)({});
5170
- const [pathData, setPathData] = (0, import_react32.useState)();
5171
- const dragMode = (0, import_react32.useRef)(null);
5172
- const registerPath = (0, import_react32.useCallback)(
5170
+ const [dragListeners, setDragListeners] = (0, import_react31.useState)({});
5171
+ const [pathData, setPathData] = (0, import_react31.useState)();
5172
+ const dragMode = (0, import_react31.useRef)(null);
5173
+ const registerPath = (0, import_react31.useCallback)(
5173
5174
  (id2, selector, label) => {
5174
5175
  const [area] = getZoneId(selector.zone);
5175
5176
  setPathData((latestPathData = {}) => {
@@ -5187,7 +5188,7 @@ var DragDropContextClient = ({
5187
5188
  },
5188
5189
  [data, setPathData]
5189
5190
  );
5190
- const unregisterPath = (0, import_react32.useCallback)(
5191
+ const unregisterPath = (0, import_react31.useCallback)(
5191
5192
  (id2) => {
5192
5193
  setPathData((latestPathData = {}) => {
5193
5194
  const newPathData = __spreadValues({}, latestPathData);
@@ -5197,7 +5198,7 @@ var DragDropContextClient = ({
5197
5198
  },
5198
5199
  [data, setPathData]
5199
5200
  );
5200
- const initialSelector = (0, import_react32.useRef)(void 0);
5201
+ const initialSelector = (0, import_react31.useRef)(void 0);
5201
5202
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5202
5203
  dragListenerContext.Provider,
5203
5204
  {
@@ -5206,7 +5207,7 @@ var DragDropContextClient = ({
5206
5207
  setDragListeners
5207
5208
  },
5208
5209
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5209
- import_react31.DragDropProvider,
5210
+ import_react30.DragDropProvider,
5210
5211
  {
5211
5212
  plugins,
5212
5213
  sensors,
@@ -5435,7 +5436,7 @@ var DrawerItemInner = ({
5435
5436
  dragRef,
5436
5437
  isDragDisabled
5437
5438
  }) => {
5438
- const CustomInner = (0, import_react33.useMemo)(
5439
+ const CustomInner = (0, import_react32.useMemo)(
5439
5440
  () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
5440
5441
  [children]
5441
5442
  );
@@ -5489,7 +5490,7 @@ var DrawerItem = ({
5489
5490
  isDragDisabled
5490
5491
  }) => {
5491
5492
  const resolvedId = id || name;
5492
- const [dynamicId, setDynamicId] = (0, import_react33.useState)(generateId(resolvedId));
5493
+ const [dynamicId, setDynamicId] = (0, import_react32.useState)(generateId(resolvedId));
5493
5494
  if (typeof index !== "undefined") {
5494
5495
  console.error(
5495
5496
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -5550,7 +5551,7 @@ Drawer.Item = DrawerItem;
5550
5551
 
5551
5552
  // components/Puck/index.tsx
5552
5553
  init_react_import();
5553
- var import_react51 = require("react");
5554
+ var import_react50 = require("react");
5554
5555
 
5555
5556
  // components/SidebarSection/index.tsx
5556
5557
  init_react_import();
@@ -5561,7 +5562,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_8boj8_1", "Si
5561
5562
 
5562
5563
  // lib/use-breadcrumbs.ts
5563
5564
  init_react_import();
5564
- var import_react34 = require("react");
5565
+ var import_react33 = require("react");
5565
5566
  var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
5566
5567
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
5567
5568
  const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
@@ -5611,8 +5612,8 @@ var useBreadcrumbs = (renderCount) => {
5611
5612
  state: { data },
5612
5613
  selectedItem
5613
5614
  } = useAppContext();
5614
- const dzContext = (0, import_react34.useContext)(dropZoneContext);
5615
- return (0, import_react34.useMemo)(() => {
5615
+ const dzContext = (0, import_react33.useContext)(dropZoneContext);
5616
+ return (0, import_react33.useMemo)(() => {
5616
5617
  const breadcrumbs = convertPathDataToBreadcrumbs(
5617
5618
  selectedItem,
5618
5619
  dzContext == null ? void 0 : dzContext.pathData,
@@ -5746,15 +5747,15 @@ init_react_import();
5746
5747
  var styles_module_default16 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields--isLoading": "_PuckFields--isLoading_10bh7_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_10bh7_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_10bh7_25", "PuckFields-field": "_PuckFields-field_10bh7_32", "PuckFields--wrapFields": "_PuckFields--wrapFields_10bh7_36" };
5747
5748
 
5748
5749
  // components/Puck/components/Fields/index.tsx
5749
- var import_react38 = require("react");
5750
+ var import_react37 = require("react");
5750
5751
 
5751
5752
  // lib/use-resolved-fields.ts
5752
5753
  init_react_import();
5753
- var import_react37 = require("react");
5754
+ var import_react36 = require("react");
5754
5755
 
5755
5756
  // lib/use-parent.ts
5756
5757
  init_react_import();
5757
- var import_react35 = require("react");
5758
+ var import_react34 = require("react");
5758
5759
  var getParent = (itemSelector, pathData, data) => {
5759
5760
  var _a;
5760
5761
  if (!itemSelector) return null;
@@ -5766,8 +5767,8 @@ var getParent = (itemSelector, pathData, data) => {
5766
5767
  };
5767
5768
  var useGetParent = () => {
5768
5769
  const { state } = useAppContext();
5769
- const { pathData } = (0, import_react35.useContext)(dropZoneContext) || {};
5770
- return (0, import_react35.useCallback)(
5770
+ const { pathData } = (0, import_react34.useContext)(dropZoneContext) || {};
5771
+ return (0, import_react34.useCallback)(
5771
5772
  () => getParent(state.ui.itemSelector, pathData, state.data),
5772
5773
  [state.ui.itemSelector, pathData, state.data]
5773
5774
  );
@@ -5778,10 +5779,10 @@ var useParent = () => {
5778
5779
 
5779
5780
  // lib/use-on-value-change.ts
5780
5781
  init_react_import();
5781
- var import_react36 = require("react");
5782
+ var import_react35 = require("react");
5782
5783
  function useOnValueChange(value, onChange, compare = Object.is, deps = []) {
5783
- const tracked = (0, import_react36.useRef)(value);
5784
- (0, import_react36.useEffect)(() => {
5784
+ const tracked = (0, import_react35.useRef)(value);
5785
+ (0, import_react35.useEffect)(() => {
5785
5786
  const oldValue = tracked.current;
5786
5787
  if (!compare(value, oldValue)) {
5787
5788
  tracked.current = value;
@@ -5808,27 +5809,27 @@ var useResolvedFields = ({
5808
5809
  const { data } = state;
5809
5810
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
5810
5811
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
5811
- const defaultFields = (0, import_react37.useMemo)(
5812
+ const defaultFields = (0, import_react36.useMemo)(
5812
5813
  () => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
5813
5814
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
5814
5815
  );
5815
5816
  const rootProps = data.root.props || data.root;
5816
- const [lastSelectedData, setLastSelectedData] = (0, import_react37.useState)({});
5817
- const [resolvedFields, setResolvedFields] = (0, import_react37.useState)({
5817
+ const [lastSelectedData, setLastSelectedData] = (0, import_react36.useState)({});
5818
+ const [resolvedFields, setResolvedFields] = (0, import_react36.useState)({
5818
5819
  fields: defaultFields,
5819
5820
  id: selectedItem == null ? void 0 : selectedItem.props.id
5820
5821
  });
5821
- const [fieldsLoading, setFieldsLoading] = (0, import_react37.useState)(false);
5822
- const lastFields = (0, import_react37.useRef)(defaultFields);
5822
+ const [fieldsLoading, setFieldsLoading] = (0, import_react36.useState)(false);
5823
+ const lastFields = (0, import_react36.useRef)(defaultFields);
5823
5824
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5824
- const componentData = (0, import_react37.useMemo)(
5825
+ const componentData = (0, import_react36.useMemo)(
5825
5826
  () => selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly || {} },
5826
5827
  [selectedItem, rootProps, data.root.readOnly]
5827
5828
  );
5828
5829
  const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
5829
5830
  const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
5830
5831
  const hasResolver = hasComponentResolver || hasRootResolver;
5831
- const resolveFields = (0, import_react37.useCallback)(
5832
+ const resolveFields = (0, import_react36.useCallback)(
5832
5833
  (..._0) => __async(void 0, [..._0], function* (fields = {}) {
5833
5834
  var _a2;
5834
5835
  const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
@@ -5866,7 +5867,7 @@ var useResolvedFields = ({
5866
5867
  }),
5867
5868
  [data, config, componentData, selectedItem, state, parent]
5868
5869
  );
5869
- const triggerResolver = (0, import_react37.useCallback)(() => {
5870
+ const triggerResolver = (0, import_react36.useCallback)(() => {
5870
5871
  var _a2, _b2;
5871
5872
  if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || ((_b2 = state.ui.itemSelector) == null ? void 0 : _b2.zone) === "default-zone" || parent) {
5872
5873
  if (hasResolver) {
@@ -5906,7 +5907,7 @@ var useResolvedFields = ({
5906
5907
  },
5907
5908
  (a, b) => JSON.stringify(a) === JSON.stringify(b)
5908
5909
  );
5909
- (0, import_react37.useEffect)(() => {
5910
+ (0, import_react36.useEffect)(() => {
5910
5911
  triggerResolver();
5911
5912
  }, []);
5912
5913
  if (resolvedFields.id !== (selectedItem == null ? void 0 : selectedItem.props.id) && !_skipIdCheck) {
@@ -5941,7 +5942,7 @@ var Fields = ({ wrapFields = true }) => {
5941
5942
  const componentResolving = selectedItem ? ((_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loadingCount) > 0 : ((_b = componentState["puck-root"]) == null ? void 0 : _b.loadingCount) > 0;
5942
5943
  const isLoading = fieldsResolving || componentResolving;
5943
5944
  const rootProps = data.root.props || data.root;
5944
- const Wrapper = (0, import_react38.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
5945
+ const Wrapper = (0, import_react37.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
5945
5946
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5946
5947
  "form",
5947
5948
  {
@@ -6062,7 +6063,7 @@ init_react_import();
6062
6063
 
6063
6064
  // lib/use-component-list.tsx
6064
6065
  init_react_import();
6065
- var import_react39 = require("react");
6066
+ var import_react38 = require("react");
6066
6067
 
6067
6068
  // components/ComponentList/index.tsx
6068
6069
  init_react_import();
@@ -6129,8 +6130,8 @@ ComponentList.Item = ComponentListItem;
6129
6130
  // lib/use-component-list.tsx
6130
6131
  var import_jsx_runtime29 = require("react/jsx-runtime");
6131
6132
  var useComponentList = (config, ui) => {
6132
- const [componentList, setComponentList] = (0, import_react39.useState)();
6133
- (0, import_react39.useEffect)(() => {
6133
+ const [componentList, setComponentList] = (0, import_react38.useState)();
6134
+ (0, import_react38.useEffect)(() => {
6134
6135
  var _a, _b, _c;
6135
6136
  if (Object.keys(ui.componentList).length > 0) {
6136
6137
  const matchedComponents = [];
@@ -6199,22 +6200,22 @@ var useComponentList = (config, ui) => {
6199
6200
  };
6200
6201
 
6201
6202
  // components/Puck/components/Components/index.tsx
6202
- var import_react40 = require("react");
6203
+ var import_react39 = require("react");
6203
6204
  var import_jsx_runtime30 = require("react/jsx-runtime");
6204
6205
  var Components = () => {
6205
6206
  const { config, state, overrides } = useAppContext();
6206
6207
  const componentList = useComponentList(config, state.ui);
6207
- const Wrapper = (0, import_react40.useMemo)(() => overrides.components || "div", [overrides]);
6208
+ const Wrapper = (0, import_react39.useMemo)(() => overrides.components || "div", [overrides]);
6208
6209
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentList, { id: "all" }) });
6209
6210
  };
6210
6211
 
6211
6212
  // components/Puck/components/Preview/index.tsx
6212
6213
  init_react_import();
6213
- var import_react42 = require("react");
6214
+ var import_react41 = require("react");
6214
6215
 
6215
6216
  // components/AutoFrame/index.tsx
6216
6217
  init_react_import();
6217
- var import_react41 = require("react");
6218
+ var import_react40 = require("react");
6218
6219
  var import_object_hash = __toESM(require("object-hash"));
6219
6220
  var import_react_dom3 = require("react-dom");
6220
6221
  var import_jsx_runtime31 = require("react/jsx-runtime");
@@ -6260,7 +6261,7 @@ var CopyHostStyles = ({
6260
6261
  onStylesLoaded = () => null
6261
6262
  }) => {
6262
6263
  const { document: doc, window: win } = useFrame();
6263
- (0, import_react41.useEffect)(() => {
6264
+ (0, import_react40.useEffect)(() => {
6264
6265
  if (!win || !doc) {
6265
6266
  return () => {
6266
6267
  };
@@ -6419,8 +6420,8 @@ var CopyHostStyles = ({
6419
6420
  }, []);
6420
6421
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
6421
6422
  };
6422
- var autoFrameContext = (0, import_react41.createContext)({});
6423
- var useFrame = () => (0, import_react41.useContext)(autoFrameContext);
6423
+ var autoFrameContext = (0, import_react40.createContext)({});
6424
+ var useFrame = () => (0, import_react40.useContext)(autoFrameContext);
6424
6425
  function AutoFrame(_a) {
6425
6426
  var _b = _a, {
6426
6427
  children,
@@ -6437,10 +6438,10 @@ function AutoFrame(_a) {
6437
6438
  "onStylesLoaded",
6438
6439
  "frameRef"
6439
6440
  ]);
6440
- const [loaded, setLoaded] = (0, import_react41.useState)(false);
6441
- const [ctx, setCtx] = (0, import_react41.useState)({});
6442
- const [mountTarget, setMountTarget] = (0, import_react41.useState)();
6443
- (0, import_react41.useEffect)(() => {
6441
+ const [loaded, setLoaded] = (0, import_react40.useState)(false);
6442
+ const [ctx, setCtx] = (0, import_react40.useState)({});
6443
+ const [mountTarget, setMountTarget] = (0, import_react40.useState)();
6444
+ (0, import_react40.useEffect)(() => {
6444
6445
  var _a2;
6445
6446
  if (frameRef.current) {
6446
6447
  setCtx({
@@ -6535,7 +6536,7 @@ var import_jsx_runtime33 = require("react/jsx-runtime");
6535
6536
  var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
6536
6537
  var useBubbleIframeEvents = (ref) => {
6537
6538
  const { status } = useAppContext();
6538
- (0, import_react42.useEffect)(() => {
6539
+ (0, import_react41.useEffect)(() => {
6539
6540
  var _a;
6540
6541
  if (ref.current && status === "READY") {
6541
6542
  const iframe = ref.current;
@@ -6568,7 +6569,7 @@ var useBubbleIframeEvents = (ref) => {
6568
6569
  };
6569
6570
  var Preview2 = ({ id = "puck-preview" }) => {
6570
6571
  const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
6571
- const Page = (0, import_react42.useCallback)(
6572
+ const Page = (0, import_react41.useCallback)(
6572
6573
  (pageProps) => {
6573
6574
  var _a, _b;
6574
6575
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
@@ -6577,9 +6578,9 @@ var Preview2 = ({ id = "puck-preview" }) => {
6577
6578
  },
6578
6579
  [config.root]
6579
6580
  );
6580
- const Frame = (0, import_react42.useMemo)(() => overrides.iframe, [overrides]);
6581
+ const Frame = (0, import_react41.useMemo)(() => overrides.iframe, [overrides]);
6581
6582
  const rootProps = state.data.root.props || state.data.root;
6582
- const ref = (0, import_react42.useRef)(null);
6583
+ const ref = (0, import_react41.useRef)(null);
6583
6584
  useBubbleIframeEvents(ref);
6584
6585
  const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6585
6586
  Page,
@@ -6676,7 +6677,7 @@ var scrollIntoView = (el) => {
6676
6677
  };
6677
6678
 
6678
6679
  // components/LayerTree/index.tsx
6679
- var import_react43 = require("react");
6680
+ var import_react42 = require("react");
6680
6681
 
6681
6682
  // lib/is-child-of-zone.ts
6682
6683
  init_react_import();
@@ -6722,7 +6723,7 @@ var LayerTree = ({
6722
6723
  label
6723
6724
  }) => {
6724
6725
  const zones = data.zones || {};
6725
- const ctx = (0, import_react43.useContext)(dropZoneContext);
6726
+ const ctx = (0, import_react42.useContext)(dropZoneContext);
6726
6727
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6727
6728
  label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
6728
6729
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
@@ -6829,13 +6830,13 @@ var LayerTree = ({
6829
6830
  };
6830
6831
 
6831
6832
  // components/Puck/components/Outline/index.tsx
6832
- var import_react44 = require("react");
6833
+ var import_react43 = require("react");
6833
6834
  var import_jsx_runtime35 = require("react/jsx-runtime");
6834
6835
  var Outline = () => {
6835
6836
  const { dispatch, state, overrides, config } = useAppContext();
6836
6837
  const { data, ui } = state;
6837
6838
  const { itemSelector } = ui;
6838
- const setItemSelector = (0, import_react44.useCallback)(
6839
+ const setItemSelector = (0, import_react43.useCallback)(
6839
6840
  (newItemSelector) => {
6840
6841
  dispatch({
6841
6842
  type: "setUi",
@@ -6844,7 +6845,7 @@ var Outline = () => {
6844
6845
  },
6845
6846
  []
6846
6847
  );
6847
- const Wrapper = (0, import_react44.useMemo)(() => overrides.outline || "div", [overrides]);
6848
+ const Wrapper = (0, import_react43.useMemo)(() => overrides.outline || "div", [overrides]);
6848
6849
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
6849
6850
  (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6850
6851
  LayerTree,
@@ -6958,19 +6959,19 @@ function usePuckHistory({
6958
6959
 
6959
6960
  // lib/use-history-store.ts
6960
6961
  init_react_import();
6961
- var import_react45 = require("react");
6962
+ var import_react44 = require("react");
6962
6963
  var import_use_debounce3 = require("use-debounce");
6963
6964
  var EMPTY_HISTORY_INDEX = 0;
6964
6965
  function useHistoryStore(initialHistory) {
6965
6966
  var _a, _b;
6966
- const [histories, setHistories] = (0, import_react45.useState)(
6967
+ const [histories, setHistories] = (0, import_react44.useState)(
6967
6968
  (_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
6968
6969
  );
6969
6970
  const updateHistories = (histories2) => {
6970
6971
  setHistories(histories2);
6971
6972
  setIndex(histories2.length - 1);
6972
6973
  };
6973
- const [index, setIndex] = (0, import_react45.useState)(
6974
+ const [index, setIndex] = (0, import_react44.useState)(
6974
6975
  (_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
6975
6976
  );
6976
6977
  const hasPast = index > EMPTY_HISTORY_INDEX;
@@ -7130,11 +7131,11 @@ var getBox = function getBox2(el) {
7130
7131
  };
7131
7132
 
7132
7133
  // components/Puck/components/Canvas/index.tsx
7133
- var import_react47 = require("react");
7134
+ var import_react46 = require("react");
7134
7135
 
7135
7136
  // components/ViewportControls/index.tsx
7136
7137
  init_react_import();
7137
- var import_react46 = require("react");
7138
+ var import_react45 = require("react");
7138
7139
 
7139
7140
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7140
7141
  init_react_import();
@@ -7157,8 +7158,8 @@ var ViewportButton = ({
7157
7158
  onClick
7158
7159
  }) => {
7159
7160
  const { state } = useAppContext();
7160
- const [isActive, setIsActive] = (0, import_react46.useState)(false);
7161
- (0, import_react46.useEffect)(() => {
7161
+ const [isActive, setIsActive] = (0, import_react45.useState)(false);
7162
+ (0, import_react45.useEffect)(() => {
7162
7163
  setIsActive(width === state.ui.viewports.current.width);
7163
7164
  }, [width, state.ui.viewports.current.width]);
7164
7165
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -7194,7 +7195,7 @@ var ViewportControls = ({
7194
7195
  const defaultsContainAutoZoom = defaultZoomOptions.find(
7195
7196
  (option) => option.value === autoZoom
7196
7197
  );
7197
- const zoomOptions = (0, import_react46.useMemo)(
7198
+ const zoomOptions = (0, import_react45.useMemo)(
7198
7199
  () => [
7199
7200
  ...defaultZoomOptions,
7200
7201
  ...defaultsContainAutoZoom ? [] : [
@@ -7317,17 +7318,17 @@ var Canvas = () => {
7317
7318
  const { status, iframe } = useAppContext();
7318
7319
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
7319
7320
  const { ui } = state;
7320
- const frameRef = (0, import_react47.useRef)(null);
7321
- const [showTransition, setShowTransition] = (0, import_react47.useState)(false);
7322
- const defaultRender = (0, import_react47.useMemo)(() => {
7321
+ const frameRef = (0, import_react46.useRef)(null);
7322
+ const [showTransition, setShowTransition] = (0, import_react46.useState)(false);
7323
+ const defaultRender = (0, import_react46.useMemo)(() => {
7323
7324
  const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
7324
7325
  return PuckDefault;
7325
7326
  }, []);
7326
- const CustomPreview = (0, import_react47.useMemo)(
7327
+ const CustomPreview = (0, import_react46.useMemo)(
7327
7328
  () => overrides.preview || defaultRender,
7328
7329
  [overrides]
7329
7330
  );
7330
- const getFrameDimensions = (0, import_react47.useCallback)(() => {
7331
+ const getFrameDimensions = (0, import_react46.useCallback)(() => {
7331
7332
  if (frameRef.current) {
7332
7333
  const frame = frameRef.current;
7333
7334
  const box = getBox(frame);
@@ -7335,7 +7336,7 @@ var Canvas = () => {
7335
7336
  }
7336
7337
  return { width: 0, height: 0 };
7337
7338
  }, [frameRef]);
7338
- const resetAutoZoom = (0, import_react47.useCallback)(
7339
+ const resetAutoZoom = (0, import_react46.useCallback)(
7339
7340
  (ui2 = state.ui) => {
7340
7341
  if (frameRef.current) {
7341
7342
  setZoomConfig(
@@ -7345,11 +7346,11 @@ var Canvas = () => {
7345
7346
  },
7346
7347
  [frameRef, zoomConfig, state.ui]
7347
7348
  );
7348
- (0, import_react47.useEffect)(() => {
7349
+ (0, import_react46.useEffect)(() => {
7349
7350
  setShowTransition(false);
7350
7351
  resetAutoZoom();
7351
7352
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
7352
- (0, import_react47.useEffect)(() => {
7353
+ (0, import_react46.useEffect)(() => {
7353
7354
  const { height: frameHeight } = getFrameDimensions();
7354
7355
  if (ui.viewports.current.height === "auto") {
7355
7356
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -7357,13 +7358,13 @@ var Canvas = () => {
7357
7358
  }));
7358
7359
  }
7359
7360
  }, [zoomConfig.zoom]);
7360
- (0, import_react47.useEffect)(() => {
7361
+ (0, import_react46.useEffect)(() => {
7361
7362
  if (ZOOM_ON_CHANGE) {
7362
7363
  setShowTransition(true);
7363
7364
  resetAutoZoom(ui);
7364
7365
  }
7365
7366
  }, [ui.viewports.current.width]);
7366
- (0, import_react47.useEffect)(() => {
7367
+ (0, import_react46.useEffect)(() => {
7367
7368
  const cb = () => {
7368
7369
  setShowTransition(false);
7369
7370
  resetAutoZoom();
@@ -7373,8 +7374,8 @@ var Canvas = () => {
7373
7374
  window.removeEventListener("resize", cb);
7374
7375
  };
7375
7376
  }, []);
7376
- const [showLoader, setShowLoader] = (0, import_react47.useState)(false);
7377
- (0, import_react47.useEffect)(() => {
7377
+ const [showLoader, setShowLoader] = (0, import_react46.useState)(false);
7378
+ (0, import_react46.useEffect)(() => {
7378
7379
  setTimeout(() => {
7379
7380
  setShowLoader(true);
7380
7381
  }, 500);
@@ -7452,7 +7453,7 @@ var Canvas = () => {
7452
7453
 
7453
7454
  // lib/use-loaded-overrides.ts
7454
7455
  init_react_import();
7455
- var import_react48 = require("react");
7456
+ var import_react47 = require("react");
7456
7457
 
7457
7458
  // lib/load-overrides.ts
7458
7459
  init_react_import();
@@ -7491,7 +7492,7 @@ var useLoadedOverrides = ({
7491
7492
  overrides,
7492
7493
  plugins
7493
7494
  }) => {
7494
- return (0, import_react48.useMemo)(() => {
7495
+ return (0, import_react47.useMemo)(() => {
7495
7496
  return loadOverrides({ overrides, plugins });
7496
7497
  }, [plugins, overrides]);
7497
7498
  };
@@ -7503,14 +7504,14 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38
7503
7504
 
7504
7505
  // lib/use-inject-css.ts
7505
7506
  init_react_import();
7506
- var import_react49 = require("react");
7507
+ var import_react48 = require("react");
7507
7508
  var styles = ``;
7508
7509
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7509
- const [el, setEl] = (0, import_react49.useState)();
7510
- (0, import_react49.useEffect)(() => {
7510
+ const [el, setEl] = (0, import_react48.useState)();
7511
+ (0, import_react48.useEffect)(() => {
7511
7512
  setEl(document.createElement("style"));
7512
7513
  }, []);
7513
- (0, import_react49.useEffect)(() => {
7514
+ (0, import_react48.useEffect)(() => {
7514
7515
  var _a;
7515
7516
  if (!el || typeof window === "undefined") {
7516
7517
  return;
@@ -7530,10 +7531,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
7530
7531
 
7531
7532
  // lib/use-preview-mode-hotkeys.ts
7532
7533
  init_react_import();
7533
- var import_react50 = require("react");
7534
+ var import_react49 = require("react");
7534
7535
  var import_react_hotkeys_hook2 = require("react-hotkeys-hook");
7535
7536
  var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
7536
- const toggleInteractive = (0, import_react50.useCallback)(() => {
7537
+ const toggleInteractive = (0, import_react49.useCallback)(() => {
7537
7538
  dispatch({
7538
7539
  type: "setUi",
7539
7540
  ui: (ui) => ({
@@ -7590,7 +7591,7 @@ function Puck({
7590
7591
  waitForStyles: true
7591
7592
  }, _iframe);
7592
7593
  useInjectGlobalCss(iframe.enabled);
7593
- const [generatedAppState] = (0, import_react51.useState)(() => {
7594
+ const [generatedAppState] = (0, import_react50.useState)(() => {
7594
7595
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
7595
7596
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
7596
7597
  let clientUiState = {};
@@ -7662,14 +7663,14 @@ function Puck({
7662
7663
  histories,
7663
7664
  index: initialHistoryIndex
7664
7665
  });
7665
- const [reducer] = (0, import_react51.useState)(
7666
+ const [reducer] = (0, import_react50.useState)(
7666
7667
  () => createReducer({
7667
7668
  config,
7668
7669
  record: historyStore.record,
7669
7670
  onAction
7670
7671
  })
7671
7672
  );
7672
- const [appState, dispatch] = (0, import_react51.useReducer)(
7673
+ const [appState, dispatch] = (0, import_react50.useReducer)(
7673
7674
  reducer,
7674
7675
  flushZones(initialAppState)
7675
7676
  );
@@ -7680,14 +7681,14 @@ function Puck({
7680
7681
  historyStore,
7681
7682
  iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
7682
7683
  });
7683
- const [menuOpen, setMenuOpen] = (0, import_react51.useState)(false);
7684
+ const [menuOpen, setMenuOpen] = (0, import_react50.useState)(false);
7684
7685
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
7685
7686
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
7686
- (0, import_react51.useEffect)(() => {
7687
+ (0, import_react50.useEffect)(() => {
7687
7688
  if (onChange) onChange(data);
7688
7689
  }, [data]);
7689
7690
  const rootProps = data.root.props || data.root;
7690
- const toggleSidebars = (0, import_react51.useCallback)(
7691
+ const toggleSidebars = (0, import_react50.useCallback)(
7691
7692
  (sidebar) => {
7692
7693
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
7693
7694
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -7701,7 +7702,7 @@ function Puck({
7701
7702
  },
7702
7703
  [dispatch, leftSideBarVisible, rightSideBarVisible]
7703
7704
  );
7704
- (0, import_react51.useEffect)(() => {
7705
+ (0, import_react50.useEffect)(() => {
7705
7706
  if (!window.matchMedia("(min-width: 638px)").matches) {
7706
7707
  dispatch({
7707
7708
  type: "setUi",
@@ -7724,7 +7725,7 @@ function Puck({
7724
7725
  window.removeEventListener("resize", handleResize);
7725
7726
  };
7726
7727
  }, []);
7727
- const defaultHeaderRender = (0, import_react51.useMemo)(() => {
7728
+ const defaultHeaderRender = (0, import_react50.useMemo)(() => {
7728
7729
  if (renderHeader) {
7729
7730
  console.warn(
7730
7731
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -7738,7 +7739,7 @@ function Puck({
7738
7739
  }
7739
7740
  return DefaultOverride;
7740
7741
  }, [renderHeader]);
7741
- const defaultHeaderActionsRender = (0, import_react51.useMemo)(() => {
7742
+ const defaultHeaderActionsRender = (0, import_react50.useMemo)(() => {
7742
7743
  if (renderHeaderActions) {
7743
7744
  console.warn(
7744
7745
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
@@ -7755,20 +7756,20 @@ function Puck({
7755
7756
  overrides,
7756
7757
  plugins
7757
7758
  });
7758
- const CustomPuck = (0, import_react51.useMemo)(
7759
+ const CustomPuck = (0, import_react50.useMemo)(
7759
7760
  () => loadedOverrides.puck || DefaultOverride,
7760
7761
  [loadedOverrides]
7761
7762
  );
7762
- const CustomHeader = (0, import_react51.useMemo)(
7763
+ const CustomHeader = (0, import_react50.useMemo)(
7763
7764
  () => loadedOverrides.header || defaultHeaderRender,
7764
7765
  [loadedOverrides]
7765
7766
  );
7766
- const CustomHeaderActions = (0, import_react51.useMemo)(
7767
+ const CustomHeaderActions = (0, import_react50.useMemo)(
7767
7768
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
7768
7769
  [loadedOverrides]
7769
7770
  );
7770
- const [mounted, setMounted] = (0, import_react51.useState)(false);
7771
- (0, import_react51.useEffect)(() => {
7771
+ const [mounted, setMounted] = (0, import_react50.useState)(false);
7772
+ (0, import_react50.useEffect)(() => {
7772
7773
  setMounted(true);
7773
7774
  }, []);
7774
7775
  const selectedComponentConfig = selectedItem && config.components[selectedItem.type];