@measured/puck 0.19.0-canary.84a836b → 0.19.0-canary.a931e6b

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.mjs CHANGED
@@ -8,7 +8,6 @@ import {
8
8
  __spreadProps,
9
9
  __spreadValues,
10
10
  __toESM,
11
- defaultData,
12
11
  getChanged,
13
12
  init_react_import,
14
13
  resolveAllData,
@@ -17,8 +16,9 @@ import {
17
16
  rootAreaId,
18
17
  rootDroppableId,
19
18
  rootZone,
20
- setupZone
21
- } from "./chunk-T6VJEBJD.mjs";
19
+ setupZone,
20
+ transformProps
21
+ } from "./chunk-7N5DRY4G.mjs";
22
22
 
23
23
  // ../../node_modules/classnames/index.js
24
24
  var require_classnames = __commonJS({
@@ -215,7 +215,7 @@ import {
215
215
  useContext as useContext3,
216
216
  useEffect as useEffect11,
217
217
  useMemo as useMemo5,
218
- useState as useState9
218
+ useState as useState8
219
219
  } from "react";
220
220
 
221
221
  // components/AutoField/fields/index.tsx
@@ -676,7 +676,7 @@ var IconButton = ({
676
676
  };
677
677
 
678
678
  // components/AutoField/fields/ArrayField/index.tsx
679
- import { useCallback as useCallback2, useEffect as useEffect6, useState as useState4 } from "react";
679
+ import { useCallback as useCallback2, useEffect as useEffect6, useRef, useState as useState3 } from "react";
680
680
 
681
681
  // components/DragIcon/index.tsx
682
682
  init_react_import();
@@ -1891,7 +1891,6 @@ function useAppStoreApi() {
1891
1891
  // components/Sortable/index.tsx
1892
1892
  init_react_import();
1893
1893
  import { DragDropProvider } from "@dnd-kit/react";
1894
- import { useState as useState3 } from "react";
1895
1894
 
1896
1895
  // lib/dnd/dnd-kit/safe.ts
1897
1896
  init_react_import();
@@ -1917,7 +1916,8 @@ function useDraggableSafe(input) {
1917
1916
  function useSortableSafe(input) {
1918
1917
  if (typeof window === "undefined") {
1919
1918
  return { ref: () => {
1920
- }, status: "idle" };
1919
+ }, status: "idle", handleRef: () => {
1920
+ } };
1921
1921
  }
1922
1922
  return useSortable(input);
1923
1923
  }
@@ -1950,6 +1950,7 @@ var _PointerSensor = class _PointerSensor extends Sensor {
1950
1950
  this.listeners = new Listeners();
1951
1951
  this.cleanup = /* @__PURE__ */ new Set();
1952
1952
  this.source = void 0;
1953
+ this.started = false;
1953
1954
  __privateAdd(this, _clearTimeout);
1954
1955
  this.handleCancel = this.handleCancel.bind(this);
1955
1956
  this.handlePointerUp = this.handlePointerUp.bind(this);
@@ -2107,6 +2108,12 @@ var _PointerSensor = class _PointerSensor extends Sensor {
2107
2108
  if (!status.idle) {
2108
2109
  const canceled = !status.initialized;
2109
2110
  this.manager.actions.stop({ canceled });
2111
+ } else if (this.started) {
2112
+ setTimeout(() => {
2113
+ if (!this.manager.dragOperation.status.idle) {
2114
+ this.manager.actions.stop({ canceled: false });
2115
+ }
2116
+ }, 10);
2110
2117
  }
2111
2118
  this.cleanup.forEach((cleanup) => cleanup());
2112
2119
  this.cleanup.clear();
@@ -2121,12 +2128,13 @@ var _PointerSensor = class _PointerSensor extends Sensor {
2121
2128
  var _a;
2122
2129
  const { manager, initialCoordinates } = this;
2123
2130
  (_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
2124
- if (!initialCoordinates || manager.dragOperation.status.initialized) {
2131
+ if (!initialCoordinates || manager.dragOperation.status.initialized || this.started) {
2125
2132
  return;
2126
2133
  }
2127
2134
  if (event.defaultPrevented) {
2128
2135
  return;
2129
2136
  }
2137
+ this.started = true;
2130
2138
  event.preventDefault();
2131
2139
  batch(() => {
2132
2140
  manager.actions.setDragSource(source.id);
@@ -2154,6 +2162,9 @@ var _PointerSensor = class _PointerSensor extends Sensor {
2154
2162
  ]);
2155
2163
  ownerDocument.body.setPointerCapture(event.pointerId);
2156
2164
  this.cleanup.add(unbind);
2165
+ this.cleanup.add(() => {
2166
+ this.started = false;
2167
+ });
2157
2168
  }
2158
2169
  handleDragStart(event) {
2159
2170
  const { target } = event;
@@ -2201,23 +2212,26 @@ function patchWindow(window2) {
2201
2212
 
2202
2213
  // lib/dnd/use-sensors.ts
2203
2214
  import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
2204
- var useSensors = () => {
2215
+ var useSensors = ({
2216
+ other,
2217
+ mouse,
2218
+ touch
2219
+ } = {
2220
+ touch: { delay: { value: 200, tolerance: 10 } },
2221
+ other: { delay: { value: 200, tolerance: 10 }, distance: { value: 5 } }
2222
+ }) => {
2205
2223
  const [sensors] = useState2(() => [
2206
2224
  PointerSensor.configure({
2207
2225
  activationConstraints(event, source) {
2208
2226
  var _a;
2209
2227
  const { pointerType, target } = event;
2210
2228
  if (pointerType === "mouse" && isElement2(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
2211
- return void 0;
2229
+ return mouse;
2212
2230
  }
2213
- const delay = { value: 200, tolerance: 10 };
2214
2231
  if (pointerType === "touch") {
2215
- return { delay };
2232
+ return touch;
2216
2233
  }
2217
- return {
2218
- delay,
2219
- distance: { value: 5 }
2220
- };
2234
+ return other;
2221
2235
  }
2222
2236
  })
2223
2237
  ]);
@@ -2563,7 +2577,6 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2563
2577
  };
2564
2578
 
2565
2579
  // components/Sortable/index.tsx
2566
- import { RestrictToElement } from "@dnd-kit/dom/modifiers";
2567
2580
  import { jsx as jsx5 } from "react/jsx-runtime";
2568
2581
  var SortableProvider = ({
2569
2582
  children,
@@ -2571,22 +2584,20 @@ var SortableProvider = ({
2571
2584
  onDragEnd,
2572
2585
  onMove
2573
2586
  }) => {
2574
- const [move, setMove] = useState3({ source: -1, target: -1 });
2575
- const sensors = useSensors();
2587
+ const sensors = useSensors({
2588
+ mouse: { distance: { value: 5 } }
2589
+ });
2576
2590
  return /* @__PURE__ */ jsx5(
2577
2591
  DragDropProvider,
2578
2592
  {
2579
2593
  sensors,
2580
- modifiers: [
2581
- RestrictToElement.configure({
2582
- element() {
2583
- return document.querySelector("[data-dnd-container]");
2584
- }
2585
- })
2586
- ],
2587
- onDragStart,
2594
+ onDragStart: (event) => {
2595
+ var _a, _b;
2596
+ return onDragStart((_b = (_a = event.operation.source) == null ? void 0 : _a.id.toString()) != null ? _b : "");
2597
+ },
2588
2598
  onDragOver: (event, manager) => {
2589
2599
  var _a, _b;
2600
+ event.preventDefault();
2590
2601
  const { operation } = event;
2591
2602
  const { source, target } = operation;
2592
2603
  if (!source || !target) return;
@@ -2594,14 +2605,14 @@ var SortableProvider = ({
2594
2605
  let targetIndex = target.data.index;
2595
2606
  const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[target.id];
2596
2607
  if (sourceIndex !== targetIndex && source.id !== target.id) {
2597
- const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" ? "before" : "after";
2608
+ const collisionPosition = collisionData.direction === "up" ? "before" : "after";
2598
2609
  if (targetIndex >= sourceIndex) {
2599
2610
  targetIndex = targetIndex - 1;
2600
2611
  }
2601
2612
  if (collisionPosition === "after") {
2602
2613
  targetIndex = targetIndex + 1;
2603
2614
  }
2604
- setMove({
2615
+ onMove({
2605
2616
  source: sourceIndex,
2606
2617
  target: targetIndex
2607
2618
  });
@@ -2609,12 +2620,8 @@ var SortableProvider = ({
2609
2620
  },
2610
2621
  onDragEnd: () => {
2611
2622
  setTimeout(() => {
2612
- if (move.source !== -1 && move.target !== -1) {
2613
- onMove(move);
2614
- }
2615
2623
  onDragEnd();
2616
2624
  }, 250);
2617
- setMove({ source: -1, target: -1 });
2618
2625
  },
2619
2626
  children
2620
2627
  }
@@ -2627,7 +2634,11 @@ var Sortable = ({
2627
2634
  children,
2628
2635
  type = "item"
2629
2636
  }) => {
2630
- const { ref: sortableRef, status } = useSortableSafe({
2637
+ const {
2638
+ ref: sortableRef,
2639
+ status,
2640
+ handleRef
2641
+ } = useSortableSafe({
2631
2642
  id,
2632
2643
  type,
2633
2644
  index,
@@ -2635,7 +2646,7 @@ var Sortable = ({
2635
2646
  data: { index },
2636
2647
  collisionDetector: createDynamicCollisionDetector("y")
2637
2648
  });
2638
- return children({ status, ref: sortableRef });
2649
+ return children({ status, ref: sortableRef, handleRef });
2639
2650
  };
2640
2651
 
2641
2652
  // components/AutoField/context.tsx
@@ -2693,6 +2704,7 @@ var ArrayField = ({
2693
2704
  value: _value,
2694
2705
  name,
2695
2706
  label,
2707
+ labelIcon,
2696
2708
  readOnly,
2697
2709
  id,
2698
2710
  Label: Label2 = (props) => /* @__PURE__ */ jsx7("div", __spreadValues({}, props))
@@ -2710,10 +2722,12 @@ var ArrayField = ({
2710
2722
  }),
2711
2723
  openId: ""
2712
2724
  };
2713
- const [localState, setLocalState] = useState4({ arrayState, value });
2725
+ const [localState, setLocalState] = useState3({ arrayState, value });
2714
2726
  useEffect6(() => {
2715
- setLocalState({ arrayState, value });
2716
- }, [value, thisArrayState]);
2727
+ var _a;
2728
+ const _arrayState = (_a = appStore.getState().state.ui.arrayState[id]) != null ? _a : arrayState;
2729
+ setLocalState({ arrayState: _arrayState, value });
2730
+ }, [value]);
2717
2731
  const appStore = useAppStoreApi();
2718
2732
  const mapArrayStateToUi = useCallback2(
2719
2733
  (partialArrayState) => {
@@ -2756,11 +2770,13 @@ var ArrayField = ({
2756
2770
  setUi(mapArrayStateToUi(arrayState));
2757
2771
  }
2758
2772
  }, []);
2759
- const [isDragging, setIsDragging] = useState4(false);
2773
+ const [draggedItem, setDraggedItem] = useState3("");
2774
+ const isDragging = !!draggedItem;
2760
2775
  const canEdit = useAppStore(
2761
2776
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
2762
2777
  );
2763
2778
  const forceReadOnly = !canEdit;
2779
+ const valueRef = useRef(value);
2764
2780
  if (field.type !== "array" || !field.arrayFields) {
2765
2781
  return null;
2766
2782
  }
@@ -2769,16 +2785,22 @@ var ArrayField = ({
2769
2785
  Label2,
2770
2786
  {
2771
2787
  label: label || name,
2772
- icon: /* @__PURE__ */ jsx7(List, { size: 16 }),
2788
+ icon: labelIcon || /* @__PURE__ */ jsx7(List, { size: 16 }),
2773
2789
  el: "div",
2774
2790
  readOnly,
2775
2791
  children: /* @__PURE__ */ jsx7(
2776
2792
  SortableProvider,
2777
2793
  {
2778
- onDragStart: () => setIsDragging(true),
2779
- onDragEnd: () => setIsDragging(false),
2794
+ onDragStart: (id2) => setDraggedItem(id2),
2795
+ onDragEnd: () => {
2796
+ setDraggedItem("");
2797
+ onChange(valueRef.current);
2798
+ },
2780
2799
  onMove: (move) => {
2781
- const newValue = reorder(value, move.source, move.target);
2800
+ if (arrayState.items[move.source]._arrayId !== draggedItem) {
2801
+ return;
2802
+ }
2803
+ const newValue = reorder(localState.value, move.source, move.target);
2782
2804
  const newArrayStateItems = reorder(
2783
2805
  arrayState.items,
2784
2806
  move.source,
@@ -2791,11 +2813,11 @@ var ArrayField = ({
2791
2813
  })
2792
2814
  };
2793
2815
  setUi(newUi, false);
2794
- onChange(newValue, newUi);
2795
2816
  setLocalState({
2796
2817
  value: newValue,
2797
2818
  arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
2798
2819
  });
2820
+ valueRef.current = newValue;
2799
2821
  },
2800
2822
  children: /* @__PURE__ */ jsxs3(
2801
2823
  "div",
@@ -2805,7 +2827,7 @@ var ArrayField = ({
2805
2827
  addDisabled
2806
2828
  }),
2807
2829
  children: [
2808
- /* @__PURE__ */ jsx7("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
2830
+ localState.arrayState.items.length > 0 && /* @__PURE__ */ jsx7("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
2809
2831
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
2810
2832
  const data = Array.from(localState.value || [])[i] || {};
2811
2833
  return /* @__PURE__ */ jsx7(
@@ -2814,7 +2836,7 @@ var ArrayField = ({
2814
2836
  id: _arrayId,
2815
2837
  index: i,
2816
2838
  disabled: readOnly,
2817
- children: ({ status, ref }) => /* @__PURE__ */ jsxs3(
2839
+ children: ({ status, ref, handleRef }) => /* @__PURE__ */ jsxs3(
2818
2840
  "div",
2819
2841
  {
2820
2842
  ref,
@@ -2827,6 +2849,7 @@ var ArrayField = ({
2827
2849
  /* @__PURE__ */ jsxs3(
2828
2850
  "div",
2829
2851
  {
2852
+ ref: handleRef,
2830
2853
  onClick: (e) => {
2831
2854
  if (isDragging) return;
2832
2855
  e.preventDefault();
@@ -2863,12 +2886,11 @@ var ArrayField = ({
2863
2886
  0,
2864
2887
  existingValue[i]
2865
2888
  );
2866
- onChange(
2867
- existingValue,
2868
- mapArrayStateToUi(
2869
- regenerateArrayState(existingValue)
2870
- )
2889
+ const newUi = mapArrayStateToUi(
2890
+ regenerateArrayState(existingValue)
2871
2891
  );
2892
+ setUi(newUi, false);
2893
+ onChange(existingValue);
2872
2894
  },
2873
2895
  title: "Duplicate",
2874
2896
  children: /* @__PURE__ */ jsx7(Copy, { size: 16 })
@@ -2887,12 +2909,13 @@ var ArrayField = ({
2887
2909
  ];
2888
2910
  existingValue.splice(i, 1);
2889
2911
  existingItems.splice(i, 1);
2890
- onChange(
2891
- existingValue,
2912
+ setUi(
2892
2913
  mapArrayStateToUi({
2893
2914
  items: existingItems
2894
- })
2915
+ }),
2916
+ false
2895
2917
  );
2918
+ onChange(existingValue);
2896
2919
  },
2897
2920
  title: "Delete",
2898
2921
  children: /* @__PURE__ */ jsx7(Trash, { size: 16 })
@@ -2904,58 +2927,49 @@ var ArrayField = ({
2904
2927
  ]
2905
2928
  }
2906
2929
  ),
2907
- /* @__PURE__ */ jsx7("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx7(
2908
- "fieldset",
2909
- {
2910
- className: getClassNameItem("fieldset"),
2911
- onPointerDownCapture: (e) => {
2912
- e.stopPropagation();
2913
- },
2914
- children: Object.keys(field.arrayFields).map((subName) => {
2915
- const subField = field.arrayFields[subName];
2916
- const indexName = `${name}[${i}]`;
2917
- const subPath = `${indexName}.${subName}`;
2918
- const localIndexName = `${localName}[${i}]`;
2919
- const localWildcardName = `${localName}[*]`;
2920
- const localSubPath = `${localIndexName}.${subName}`;
2921
- const localWildcardSubPath = `${localWildcardName}.${subName}`;
2922
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2923
- const label2 = subField.label || subName;
2924
- return /* @__PURE__ */ jsx7(
2925
- NestedFieldProvider,
2930
+ /* @__PURE__ */ jsx7("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx7("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
2931
+ const subField = field.arrayFields[subName];
2932
+ const indexName = `${name}[${i}]`;
2933
+ const subPath = `${indexName}.${subName}`;
2934
+ const localIndexName = `${localName}[${i}]`;
2935
+ const localWildcardName = `${localName}[*]`;
2936
+ const localSubPath = `${localIndexName}.${subName}`;
2937
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
2938
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
2939
+ const label2 = subField.label || subName;
2940
+ return /* @__PURE__ */ jsx7(
2941
+ NestedFieldProvider,
2942
+ {
2943
+ name: localIndexName,
2944
+ wildcardName: localWildcardName,
2945
+ subName,
2946
+ readOnlyFields,
2947
+ children: /* @__PURE__ */ jsx7(
2948
+ AutoFieldPrivate,
2926
2949
  {
2927
- name: localIndexName,
2928
- wildcardName: localWildcardName,
2929
- subName,
2930
- readOnlyFields,
2931
- children: /* @__PURE__ */ jsx7(
2932
- AutoFieldPrivate,
2933
- {
2934
- name: subPath,
2935
- label: label2,
2936
- id: `${_arrayId}_${subName}`,
2937
- readOnly: subReadOnly,
2938
- field: __spreadProps(__spreadValues({}, subField), {
2939
- label: label2
2940
- // May be used by custom fields
2941
- }),
2942
- value: data[subName],
2943
- onChange: (val, ui) => {
2944
- onChange(
2945
- replace(value, i, __spreadProps(__spreadValues({}, data), {
2946
- [subName]: val
2947
- })),
2948
- ui
2949
- );
2950
- }
2951
- }
2952
- )
2953
- },
2954
- subPath
2955
- );
2956
- })
2957
- }
2958
- ) })
2950
+ name: subPath,
2951
+ label: label2,
2952
+ id: `${_arrayId}_${subName}`,
2953
+ readOnly: subReadOnly,
2954
+ field: __spreadProps(__spreadValues({}, subField), {
2955
+ label: label2
2956
+ // May be used by custom fields
2957
+ }),
2958
+ value: data[subName],
2959
+ onChange: (val, ui) => {
2960
+ onChange(
2961
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
2962
+ [subName]: val
2963
+ })),
2964
+ ui
2965
+ );
2966
+ }
2967
+ }
2968
+ )
2969
+ },
2970
+ subPath
2971
+ );
2972
+ }) }) })
2959
2973
  ]
2960
2974
  }
2961
2975
  )
@@ -2976,7 +2990,8 @@ var ArrayField = ({
2976
2990
  field.defaultItemProps || {}
2977
2991
  ];
2978
2992
  const newArrayState = regenerateArrayState(newValue);
2979
- onChange(newValue, mapArrayStateToUi(newArrayState));
2993
+ setUi(mapArrayStateToUi(newArrayState), false);
2994
+ onChange(newValue);
2980
2995
  },
2981
2996
  children: /* @__PURE__ */ jsx7(Plus, { size: 21 })
2982
2997
  }
@@ -3001,6 +3016,7 @@ var DefaultField = ({
3001
3016
  value: _value,
3002
3017
  name,
3003
3018
  label,
3019
+ labelIcon,
3004
3020
  Label: Label2,
3005
3021
  id
3006
3022
  }) => {
@@ -3009,7 +3025,7 @@ var DefaultField = ({
3009
3025
  Label2,
3010
3026
  {
3011
3027
  label: label || name,
3012
- icon: /* @__PURE__ */ jsxs4(Fragment2, { children: [
3028
+ icon: labelIcon || /* @__PURE__ */ jsxs4(Fragment2, { children: [
3013
3029
  field.type === "text" && /* @__PURE__ */ jsx8(Type, { size: 16 }),
3014
3030
  field.type === "number" && /* @__PURE__ */ jsx8(Hash, { size: 16 })
3015
3031
  ] }),
@@ -3059,7 +3075,7 @@ init_react_import();
3059
3075
  import {
3060
3076
  useMemo as useMemo2,
3061
3077
  useEffect as useEffect9,
3062
- useState as useState7,
3078
+ useState as useState6,
3063
3079
  useCallback as useCallback3,
3064
3080
  isValidElement
3065
3081
  } from "react";
@@ -3070,7 +3086,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
3070
3086
 
3071
3087
  // components/Modal/index.tsx
3072
3088
  init_react_import();
3073
- import { useEffect as useEffect7, useState as useState5 } from "react";
3089
+ import { useEffect as useEffect7, useState as useState4 } from "react";
3074
3090
 
3075
3091
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
3076
3092
  init_react_import();
@@ -3085,7 +3101,7 @@ var Modal = ({
3085
3101
  onClose,
3086
3102
  isOpen
3087
3103
  }) => {
3088
- const [rootEl, setRootEl] = useState5(null);
3104
+ const [rootEl, setRootEl] = useState4(null);
3089
3105
  useEffect7(() => {
3090
3106
  setRootEl(document.getElementById("puck-portal-root"));
3091
3107
  }, []);
@@ -3133,7 +3149,7 @@ init_react_import();
3133
3149
 
3134
3150
  // components/Button/Button.tsx
3135
3151
  init_react_import();
3136
- import { useEffect as useEffect8, useState as useState6 } from "react";
3152
+ import { useEffect as useEffect8, useState as useState5 } from "react";
3137
3153
 
3138
3154
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
3139
3155
  init_react_import();
@@ -3183,7 +3199,7 @@ var Button = (_a) => {
3183
3199
  "size",
3184
3200
  "loading"
3185
3201
  ]);
3186
- const [loading, setLoading] = useState6(loadingProp);
3202
+ const [loading, setLoading] = useState5(loadingProp);
3187
3203
  useEffect8(() => setLoading(loadingProp), [loadingProp]);
3188
3204
  const ElementType = href ? "a" : type ? "button" : "span";
3189
3205
  const dataAttrs = filterDataAttrs(props);
@@ -3239,12 +3255,12 @@ var ExternalInput = ({
3239
3255
  mapRow = (val) => val,
3240
3256
  filterFields
3241
3257
  } = field || {};
3242
- const [data, setData] = useState7([]);
3243
- const [isOpen, setOpen] = useState7(false);
3244
- const [isLoading, setIsLoading] = useState7(true);
3258
+ const [data, setData] = useState6([]);
3259
+ const [isOpen, setOpen] = useState6(false);
3260
+ const [isLoading, setIsLoading] = useState6(true);
3245
3261
  const hasFilterFields = !!filterFields;
3246
- const [filters, setFilters] = useState7(field.initialFilters || {});
3247
- const [filtersToggled, setFiltersToggled] = useState7(hasFilterFields);
3262
+ const [filters, setFilters] = useState6(field.initialFilters || {});
3263
+ const [filtersToggled, setFiltersToggled] = useState6(hasFilterFields);
3248
3264
  const mappedData = useMemo2(() => {
3249
3265
  return data.map(mapRow);
3250
3266
  }, [data]);
@@ -3259,7 +3275,7 @@ var ExternalInput = ({
3259
3275
  }
3260
3276
  return Array.from(validKeys);
3261
3277
  }, [mappedData]);
3262
- const [searchQuery, setSearchQuery] = useState7(field.initialQuery || "");
3278
+ const [searchQuery, setSearchQuery] = useState6(field.initialQuery || "");
3263
3279
  const search = useCallback3(
3264
3280
  (query, filters2) => __async(void 0, null, function* () {
3265
3281
  setIsLoading(true);
@@ -3445,6 +3461,7 @@ var ExternalField = ({
3445
3461
  value,
3446
3462
  name,
3447
3463
  label,
3464
+ labelIcon,
3448
3465
  Label: Label2,
3449
3466
  id,
3450
3467
  readOnly
@@ -3462,27 +3479,35 @@ var ExternalField = ({
3462
3479
  if (field.type !== "external") {
3463
3480
  return null;
3464
3481
  }
3465
- return /* @__PURE__ */ jsx13(Label2, { label: label || name, icon: /* @__PURE__ */ jsx13(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx13(
3466
- ExternalInput,
3482
+ return /* @__PURE__ */ jsx13(
3483
+ Label2,
3467
3484
  {
3468
- name,
3469
- field: __spreadProps(__spreadValues({}, validField), {
3470
- // DEPRECATED
3471
- placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
3472
- mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
3473
- mapRow: validField.mapRow,
3474
- fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
3475
- return yield deprecatedField.adaptor.fetchList(
3476
- deprecatedField.adaptorParams
3477
- );
3478
- }) : validField.fetchList
3479
- }),
3480
- onChange,
3481
- value,
3482
- id,
3483
- readOnly
3485
+ label: label || name,
3486
+ icon: labelIcon || /* @__PURE__ */ jsx13(Link, { size: 16 }),
3487
+ el: "div",
3488
+ children: /* @__PURE__ */ jsx13(
3489
+ ExternalInput,
3490
+ {
3491
+ name,
3492
+ field: __spreadProps(__spreadValues({}, validField), {
3493
+ // DEPRECATED
3494
+ placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
3495
+ mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
3496
+ mapRow: validField.mapRow,
3497
+ fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
3498
+ return yield deprecatedField.adaptor.fetchList(
3499
+ deprecatedField.adaptorParams
3500
+ );
3501
+ }) : validField.fetchList
3502
+ }),
3503
+ onChange,
3504
+ value,
3505
+ id,
3506
+ readOnly
3507
+ }
3508
+ )
3484
3509
  }
3485
- ) });
3510
+ );
3486
3511
  };
3487
3512
 
3488
3513
  // components/AutoField/fields/RadioField/index.tsx
@@ -3511,6 +3536,7 @@ var RadioField = ({
3511
3536
  name,
3512
3537
  id,
3513
3538
  label,
3539
+ labelIcon,
3514
3540
  Label: Label2
3515
3541
  }) => {
3516
3542
  const flatOptions = useMemo3(
@@ -3523,7 +3549,7 @@ var RadioField = ({
3523
3549
  return /* @__PURE__ */ jsx14(
3524
3550
  Label2,
3525
3551
  {
3526
- icon: /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
3552
+ icon: labelIcon || /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
3527
3553
  label: label || name,
3528
3554
  readOnly,
3529
3555
  el: "div",
@@ -3570,6 +3596,7 @@ var SelectField = ({
3570
3596
  field,
3571
3597
  onChange,
3572
3598
  label,
3599
+ labelIcon,
3573
3600
  Label: Label2,
3574
3601
  value,
3575
3602
  name,
@@ -3587,7 +3614,7 @@ var SelectField = ({
3587
3614
  Label2,
3588
3615
  {
3589
3616
  label: label || name,
3590
- icon: /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
3617
+ icon: labelIcon || /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
3591
3618
  readOnly,
3592
3619
  children: /* @__PURE__ */ jsx15(
3593
3620
  "select",
@@ -3631,24 +3658,33 @@ var TextareaField = ({
3631
3658
  value,
3632
3659
  name,
3633
3660
  label,
3661
+ labelIcon,
3634
3662
  Label: Label2,
3635
3663
  id
3636
3664
  }) => {
3637
- return /* @__PURE__ */ jsx16(Label2, { label: label || name, icon: /* @__PURE__ */ jsx16(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx16(
3638
- "textarea",
3665
+ return /* @__PURE__ */ jsx16(
3666
+ Label2,
3639
3667
  {
3640
- id,
3641
- className: getClassName13("input"),
3642
- autoComplete: "off",
3643
- name,
3644
- value: typeof value === "undefined" ? "" : value,
3645
- onChange: (e) => onChange(e.currentTarget.value),
3668
+ label: label || name,
3669
+ icon: labelIcon || /* @__PURE__ */ jsx16(Type, { size: 16 }),
3646
3670
  readOnly,
3647
- tabIndex: readOnly ? -1 : void 0,
3648
- rows: 5,
3649
- placeholder: field.type === "textarea" ? field.placeholder : void 0
3671
+ children: /* @__PURE__ */ jsx16(
3672
+ "textarea",
3673
+ {
3674
+ id,
3675
+ className: getClassName13("input"),
3676
+ autoComplete: "off",
3677
+ name,
3678
+ value: typeof value === "undefined" ? "" : value,
3679
+ onChange: (e) => onChange(e.currentTarget.value),
3680
+ readOnly,
3681
+ tabIndex: readOnly ? -1 : void 0,
3682
+ rows: 5,
3683
+ placeholder: field.type === "textarea" ? field.placeholder : void 0
3684
+ }
3685
+ )
3650
3686
  }
3651
- ) });
3687
+ );
3652
3688
  };
3653
3689
 
3654
3690
  // components/AutoField/fields/ObjectField/index.tsx
@@ -3667,6 +3703,7 @@ var ObjectField = ({
3667
3703
  value,
3668
3704
  name,
3669
3705
  label,
3706
+ labelIcon,
3670
3707
  Label: Label2,
3671
3708
  readOnly,
3672
3709
  id
@@ -3680,7 +3717,7 @@ var ObjectField = ({
3680
3717
  Label2,
3681
3718
  {
3682
3719
  label: label || name,
3683
- icon: /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
3720
+ icon: labelIcon || /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
3684
3721
  el: "div",
3685
3722
  readOnly,
3686
3723
  children: /* @__PURE__ */ jsx17("div", { className: getClassName14(), children: /* @__PURE__ */ jsx17("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
@@ -3727,12 +3764,12 @@ var ObjectField = ({
3727
3764
 
3728
3765
  // lib/use-safe-id.ts
3729
3766
  init_react_import();
3730
- import React2, { useState as useState8 } from "react";
3767
+ import React2, { useState as useState7 } from "react";
3731
3768
  var useSafeId = () => {
3732
3769
  if (typeof React2.useId !== "undefined") {
3733
3770
  return React2.useId();
3734
3771
  }
3735
- const [id] = useState8(generateId());
3772
+ const [id] = useState7(generateId());
3736
3773
  return id;
3737
3774
  };
3738
3775
 
@@ -3797,6 +3834,7 @@ function AutoFieldInternal(props) {
3797
3834
  const { id, Label: Label2 = FieldLabelInternal } = props;
3798
3835
  const field = props.field;
3799
3836
  const label = field.label;
3837
+ const labelIcon = field.labelIcon;
3800
3838
  const defaultId = useSafeId();
3801
3839
  const resolvedId = id || defaultId;
3802
3840
  const defaultFields = {
@@ -3822,6 +3860,7 @@ function AutoFieldInternal(props) {
3822
3860
  const mergedProps = __spreadProps(__spreadValues({}, props), {
3823
3861
  field,
3824
3862
  label,
3863
+ labelIcon,
3825
3864
  Label: Label2,
3826
3865
  id: resolvedId
3827
3866
  });
@@ -3883,11 +3922,14 @@ function AutoFieldInternal(props) {
3883
3922
  function AutoFieldPrivate(props) {
3884
3923
  const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
3885
3924
  const { value, onChange } = props;
3886
- const [localValue, setLocalValue] = useState9(value);
3887
- const onChangeLocal = useCallback4((val, ui) => {
3888
- setLocalValue(val);
3889
- onChange(val, ui);
3890
- }, []);
3925
+ const [localValue, setLocalValue] = useState8(value);
3926
+ const onChangeLocal = useCallback4(
3927
+ (val, ui) => {
3928
+ setLocalValue(val);
3929
+ onChange(val, ui);
3930
+ },
3931
+ [onChange]
3932
+ );
3891
3933
  useEffect11(() => {
3892
3934
  if (!isFocused) {
3893
3935
  setLocalValue(value);
@@ -3920,7 +3962,7 @@ init_react_import();
3920
3962
  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" };
3921
3963
 
3922
3964
  // components/Drawer/index.tsx
3923
- import { useId as useId2, useMemo as useMemo9, useState as useState16 } from "react";
3965
+ import { useMemo as useMemo9, useState as useState15 } from "react";
3924
3966
 
3925
3967
  // components/DragDropContext/index.tsx
3926
3968
  init_react_import();
@@ -3930,9 +3972,8 @@ import {
3930
3972
  useCallback as useCallback10,
3931
3973
  useContext as useContext7,
3932
3974
  useEffect as useEffect17,
3933
- useId,
3934
- useRef as useRef3,
3935
- useState as useState15
3975
+ useRef as useRef4,
3976
+ useState as useState14
3936
3977
  } from "react";
3937
3978
  import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
3938
3979
 
@@ -3944,7 +3985,7 @@ import {
3944
3985
  useContext as useContext6,
3945
3986
  useEffect as useEffect16,
3946
3987
  useMemo as useMemo8,
3947
- useRef as useRef2
3988
+ useRef as useRef3
3948
3989
  } from "react";
3949
3990
 
3950
3991
  // components/DraggableComponent/index.tsx
@@ -3954,8 +3995,8 @@ import {
3954
3995
  useContext as useContext5,
3955
3996
  useEffect as useEffect12,
3956
3997
  useMemo as useMemo7,
3957
- useRef,
3958
- useState as useState11
3998
+ useRef as useRef2,
3999
+ useState as useState10
3959
4000
  } from "react";
3960
4001
 
3961
4002
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
@@ -3990,7 +4031,7 @@ import {
3990
4031
  createContext as createContext3,
3991
4032
  useCallback as useCallback5,
3992
4033
  useMemo as useMemo6,
3993
- useState as useState10
4034
+ useState as useState9
3994
4035
  } from "react";
3995
4036
  import { createStore as createStore2 } from "zustand";
3996
4037
  import { Fragment as Fragment5, jsx as jsx19 } from "react/jsx-runtime";
@@ -4015,8 +4056,8 @@ var DropZoneProvider = ({
4015
4056
  children,
4016
4057
  value
4017
4058
  }) => {
4018
- const [hoveringComponent, setHoveringComponent] = useState10();
4019
- const [activeZones, setActiveZones] = useState10({});
4059
+ const [hoveringComponent, setHoveringComponent] = useState9();
4060
+ const [activeZones, setActiveZones] = useState9({});
4020
4061
  const dispatch = useAppStore((s) => s.dispatch);
4021
4062
  const registerZone = useCallback5(
4022
4063
  (zoneCompound) => {
@@ -4124,7 +4165,7 @@ var DraggableComponent = ({
4124
4165
  const dispatch = useAppStore((s) => s.dispatch);
4125
4166
  const iframe = useAppStore((s) => s.iframe);
4126
4167
  const ctx = useContext5(dropZoneContext);
4127
- const [localZones, setLocalZones] = useState11({});
4168
+ const [localZones, setLocalZones] = useState10({});
4128
4169
  const registerLocalZone = useCallback6(
4129
4170
  (zoneCompound2, active) => {
4130
4171
  var _a;
@@ -4165,7 +4206,7 @@ var DraggableComponent = ({
4165
4206
  );
4166
4207
  const canCollide = permissions.drag || userIsDragging;
4167
4208
  const disabled = !isEnabled || !canCollide;
4168
- const [dragAxis, setDragAxis] = useState11(userDragAxis || autoDragAxis);
4209
+ const [dragAxis, setDragAxis] = useState10(userDragAxis || autoDragAxis);
4169
4210
  const { ref: sortableRef, status } = useSortableSafe({
4170
4211
  id,
4171
4212
  index,
@@ -4191,7 +4232,7 @@ var DraggableComponent = ({
4191
4232
  }
4192
4233
  });
4193
4234
  const thisIsDragging = status === "dragging";
4194
- const ref = useRef(null);
4235
+ const ref = useRef2(null);
4195
4236
  const refSetter = useCallback6(
4196
4237
  (el) => {
4197
4238
  sortableRef(el);
@@ -4201,7 +4242,7 @@ var DraggableComponent = ({
4201
4242
  },
4202
4243
  [sortableRef]
4203
4244
  );
4204
- const [portalEl, setPortalEl] = useState11();
4245
+ const [portalEl, setPortalEl] = useState10();
4205
4246
  useEffect12(() => {
4206
4247
  var _a, _b, _c;
4207
4248
  setPortalEl(
@@ -4228,7 +4269,7 @@ var DraggableComponent = ({
4228
4269
  };
4229
4270
  return style2;
4230
4271
  }, [ref.current]);
4231
- const [style, setStyle] = useState11();
4272
+ const [style, setStyle] = useState10();
4232
4273
  const sync = useCallback6(() => {
4233
4274
  setStyle(getStyle());
4234
4275
  }, [ref.current, iframe]);
@@ -4297,7 +4338,7 @@ var DraggableComponent = ({
4297
4338
  zone: zoneCompound
4298
4339
  });
4299
4340
  }, [index, zoneCompound]);
4300
- const [hover, setHover] = useState11(false);
4341
+ const [hover, setHover] = useState10(false);
4301
4342
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
4302
4343
  useEffect12(() => {
4303
4344
  if (!ref.current) {
@@ -4358,7 +4399,7 @@ var DraggableComponent = ({
4358
4399
  };
4359
4400
  }
4360
4401
  }, [disabled, ref]);
4361
- const [isVisible, setIsVisible] = useState11(false);
4402
+ const [isVisible, setIsVisible] = useState10(false);
4362
4403
  useEffect12(() => {
4363
4404
  sync();
4364
4405
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
@@ -4375,10 +4416,18 @@ var DraggableComponent = ({
4375
4416
  const rect = el.getBoundingClientRect();
4376
4417
  const diffLeft = rect.x;
4377
4418
  const exceedsBoundsLeft = diffLeft < 0;
4419
+ const diffTop = rect.y;
4420
+ const exceedsBoundsTop = diffTop < 0;
4378
4421
  if (exceedsBoundsLeft) {
4379
4422
  el.style.transformOrigin = "left top";
4380
4423
  el.style.left = "0px";
4381
4424
  }
4425
+ if (exceedsBoundsTop) {
4426
+ el.style.top = "12px";
4427
+ if (!exceedsBoundsLeft) {
4428
+ el.style.transformOrigin = "right top";
4429
+ }
4430
+ }
4382
4431
  }
4383
4432
  }
4384
4433
  },
@@ -4477,15 +4526,15 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
4477
4526
 
4478
4527
  // components/DropZone/lib/use-min-empty-height.ts
4479
4528
  init_react_import();
4480
- import { useEffect as useEffect13, useState as useState12 } from "react";
4529
+ import { useEffect as useEffect13, useState as useState11 } from "react";
4481
4530
  var useMinEmptyHeight = ({
4482
4531
  zoneCompound,
4483
4532
  userMinEmptyHeight,
4484
4533
  ref
4485
4534
  }) => {
4486
4535
  const appStore = useAppStoreApi();
4487
- const [prevHeight, setPrevHeight] = useState12(0);
4488
- const [isAnimating, setIsAnimating] = useState12(false);
4536
+ const [prevHeight, setPrevHeight] = useState11(0);
4537
+ const [isAnimating, setIsAnimating] = useState11(false);
4489
4538
  const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
4490
4539
  var _a, _b;
4491
4540
  return {
@@ -4531,7 +4580,7 @@ function assignRefs(refs, node) {
4531
4580
 
4532
4581
  // components/DropZone/lib/use-content-with-preview.ts
4533
4582
  init_react_import();
4534
- import { useEffect as useEffect14, useState as useState13 } from "react";
4583
+ import { useEffect as useEffect14, useState as useState12 } from "react";
4535
4584
 
4536
4585
  // lib/dnd/use-rendered-callback.ts
4537
4586
  init_react_import();
@@ -4562,8 +4611,8 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
4562
4611
  }
4563
4612
  );
4564
4613
  const isDragging = useAppStore((s) => s.state.ui.isDragging);
4565
- const [contentIdsWithPreview, setContentIdsWithPreview] = useState13(contentIds);
4566
- const [localPreview, setLocalPreview] = useState13(
4614
+ const [contentIdsWithPreview, setContentIdsWithPreview] = useState12(contentIds);
4615
+ const [localPreview, setLocalPreview] = useState12(
4567
4616
  preview
4568
4617
  );
4569
4618
  const updateContent = useRenderedCallback(
@@ -4606,13 +4655,13 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
4606
4655
 
4607
4656
  // components/DropZone/lib/use-drag-axis.ts
4608
4657
  init_react_import();
4609
- import { useCallback as useCallback8, useEffect as useEffect15, useState as useState14 } from "react";
4658
+ import { useCallback as useCallback8, useEffect as useEffect15, useState as useState13 } from "react";
4610
4659
  var GRID_DRAG_AXIS = "dynamic";
4611
4660
  var FLEX_ROW_DRAG_AXIS = "x";
4612
4661
  var DEFAULT_DRAG_AXIS = "y";
4613
4662
  var useDragAxis = (ref, collisionAxis) => {
4614
4663
  const status = useAppStore((s) => s.status);
4615
- const [dragAxis, setDragAxis] = useState14(
4664
+ const [dragAxis, setDragAxis] = useState13(
4616
4665
  collisionAxis || DEFAULT_DRAG_AXIS
4617
4666
  );
4618
4667
  const calculateDragAxis = useCallback8(() => {
@@ -4868,7 +4917,7 @@ var DropZoneEdit = forwardRef3(
4868
4917
  return content.map(({ props }) => props.id);
4869
4918
  })
4870
4919
  );
4871
- const ref = useRef2(null);
4920
+ const ref = useRef3(null);
4872
4921
  const acceptsTarget = useCallback9(
4873
4922
  (componentType) => {
4874
4923
  if (!componentType) {
@@ -5370,7 +5419,7 @@ function useDragListener(type, fn, deps = []) {
5370
5419
  }
5371
5420
  var AREA_CHANGE_DEBOUNCE_MS = 100;
5372
5421
  var useTempDisableFallback = (timeout3) => {
5373
- const lastFallbackDisable = useRef3(null);
5422
+ const lastFallbackDisable = useRef4(null);
5374
5423
  return useCallback10((manager) => {
5375
5424
  collisionStore.setState({ fallbackEnabled: false });
5376
5425
  const fallbackId = generateId();
@@ -5392,10 +5441,10 @@ var DragDropContextClient = ({
5392
5441
  const resolveData2 = useAppStore((s) => s.resolveData);
5393
5442
  const metadata = useAppStore((s) => s.metadata);
5394
5443
  const appStore = useAppStoreApi();
5395
- const id = useId();
5396
- const debouncedParamsRef = useRef3(null);
5444
+ const id = useSafeId();
5445
+ const debouncedParamsRef = useRef4(null);
5397
5446
  const tempDisableFallback = useTempDisableFallback(100);
5398
- const [zoneStore] = useState15(
5447
+ const [zoneStore] = useState14(
5399
5448
  () => createStore3(() => ({
5400
5449
  zoneDepthIndex: {},
5401
5450
  nextZoneDepthIndex: {},
@@ -5464,7 +5513,7 @@ var DragDropContextClient = ({
5464
5513
  );
5465
5514
  }
5466
5515
  }, []);
5467
- const [plugins] = useState15(() => [
5516
+ const [plugins] = useState14(() => [
5468
5517
  ...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
5469
5518
  createNestedDroppablePlugin(
5470
5519
  {
@@ -5512,9 +5561,9 @@ var DragDropContextClient = ({
5512
5561
  )
5513
5562
  ]);
5514
5563
  const sensors = useSensors();
5515
- const [dragListeners, setDragListeners] = useState15({});
5516
- const dragMode = useRef3(null);
5517
- const initialSelector = useRef3(void 0);
5564
+ const [dragListeners, setDragListeners] = useState14({});
5565
+ const dragMode = useRef4(null);
5566
+ const initialSelector = useRef4(void 0);
5518
5567
  return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
5519
5568
  dragListenerContext.Provider,
5520
5569
  {
@@ -5807,7 +5856,7 @@ var DrawerItem = ({
5807
5856
  isDragDisabled
5808
5857
  }) => {
5809
5858
  const resolvedId = id || name;
5810
- const [dynamicId, setDynamicId] = useState16(generateId(resolvedId));
5859
+ const [dynamicId, setDynamicId] = useState15(generateId(resolvedId));
5811
5860
  if (typeof index !== "undefined") {
5812
5861
  console.error(
5813
5862
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -5846,7 +5895,7 @@ var Drawer = ({
5846
5895
  "Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
5847
5896
  );
5848
5897
  }
5849
- const id = useId2();
5898
+ const id = useSafeId();
5850
5899
  const { ref } = useDroppableSafe({
5851
5900
  id,
5852
5901
  type: "void",
@@ -5874,7 +5923,7 @@ import {
5874
5923
  useContext as useContext11,
5875
5924
  useEffect as useEffect25,
5876
5925
  useMemo as useMemo18,
5877
- useState as useState23
5926
+ useState as useState22
5878
5927
  } from "react";
5879
5928
 
5880
5929
  // components/SidebarSection/index.tsx
@@ -6174,7 +6223,7 @@ init_react_import();
6174
6223
 
6175
6224
  // lib/use-component-list.tsx
6176
6225
  init_react_import();
6177
- import { useEffect as useEffect18, useState as useState17 } from "react";
6226
+ import { useEffect as useEffect18, useState as useState16 } from "react";
6178
6227
 
6179
6228
  // components/ComponentList/index.tsx
6180
6229
  init_react_import();
@@ -6245,7 +6294,7 @@ ComponentList.Item = ComponentListItem;
6245
6294
  // lib/use-component-list.tsx
6246
6295
  import { jsx as jsx29 } from "react/jsx-runtime";
6247
6296
  var useComponentList = () => {
6248
- const [componentList, setComponentList] = useState17();
6297
+ const [componentList, setComponentList] = useState16();
6249
6298
  const config = useAppStore((s) => s.config);
6250
6299
  const uiComponentList = useAppStore((s) => s.state.ui.componentList);
6251
6300
  useEffect18(() => {
@@ -6328,7 +6377,7 @@ var Components = () => {
6328
6377
 
6329
6378
  // components/Puck/components/Preview/index.tsx
6330
6379
  init_react_import();
6331
- import { useCallback as useCallback12, useEffect as useEffect20, useRef as useRef4, useMemo as useMemo13 } from "react";
6380
+ import { useCallback as useCallback12, useEffect as useEffect20, useRef as useRef5, useMemo as useMemo13 } from "react";
6332
6381
 
6333
6382
  // components/AutoFrame/index.tsx
6334
6383
  init_react_import();
@@ -6336,7 +6385,7 @@ import {
6336
6385
  createContext as createContext5,
6337
6386
  useContext as useContext8,
6338
6387
  useEffect as useEffect19,
6339
- useState as useState18
6388
+ useState as useState17
6340
6389
  } from "react";
6341
6390
  import hash from "object-hash";
6342
6391
  import { createPortal as createPortal3 } from "react-dom";
@@ -6564,10 +6613,10 @@ function AutoFrame(_a) {
6564
6613
  "onNotReady",
6565
6614
  "frameRef"
6566
6615
  ]);
6567
- const [loaded, setLoaded] = useState18(false);
6568
- const [ctx, setCtx] = useState18({});
6569
- const [mountTarget, setMountTarget] = useState18();
6570
- const [stylesLoaded, setStylesLoaded] = useState18(false);
6616
+ const [loaded, setLoaded] = useState17(false);
6617
+ const [ctx, setCtx] = useState17({});
6618
+ const [mountTarget, setMountTarget] = useState17();
6619
+ const [stylesLoaded, setStylesLoaded] = useState17(false);
6571
6620
  useEffect19(() => {
6572
6621
  var _a2;
6573
6622
  if (frameRef.current) {
@@ -6680,7 +6729,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
6680
6729
  );
6681
6730
  const Frame = useMemo13(() => overrides.iframe, [overrides]);
6682
6731
  const rootProps = root.props || root;
6683
- const ref = useRef4(null);
6732
+ const ref = useRef5(null);
6684
6733
  useBubbleIframeEvents(ref);
6685
6734
  const inner = !renderData ? /* @__PURE__ */ jsx32(
6686
6735
  Page,
@@ -7112,13 +7161,13 @@ import {
7112
7161
  useCallback as useCallback14,
7113
7162
  useEffect as useEffect22,
7114
7163
  useMemo as useMemo16,
7115
- useRef as useRef5,
7116
- useState as useState20
7164
+ useRef as useRef6,
7165
+ useState as useState19
7117
7166
  } from "react";
7118
7167
 
7119
7168
  // components/ViewportControls/index.tsx
7120
7169
  init_react_import();
7121
- import { useEffect as useEffect21, useMemo as useMemo15, useState as useState19 } from "react";
7170
+ import { useEffect as useEffect21, useMemo as useMemo15, useState as useState18 } from "react";
7122
7171
 
7123
7172
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
7124
7173
  init_react_import();
@@ -7141,7 +7190,7 @@ var ViewportButton = ({
7141
7190
  onClick
7142
7191
  }) => {
7143
7192
  const viewports = useAppStore((s) => s.state.ui.viewports);
7144
- const [isActive, setIsActive] = useState19(false);
7193
+ const [isActive, setIsActive] = useState18(false);
7145
7194
  useEffect21(() => {
7146
7195
  setIsActive(width === viewports.current.width);
7147
7196
  }, [width, viewports.current.width]);
@@ -7325,8 +7374,8 @@ var Canvas = () => {
7325
7374
  viewports: s.state.ui.viewports
7326
7375
  }))
7327
7376
  );
7328
- const frameRef = useRef5(null);
7329
- const [showTransition, setShowTransition] = useState20(false);
7377
+ const frameRef = useRef6(null);
7378
+ const [showTransition, setShowTransition] = useState19(false);
7330
7379
  const defaultRender = useMemo16(() => {
7331
7380
  const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment13, { children });
7332
7381
  return PuckDefault;
@@ -7385,7 +7434,7 @@ var Canvas = () => {
7385
7434
  window.removeEventListener("resize", cb);
7386
7435
  };
7387
7436
  }, []);
7388
- const [showLoader, setShowLoader] = useState20(false);
7437
+ const [showLoader, setShowLoader] = useState19(false);
7389
7438
  useEffect22(() => {
7390
7439
  setTimeout(() => {
7391
7440
  setShowLoader(true);
@@ -7515,10 +7564,10 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx37(Fragment14, { chil
7515
7564
 
7516
7565
  // lib/use-inject-css.ts
7517
7566
  init_react_import();
7518
- import { useEffect as useEffect23, useState as useState21 } from "react";
7567
+ import { useEffect as useEffect23, useState as useState20 } from "react";
7519
7568
  var styles = ``;
7520
7569
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
7521
- const [el, setEl] = useState21();
7570
+ const [el, setEl] = useState20();
7522
7571
  useEffect23(() => {
7523
7572
  setEl(document.createElement("style"));
7524
7573
  }, []);
@@ -7560,7 +7609,7 @@ var usePreviewModeHotkeys = () => {
7560
7609
 
7561
7610
  // lib/use-puck.ts
7562
7611
  init_react_import();
7563
- import { createContext as createContext6, useContext as useContext10, useEffect as useEffect24, useState as useState22 } from "react";
7612
+ import { createContext as createContext6, useContext as useContext10, useEffect as useEffect24, useState as useState21 } from "react";
7564
7613
  import { createStore as createStore4, useStore as useStore3 } from "zustand";
7565
7614
  var generateUsePuck = (store) => {
7566
7615
  const history = {
@@ -7589,7 +7638,7 @@ var UsePuckStoreContext = createContext6(
7589
7638
  null
7590
7639
  );
7591
7640
  var useRegisterUsePuckStore = (appStore) => {
7592
- const [usePuckStore] = useState22(
7641
+ const [usePuckStore] = useState21(
7593
7642
  () => createStore4(() => generateUsePuck(appStore.getState()))
7594
7643
  );
7595
7644
  useEffect24(() => {
@@ -7671,7 +7720,7 @@ function PuckProvider({ children }) {
7671
7720
  enabled: true,
7672
7721
  waitForStyles: true
7673
7722
  }, _iframe);
7674
- const [generatedAppState] = useState23(() => {
7723
+ const [generatedAppState] = useState22(() => {
7675
7724
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7676
7725
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
7677
7726
  let clientUiState = {};
@@ -7764,7 +7813,7 @@ function PuckProvider({ children }) {
7764
7813
  onAction,
7765
7814
  metadata
7766
7815
  ]);
7767
- const [appStore] = useState23(() => createAppStore(generateAppStore()));
7816
+ const [appStore] = useState22(() => createAppStore(generateAppStore()));
7768
7817
  useEffect25(() => {
7769
7818
  appStore.setState(__spreadValues({}, generateAppStore()));
7770
7819
  }, [
@@ -7794,7 +7843,7 @@ function PuckProvider({ children }) {
7794
7843
  const { state, resolveData: resolveData2 } = appStore.getState();
7795
7844
  resolveData2(state);
7796
7845
  }, []);
7797
- return /* @__PURE__ */ jsx38(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx38(UsePuckStoreContext, { value: uPuckStore, children }) });
7846
+ return /* @__PURE__ */ jsx38(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx38(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
7798
7847
  }
7799
7848
  function PuckLayout({ children }) {
7800
7849
  const {
@@ -7817,7 +7866,7 @@ function PuckLayout({ children }) {
7817
7866
  const rightSideBarVisible = useAppStore(
7818
7867
  (s) => s.state.ui.rightSideBarVisible
7819
7868
  );
7820
- const [menuOpen, setMenuOpen] = useState23(false);
7869
+ const [menuOpen, setMenuOpen] = useState22(false);
7821
7870
  const appStore = useAppStoreApi();
7822
7871
  useEffect25(() => {
7823
7872
  return appStore.subscribe((s) => {
@@ -7907,7 +7956,7 @@ function PuckLayout({ children }) {
7907
7956
  () => overrides.headerActions || defaultHeaderActionsRender,
7908
7957
  [overrides]
7909
7958
  );
7910
- const [mounted, setMounted] = useState23(false);
7959
+ const [mounted, setMounted] = useState22(false);
7911
7960
  useEffect25(() => {
7912
7961
  setMounted(true);
7913
7962
  }, []);
@@ -8072,40 +8121,6 @@ var migrations = [
8072
8121
  function migrate(data) {
8073
8122
  return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
8074
8123
  }
8075
-
8076
- // lib/transform-props.ts
8077
- init_react_import();
8078
- function transformProps(data, propTransforms) {
8079
- const mapItem = (item) => {
8080
- if (propTransforms[item.type]) {
8081
- return __spreadProps(__spreadValues({}, item), {
8082
- props: propTransforms[item.type](item.props)
8083
- });
8084
- }
8085
- return item;
8086
- };
8087
- const defaultedData = defaultData(data);
8088
- const rootProps = defaultedData.root.props || defaultedData.root;
8089
- let newRoot = __spreadValues({}, defaultedData.root);
8090
- if (propTransforms["root"]) {
8091
- if (defaultedData.root.props) {
8092
- newRoot.props = propTransforms["root"](rootProps);
8093
- } else {
8094
- newRoot = propTransforms["root"](rootProps);
8095
- }
8096
- }
8097
- const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
8098
- root: newRoot,
8099
- content: defaultedData.content.map(mapItem),
8100
- zones: Object.keys(data.zones || {}).reduce(
8101
- (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
8102
- [zoneKey]: data.zones[zoneKey].map(mapItem)
8103
- }),
8104
- {}
8105
- )
8106
- });
8107
- return afterPropTransforms;
8108
- }
8109
8124
  export {
8110
8125
  Action,
8111
8126
  ActionBar,