@measured/puck 0.19.0-canary.53b0813 → 0.19.0-canary.56f23e8

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
@@ -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 useState4 } from "react";
680
680
 
681
681
  // components/DragIcon/index.tsx
682
682
  init_react_import();
@@ -1917,7 +1917,8 @@ function useDraggableSafe(input) {
1917
1917
  function useSortableSafe(input) {
1918
1918
  if (typeof window === "undefined") {
1919
1919
  return { ref: () => {
1920
- }, status: "idle" };
1920
+ }, status: "idle", handleRef: () => {
1921
+ } };
1921
1922
  }
1922
1923
  return useSortable(input);
1923
1924
  }
@@ -2201,23 +2202,26 @@ function patchWindow(window2) {
2201
2202
 
2202
2203
  // lib/dnd/use-sensors.ts
2203
2204
  import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
2204
- var useSensors = () => {
2205
+ var useSensors = ({
2206
+ other,
2207
+ mouse,
2208
+ touch
2209
+ } = {
2210
+ touch: { delay: { value: 200, tolerance: 10 } },
2211
+ other: { delay: { value: 200, tolerance: 10 }, distance: { value: 5 } }
2212
+ }) => {
2205
2213
  const [sensors] = useState2(() => [
2206
2214
  PointerSensor.configure({
2207
2215
  activationConstraints(event, source) {
2208
2216
  var _a;
2209
2217
  const { pointerType, target } = event;
2210
2218
  if (pointerType === "mouse" && isElement2(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
2211
- return void 0;
2219
+ return mouse;
2212
2220
  }
2213
- const delay = { value: 200, tolerance: 10 };
2214
2221
  if (pointerType === "touch") {
2215
- return { delay };
2222
+ return touch;
2216
2223
  }
2217
- return {
2218
- delay,
2219
- distance: { value: 5 }
2220
- };
2224
+ return other;
2221
2225
  }
2222
2226
  })
2223
2227
  ]);
@@ -2566,13 +2570,16 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2566
2570
  import { RestrictToElement } from "@dnd-kit/dom/modifiers";
2567
2571
  import { jsx as jsx5 } from "react/jsx-runtime";
2568
2572
  var SortableProvider = ({
2573
+ container,
2569
2574
  children,
2570
2575
  onDragStart,
2571
2576
  onDragEnd,
2572
2577
  onMove
2573
2578
  }) => {
2574
2579
  const [move, setMove] = useState3({ source: -1, target: -1 });
2575
- const sensors = useSensors();
2580
+ const sensors = useSensors({
2581
+ mouse: { distance: { value: 5 } }
2582
+ });
2576
2583
  return /* @__PURE__ */ jsx5(
2577
2584
  DragDropProvider,
2578
2585
  {
@@ -2580,7 +2587,7 @@ var SortableProvider = ({
2580
2587
  modifiers: [
2581
2588
  RestrictToElement.configure({
2582
2589
  element() {
2583
- return document.querySelector("[data-dnd-container]");
2590
+ return container.current;
2584
2591
  }
2585
2592
  })
2586
2593
  ],
@@ -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))
@@ -2757,6 +2769,7 @@ var ArrayField = ({
2757
2769
  }
2758
2770
  }, []);
2759
2771
  const [isDragging, setIsDragging] = useState4(false);
2772
+ const dndContainerRef = useRef(null);
2760
2773
  const canEdit = useAppStore(
2761
2774
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
2762
2775
  );
@@ -2769,12 +2782,13 @@ var ArrayField = ({
2769
2782
  Label2,
2770
2783
  {
2771
2784
  label: label || name,
2772
- icon: /* @__PURE__ */ jsx7(List, { size: 16 }),
2785
+ icon: labelIcon || /* @__PURE__ */ jsx7(List, { size: 16 }),
2773
2786
  el: "div",
2774
2787
  readOnly,
2775
2788
  children: /* @__PURE__ */ jsx7(
2776
2789
  SortableProvider,
2777
2790
  {
2791
+ container: dndContainerRef,
2778
2792
  onDragStart: () => setIsDragging(true),
2779
2793
  onDragEnd: () => setIsDragging(false),
2780
2794
  onMove: (move) => {
@@ -2805,113 +2819,113 @@ var ArrayField = ({
2805
2819
  addDisabled
2806
2820
  }),
2807
2821
  children: [
2808
- /* @__PURE__ */ jsx7("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
2809
- const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
2810
- const data = Array.from(localState.value || [])[i] || {};
2811
- return /* @__PURE__ */ jsx7(
2812
- Sortable,
2813
- {
2814
- id: _arrayId,
2815
- index: i,
2816
- disabled: readOnly,
2817
- children: ({ status, ref }) => /* @__PURE__ */ jsxs3(
2818
- "div",
2822
+ localState.arrayState.items.length > 0 && /* @__PURE__ */ jsx7(
2823
+ "div",
2824
+ {
2825
+ ref: dndContainerRef,
2826
+ className: getClassName5("inner"),
2827
+ "data-dnd-container": true,
2828
+ children: localState.arrayState.items.map((item, i) => {
2829
+ const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
2830
+ const data = Array.from(localState.value || [])[i] || {};
2831
+ return /* @__PURE__ */ jsx7(
2832
+ Sortable,
2819
2833
  {
2820
- ref,
2821
- className: getClassNameItem({
2822
- isExpanded: arrayState.openId === _arrayId,
2823
- isDragging: status === "dragging",
2824
- readOnly
2825
- }),
2826
- children: [
2827
- /* @__PURE__ */ jsxs3(
2828
- "div",
2829
- {
2830
- onClick: (e) => {
2831
- if (isDragging) return;
2832
- e.preventDefault();
2833
- e.stopPropagation();
2834
- if (arrayState.openId === _arrayId) {
2835
- setUi(
2836
- mapArrayStateToUi({
2837
- openId: ""
2838
- })
2839
- );
2840
- } else {
2841
- setUi(
2842
- mapArrayStateToUi({
2843
- openId: _arrayId
2844
- })
2845
- );
2834
+ id: _arrayId,
2835
+ index: i,
2836
+ disabled: readOnly,
2837
+ children: ({ status, ref, handleRef }) => /* @__PURE__ */ jsxs3(
2838
+ "div",
2839
+ {
2840
+ ref,
2841
+ className: getClassNameItem({
2842
+ isExpanded: arrayState.openId === _arrayId,
2843
+ isDragging: status === "dragging",
2844
+ readOnly
2845
+ }),
2846
+ children: [
2847
+ /* @__PURE__ */ jsxs3(
2848
+ "div",
2849
+ {
2850
+ ref: handleRef,
2851
+ onClick: (e) => {
2852
+ if (isDragging) return;
2853
+ e.preventDefault();
2854
+ e.stopPropagation();
2855
+ if (arrayState.openId === _arrayId) {
2856
+ setUi(
2857
+ mapArrayStateToUi({
2858
+ openId: ""
2859
+ })
2860
+ );
2861
+ } else {
2862
+ setUi(
2863
+ mapArrayStateToUi({
2864
+ openId: _arrayId
2865
+ })
2866
+ );
2867
+ }
2868
+ },
2869
+ className: getClassNameItem("summary"),
2870
+ children: [
2871
+ field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
2872
+ /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
2873
+ !readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
2874
+ /* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
2875
+ IconButton,
2876
+ {
2877
+ type: "button",
2878
+ disabled: !!addDisabled,
2879
+ onClick: (e) => {
2880
+ e.stopPropagation();
2881
+ const existingValue = [...value || []];
2882
+ existingValue.splice(
2883
+ i,
2884
+ 0,
2885
+ existingValue[i]
2886
+ );
2887
+ onChange(
2888
+ existingValue,
2889
+ mapArrayStateToUi(
2890
+ regenerateArrayState(existingValue)
2891
+ )
2892
+ );
2893
+ },
2894
+ title: "Duplicate",
2895
+ children: /* @__PURE__ */ jsx7(Copy, { size: 16 })
2896
+ }
2897
+ ) }),
2898
+ /* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
2899
+ IconButton,
2900
+ {
2901
+ type: "button",
2902
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
2903
+ onClick: (e) => {
2904
+ e.stopPropagation();
2905
+ const existingValue = [...value || []];
2906
+ const existingItems = [
2907
+ ...arrayState.items || []
2908
+ ];
2909
+ existingValue.splice(i, 1);
2910
+ existingItems.splice(i, 1);
2911
+ onChange(
2912
+ existingValue,
2913
+ mapArrayStateToUi({
2914
+ items: existingItems
2915
+ })
2916
+ );
2917
+ },
2918
+ title: "Delete",
2919
+ children: /* @__PURE__ */ jsx7(Trash, { size: 16 })
2920
+ }
2921
+ ) })
2922
+ ] }),
2923
+ /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(DragIcon, {}) })
2924
+ ] })
2925
+ ]
2846
2926
  }
2847
- },
2848
- className: getClassNameItem("summary"),
2849
- children: [
2850
- field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
2851
- /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
2852
- !readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
2853
- /* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
2854
- IconButton,
2855
- {
2856
- type: "button",
2857
- disabled: !!addDisabled,
2858
- onClick: (e) => {
2859
- e.stopPropagation();
2860
- const existingValue = [...value || []];
2861
- existingValue.splice(
2862
- i,
2863
- 0,
2864
- existingValue[i]
2865
- );
2866
- onChange(
2867
- existingValue,
2868
- mapArrayStateToUi(
2869
- regenerateArrayState(existingValue)
2870
- )
2871
- );
2872
- },
2873
- title: "Duplicate",
2874
- children: /* @__PURE__ */ jsx7(Copy, { size: 16 })
2875
- }
2876
- ) }),
2877
- /* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
2878
- IconButton,
2879
- {
2880
- type: "button",
2881
- disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
2882
- onClick: (e) => {
2883
- e.stopPropagation();
2884
- const existingValue = [...value || []];
2885
- const existingItems = [
2886
- ...arrayState.items || []
2887
- ];
2888
- existingValue.splice(i, 1);
2889
- existingItems.splice(i, 1);
2890
- onChange(
2891
- existingValue,
2892
- mapArrayStateToUi({
2893
- items: existingItems
2894
- })
2895
- );
2896
- },
2897
- title: "Delete",
2898
- children: /* @__PURE__ */ jsx7(Trash, { size: 16 })
2899
- }
2900
- ) })
2901
- ] }),
2902
- /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(DragIcon, {}) })
2903
- ] })
2904
- ]
2905
- }
2906
- ),
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) => {
2927
+ ),
2928
+ /* @__PURE__ */ jsx7("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx7("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
2915
2929
  const subField = field.arrayFields[subName];
2916
2930
  const indexName = `${name}[${i}]`;
2917
2931
  const subPath = `${indexName}.${subName}`;
@@ -2953,16 +2967,16 @@ var ArrayField = ({
2953
2967
  },
2954
2968
  subPath
2955
2969
  );
2956
- })
2957
- }
2958
- ) })
2959
- ]
2960
- }
2961
- )
2962
- },
2963
- _arrayId
2964
- );
2965
- }) }),
2970
+ }) }) })
2971
+ ]
2972
+ }
2973
+ )
2974
+ },
2975
+ _arrayId
2976
+ );
2977
+ })
2978
+ }
2979
+ ),
2966
2980
  !addDisabled && /* @__PURE__ */ jsx7(
2967
2981
  "button",
2968
2982
  {
@@ -3001,6 +3015,7 @@ var DefaultField = ({
3001
3015
  value: _value,
3002
3016
  name,
3003
3017
  label,
3018
+ labelIcon,
3004
3019
  Label: Label2,
3005
3020
  id
3006
3021
  }) => {
@@ -3009,7 +3024,7 @@ var DefaultField = ({
3009
3024
  Label2,
3010
3025
  {
3011
3026
  label: label || name,
3012
- icon: /* @__PURE__ */ jsxs4(Fragment2, { children: [
3027
+ icon: labelIcon || /* @__PURE__ */ jsxs4(Fragment2, { children: [
3013
3028
  field.type === "text" && /* @__PURE__ */ jsx8(Type, { size: 16 }),
3014
3029
  field.type === "number" && /* @__PURE__ */ jsx8(Hash, { size: 16 })
3015
3030
  ] }),
@@ -3445,6 +3460,7 @@ var ExternalField = ({
3445
3460
  value,
3446
3461
  name,
3447
3462
  label,
3463
+ labelIcon,
3448
3464
  Label: Label2,
3449
3465
  id,
3450
3466
  readOnly
@@ -3462,27 +3478,35 @@ var ExternalField = ({
3462
3478
  if (field.type !== "external") {
3463
3479
  return null;
3464
3480
  }
3465
- return /* @__PURE__ */ jsx13(Label2, { label: label || name, icon: /* @__PURE__ */ jsx13(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx13(
3466
- ExternalInput,
3481
+ return /* @__PURE__ */ jsx13(
3482
+ Label2,
3467
3483
  {
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
3484
+ label: label || name,
3485
+ icon: labelIcon || /* @__PURE__ */ jsx13(Link, { size: 16 }),
3486
+ el: "div",
3487
+ children: /* @__PURE__ */ jsx13(
3488
+ ExternalInput,
3489
+ {
3490
+ name,
3491
+ field: __spreadProps(__spreadValues({}, validField), {
3492
+ // DEPRECATED
3493
+ placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
3494
+ mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
3495
+ mapRow: validField.mapRow,
3496
+ fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
3497
+ return yield deprecatedField.adaptor.fetchList(
3498
+ deprecatedField.adaptorParams
3499
+ );
3500
+ }) : validField.fetchList
3501
+ }),
3502
+ onChange,
3503
+ value,
3504
+ id,
3505
+ readOnly
3506
+ }
3507
+ )
3484
3508
  }
3485
- ) });
3509
+ );
3486
3510
  };
3487
3511
 
3488
3512
  // components/AutoField/fields/RadioField/index.tsx
@@ -3511,6 +3535,7 @@ var RadioField = ({
3511
3535
  name,
3512
3536
  id,
3513
3537
  label,
3538
+ labelIcon,
3514
3539
  Label: Label2
3515
3540
  }) => {
3516
3541
  const flatOptions = useMemo3(
@@ -3523,7 +3548,7 @@ var RadioField = ({
3523
3548
  return /* @__PURE__ */ jsx14(
3524
3549
  Label2,
3525
3550
  {
3526
- icon: /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
3551
+ icon: labelIcon || /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
3527
3552
  label: label || name,
3528
3553
  readOnly,
3529
3554
  el: "div",
@@ -3570,6 +3595,7 @@ var SelectField = ({
3570
3595
  field,
3571
3596
  onChange,
3572
3597
  label,
3598
+ labelIcon,
3573
3599
  Label: Label2,
3574
3600
  value,
3575
3601
  name,
@@ -3587,7 +3613,7 @@ var SelectField = ({
3587
3613
  Label2,
3588
3614
  {
3589
3615
  label: label || name,
3590
- icon: /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
3616
+ icon: labelIcon || /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
3591
3617
  readOnly,
3592
3618
  children: /* @__PURE__ */ jsx15(
3593
3619
  "select",
@@ -3631,24 +3657,33 @@ var TextareaField = ({
3631
3657
  value,
3632
3658
  name,
3633
3659
  label,
3660
+ labelIcon,
3634
3661
  Label: Label2,
3635
3662
  id
3636
3663
  }) => {
3637
- return /* @__PURE__ */ jsx16(Label2, { label: label || name, icon: /* @__PURE__ */ jsx16(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx16(
3638
- "textarea",
3664
+ return /* @__PURE__ */ jsx16(
3665
+ Label2,
3639
3666
  {
3640
- id,
3641
- className: getClassName13("input"),
3642
- autoComplete: "off",
3643
- name,
3644
- value: typeof value === "undefined" ? "" : value,
3645
- onChange: (e) => onChange(e.currentTarget.value),
3667
+ label: label || name,
3668
+ icon: labelIcon || /* @__PURE__ */ jsx16(Type, { size: 16 }),
3646
3669
  readOnly,
3647
- tabIndex: readOnly ? -1 : void 0,
3648
- rows: 5,
3649
- placeholder: field.type === "textarea" ? field.placeholder : void 0
3670
+ children: /* @__PURE__ */ jsx16(
3671
+ "textarea",
3672
+ {
3673
+ id,
3674
+ className: getClassName13("input"),
3675
+ autoComplete: "off",
3676
+ name,
3677
+ value: typeof value === "undefined" ? "" : value,
3678
+ onChange: (e) => onChange(e.currentTarget.value),
3679
+ readOnly,
3680
+ tabIndex: readOnly ? -1 : void 0,
3681
+ rows: 5,
3682
+ placeholder: field.type === "textarea" ? field.placeholder : void 0
3683
+ }
3684
+ )
3650
3685
  }
3651
- ) });
3686
+ );
3652
3687
  };
3653
3688
 
3654
3689
  // components/AutoField/fields/ObjectField/index.tsx
@@ -3667,6 +3702,7 @@ var ObjectField = ({
3667
3702
  value,
3668
3703
  name,
3669
3704
  label,
3705
+ labelIcon,
3670
3706
  Label: Label2,
3671
3707
  readOnly,
3672
3708
  id
@@ -3680,7 +3716,7 @@ var ObjectField = ({
3680
3716
  Label2,
3681
3717
  {
3682
3718
  label: label || name,
3683
- icon: /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
3719
+ icon: labelIcon || /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
3684
3720
  el: "div",
3685
3721
  readOnly,
3686
3722
  children: /* @__PURE__ */ jsx17("div", { className: getClassName14(), children: /* @__PURE__ */ jsx17("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
@@ -3797,6 +3833,7 @@ function AutoFieldInternal(props) {
3797
3833
  const { id, Label: Label2 = FieldLabelInternal } = props;
3798
3834
  const field = props.field;
3799
3835
  const label = field.label;
3836
+ const labelIcon = field.labelIcon;
3800
3837
  const defaultId = useSafeId();
3801
3838
  const resolvedId = id || defaultId;
3802
3839
  const defaultFields = {
@@ -3822,6 +3859,7 @@ function AutoFieldInternal(props) {
3822
3859
  const mergedProps = __spreadProps(__spreadValues({}, props), {
3823
3860
  field,
3824
3861
  label,
3862
+ labelIcon,
3825
3863
  Label: Label2,
3826
3864
  id: resolvedId
3827
3865
  });
@@ -3884,10 +3922,13 @@ function AutoFieldPrivate(props) {
3884
3922
  const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
3885
3923
  const { value, onChange } = props;
3886
3924
  const [localValue, setLocalValue] = useState9(value);
3887
- const onChangeLocal = useCallback4((val, ui) => {
3888
- setLocalValue(val);
3889
- onChange(val, ui);
3890
- }, []);
3925
+ const onChangeLocal = useCallback4(
3926
+ (val, ui) => {
3927
+ setLocalValue(val);
3928
+ onChange(val, ui);
3929
+ },
3930
+ [onChange]
3931
+ );
3891
3932
  useEffect11(() => {
3892
3933
  if (!isFocused) {
3893
3934
  setLocalValue(value);
@@ -3920,7 +3961,7 @@ init_react_import();
3920
3961
  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
3962
 
3922
3963
  // components/Drawer/index.tsx
3923
- import { useId as useId2, useMemo as useMemo9, useState as useState16 } from "react";
3964
+ import { useMemo as useMemo9, useState as useState16 } from "react";
3924
3965
 
3925
3966
  // components/DragDropContext/index.tsx
3926
3967
  init_react_import();
@@ -3930,8 +3971,7 @@ import {
3930
3971
  useCallback as useCallback10,
3931
3972
  useContext as useContext7,
3932
3973
  useEffect as useEffect17,
3933
- useId,
3934
- useRef as useRef3,
3974
+ useRef as useRef4,
3935
3975
  useState as useState15
3936
3976
  } from "react";
3937
3977
  import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
@@ -3944,7 +3984,7 @@ import {
3944
3984
  useContext as useContext6,
3945
3985
  useEffect as useEffect16,
3946
3986
  useMemo as useMemo8,
3947
- useRef as useRef2
3987
+ useRef as useRef3
3948
3988
  } from "react";
3949
3989
 
3950
3990
  // components/DraggableComponent/index.tsx
@@ -3954,7 +3994,7 @@ import {
3954
3994
  useContext as useContext5,
3955
3995
  useEffect as useEffect12,
3956
3996
  useMemo as useMemo7,
3957
- useRef,
3997
+ useRef as useRef2,
3958
3998
  useState as useState11
3959
3999
  } from "react";
3960
4000
 
@@ -4191,7 +4231,7 @@ var DraggableComponent = ({
4191
4231
  }
4192
4232
  });
4193
4233
  const thisIsDragging = status === "dragging";
4194
- const ref = useRef(null);
4234
+ const ref = useRef2(null);
4195
4235
  const refSetter = useCallback6(
4196
4236
  (el) => {
4197
4237
  sortableRef(el);
@@ -4375,10 +4415,18 @@ var DraggableComponent = ({
4375
4415
  const rect = el.getBoundingClientRect();
4376
4416
  const diffLeft = rect.x;
4377
4417
  const exceedsBoundsLeft = diffLeft < 0;
4418
+ const diffTop = rect.y;
4419
+ const exceedsBoundsTop = diffTop < 0;
4378
4420
  if (exceedsBoundsLeft) {
4379
4421
  el.style.transformOrigin = "left top";
4380
4422
  el.style.left = "0px";
4381
4423
  }
4424
+ if (exceedsBoundsTop) {
4425
+ el.style.top = "12px";
4426
+ if (!exceedsBoundsLeft) {
4427
+ el.style.transformOrigin = "right top";
4428
+ }
4429
+ }
4382
4430
  }
4383
4431
  }
4384
4432
  },
@@ -4868,7 +4916,7 @@ var DropZoneEdit = forwardRef3(
4868
4916
  return content.map(({ props }) => props.id);
4869
4917
  })
4870
4918
  );
4871
- const ref = useRef2(null);
4919
+ const ref = useRef3(null);
4872
4920
  const acceptsTarget = useCallback9(
4873
4921
  (componentType) => {
4874
4922
  if (!componentType) {
@@ -5370,7 +5418,7 @@ function useDragListener(type, fn, deps = []) {
5370
5418
  }
5371
5419
  var AREA_CHANGE_DEBOUNCE_MS = 100;
5372
5420
  var useTempDisableFallback = (timeout3) => {
5373
- const lastFallbackDisable = useRef3(null);
5421
+ const lastFallbackDisable = useRef4(null);
5374
5422
  return useCallback10((manager) => {
5375
5423
  collisionStore.setState({ fallbackEnabled: false });
5376
5424
  const fallbackId = generateId();
@@ -5392,8 +5440,8 @@ var DragDropContextClient = ({
5392
5440
  const resolveData2 = useAppStore((s) => s.resolveData);
5393
5441
  const metadata = useAppStore((s) => s.metadata);
5394
5442
  const appStore = useAppStoreApi();
5395
- const id = useId();
5396
- const debouncedParamsRef = useRef3(null);
5443
+ const id = useSafeId();
5444
+ const debouncedParamsRef = useRef4(null);
5397
5445
  const tempDisableFallback = useTempDisableFallback(100);
5398
5446
  const [zoneStore] = useState15(
5399
5447
  () => createStore3(() => ({
@@ -5513,8 +5561,8 @@ var DragDropContextClient = ({
5513
5561
  ]);
5514
5562
  const sensors = useSensors();
5515
5563
  const [dragListeners, setDragListeners] = useState15({});
5516
- const dragMode = useRef3(null);
5517
- const initialSelector = useRef3(void 0);
5564
+ const dragMode = useRef4(null);
5565
+ const initialSelector = useRef4(void 0);
5518
5566
  return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
5519
5567
  dragListenerContext.Provider,
5520
5568
  {
@@ -5846,7 +5894,7 @@ var Drawer = ({
5846
5894
  "Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
5847
5895
  );
5848
5896
  }
5849
- const id = useId2();
5897
+ const id = useSafeId();
5850
5898
  const { ref } = useDroppableSafe({
5851
5899
  id,
5852
5900
  type: "void",
@@ -6328,7 +6376,7 @@ var Components = () => {
6328
6376
 
6329
6377
  // components/Puck/components/Preview/index.tsx
6330
6378
  init_react_import();
6331
- import { useCallback as useCallback12, useEffect as useEffect20, useRef as useRef4, useMemo as useMemo13 } from "react";
6379
+ import { useCallback as useCallback12, useEffect as useEffect20, useRef as useRef5, useMemo as useMemo13 } from "react";
6332
6380
 
6333
6381
  // components/AutoFrame/index.tsx
6334
6382
  init_react_import();
@@ -6680,7 +6728,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
6680
6728
  );
6681
6729
  const Frame = useMemo13(() => overrides.iframe, [overrides]);
6682
6730
  const rootProps = root.props || root;
6683
- const ref = useRef4(null);
6731
+ const ref = useRef5(null);
6684
6732
  useBubbleIframeEvents(ref);
6685
6733
  const inner = !renderData ? /* @__PURE__ */ jsx32(
6686
6734
  Page,
@@ -7112,7 +7160,7 @@ import {
7112
7160
  useCallback as useCallback14,
7113
7161
  useEffect as useEffect22,
7114
7162
  useMemo as useMemo16,
7115
- useRef as useRef5,
7163
+ useRef as useRef6,
7116
7164
  useState as useState20
7117
7165
  } from "react";
7118
7166
 
@@ -7325,7 +7373,7 @@ var Canvas = () => {
7325
7373
  viewports: s.state.ui.viewports
7326
7374
  }))
7327
7375
  );
7328
- const frameRef = useRef5(null);
7376
+ const frameRef = useRef6(null);
7329
7377
  const [showTransition, setShowTransition] = useState20(false);
7330
7378
  const defaultRender = useMemo16(() => {
7331
7379
  const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment13, { children });