@measured/puck 0.18.3-canary.934cfae → 0.18.3-canary.98ad734

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