@measured/puck 0.19.0-canary.85ee736 → 0.19.0-canary.af4f756
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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +211 -173
- package/dist/index.mjs +226 -189
- package/dist/{resolve-all-data-wwgDuTnC.d.mts → resolve-all-data-DleIzc4N.d.mts} +1 -0
- package/dist/{resolve-all-data-wwgDuTnC.d.ts → resolve-all-data-DleIzc4N.d.ts} +1 -0
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/package.json +4 -3
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
|
2219
|
+
return mouse;
|
2212
2220
|
}
|
2213
|
-
const delay = { value: 200, tolerance: 10 };
|
2214
2221
|
if (pointerType === "touch") {
|
2215
|
-
return
|
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
|
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 {
|
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) => {
|
@@ -2804,117 +2818,114 @@ var ArrayField = ({
|
|
2804
2818
|
hasItems: Array.isArray(value) && value.length > 0,
|
2805
2819
|
addDisabled
|
2806
2820
|
}),
|
2807
|
-
onClick: (e) => {
|
2808
|
-
e.preventDefault();
|
2809
|
-
},
|
2810
2821
|
children: [
|
2811
|
-
/* @__PURE__ */ jsx7(
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
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,
|
2822
2833
|
{
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
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
|
+
]
|
2849
2926
|
}
|
2850
|
-
|
2851
|
-
className: getClassNameItem("
|
2852
|
-
children: [
|
2853
|
-
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
2854
|
-
/* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
|
2855
|
-
!readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
|
2856
|
-
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
|
2857
|
-
IconButton,
|
2858
|
-
{
|
2859
|
-
type: "button",
|
2860
|
-
disabled: !!addDisabled,
|
2861
|
-
onClick: (e) => {
|
2862
|
-
e.stopPropagation();
|
2863
|
-
const existingValue = [...value || []];
|
2864
|
-
existingValue.splice(
|
2865
|
-
i,
|
2866
|
-
0,
|
2867
|
-
existingValue[i]
|
2868
|
-
);
|
2869
|
-
onChange(
|
2870
|
-
existingValue,
|
2871
|
-
mapArrayStateToUi(
|
2872
|
-
regenerateArrayState(existingValue)
|
2873
|
-
)
|
2874
|
-
);
|
2875
|
-
},
|
2876
|
-
title: "Duplicate",
|
2877
|
-
children: /* @__PURE__ */ jsx7(Copy, { size: 16 })
|
2878
|
-
}
|
2879
|
-
) }),
|
2880
|
-
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
|
2881
|
-
IconButton,
|
2882
|
-
{
|
2883
|
-
type: "button",
|
2884
|
-
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
2885
|
-
onClick: (e) => {
|
2886
|
-
e.stopPropagation();
|
2887
|
-
const existingValue = [...value || []];
|
2888
|
-
const existingItems = [
|
2889
|
-
...arrayState.items || []
|
2890
|
-
];
|
2891
|
-
existingValue.splice(i, 1);
|
2892
|
-
existingItems.splice(i, 1);
|
2893
|
-
onChange(
|
2894
|
-
existingValue,
|
2895
|
-
mapArrayStateToUi({
|
2896
|
-
items: existingItems
|
2897
|
-
})
|
2898
|
-
);
|
2899
|
-
},
|
2900
|
-
title: "Delete",
|
2901
|
-
children: /* @__PURE__ */ jsx7(Trash, { size: 16 })
|
2902
|
-
}
|
2903
|
-
) })
|
2904
|
-
] }),
|
2905
|
-
/* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(DragIcon, {}) })
|
2906
|
-
] })
|
2907
|
-
]
|
2908
|
-
}
|
2909
|
-
),
|
2910
|
-
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx7(
|
2911
|
-
"fieldset",
|
2912
|
-
{
|
2913
|
-
className: getClassNameItem("fieldset"),
|
2914
|
-
onPointerDownCapture: (e) => {
|
2915
|
-
e.stopPropagation();
|
2916
|
-
},
|
2917
|
-
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) => {
|
2918
2929
|
const subField = field.arrayFields[subName];
|
2919
2930
|
const indexName = `${name}[${i}]`;
|
2920
2931
|
const subPath = `${indexName}.${subName}`;
|
@@ -2956,16 +2967,16 @@ var ArrayField = ({
|
|
2956
2967
|
},
|
2957
2968
|
subPath
|
2958
2969
|
);
|
2959
|
-
})
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
2963
|
-
}
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2970
|
+
}) }) })
|
2971
|
+
]
|
2972
|
+
}
|
2973
|
+
)
|
2974
|
+
},
|
2975
|
+
_arrayId
|
2976
|
+
);
|
2977
|
+
})
|
2978
|
+
}
|
2979
|
+
),
|
2969
2980
|
!addDisabled && /* @__PURE__ */ jsx7(
|
2970
2981
|
"button",
|
2971
2982
|
{
|
@@ -3004,6 +3015,7 @@ var DefaultField = ({
|
|
3004
3015
|
value: _value,
|
3005
3016
|
name,
|
3006
3017
|
label,
|
3018
|
+
labelIcon,
|
3007
3019
|
Label: Label2,
|
3008
3020
|
id
|
3009
3021
|
}) => {
|
@@ -3012,7 +3024,7 @@ var DefaultField = ({
|
|
3012
3024
|
Label2,
|
3013
3025
|
{
|
3014
3026
|
label: label || name,
|
3015
|
-
icon: /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
3027
|
+
icon: labelIcon || /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
3016
3028
|
field.type === "text" && /* @__PURE__ */ jsx8(Type, { size: 16 }),
|
3017
3029
|
field.type === "number" && /* @__PURE__ */ jsx8(Hash, { size: 16 })
|
3018
3030
|
] }),
|
@@ -3448,6 +3460,7 @@ var ExternalField = ({
|
|
3448
3460
|
value,
|
3449
3461
|
name,
|
3450
3462
|
label,
|
3463
|
+
labelIcon,
|
3451
3464
|
Label: Label2,
|
3452
3465
|
id,
|
3453
3466
|
readOnly
|
@@ -3465,27 +3478,35 @@ var ExternalField = ({
|
|
3465
3478
|
if (field.type !== "external") {
|
3466
3479
|
return null;
|
3467
3480
|
}
|
3468
|
-
return /* @__PURE__ */ jsx13(
|
3469
|
-
|
3481
|
+
return /* @__PURE__ */ jsx13(
|
3482
|
+
Label2,
|
3470
3483
|
{
|
3471
|
-
name,
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3475
|
-
|
3476
|
-
|
3477
|
-
|
3478
|
-
|
3479
|
-
|
3480
|
-
|
3481
|
-
|
3482
|
-
|
3483
|
-
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
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
|
+
)
|
3487
3508
|
}
|
3488
|
-
)
|
3509
|
+
);
|
3489
3510
|
};
|
3490
3511
|
|
3491
3512
|
// components/AutoField/fields/RadioField/index.tsx
|
@@ -3514,6 +3535,7 @@ var RadioField = ({
|
|
3514
3535
|
name,
|
3515
3536
|
id,
|
3516
3537
|
label,
|
3538
|
+
labelIcon,
|
3517
3539
|
Label: Label2
|
3518
3540
|
}) => {
|
3519
3541
|
const flatOptions = useMemo3(
|
@@ -3526,7 +3548,7 @@ var RadioField = ({
|
|
3526
3548
|
return /* @__PURE__ */ jsx14(
|
3527
3549
|
Label2,
|
3528
3550
|
{
|
3529
|
-
icon: /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
|
3551
|
+
icon: labelIcon || /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
|
3530
3552
|
label: label || name,
|
3531
3553
|
readOnly,
|
3532
3554
|
el: "div",
|
@@ -3573,6 +3595,7 @@ var SelectField = ({
|
|
3573
3595
|
field,
|
3574
3596
|
onChange,
|
3575
3597
|
label,
|
3598
|
+
labelIcon,
|
3576
3599
|
Label: Label2,
|
3577
3600
|
value,
|
3578
3601
|
name,
|
@@ -3590,7 +3613,7 @@ var SelectField = ({
|
|
3590
3613
|
Label2,
|
3591
3614
|
{
|
3592
3615
|
label: label || name,
|
3593
|
-
icon: /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
|
3616
|
+
icon: labelIcon || /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
|
3594
3617
|
readOnly,
|
3595
3618
|
children: /* @__PURE__ */ jsx15(
|
3596
3619
|
"select",
|
@@ -3634,24 +3657,33 @@ var TextareaField = ({
|
|
3634
3657
|
value,
|
3635
3658
|
name,
|
3636
3659
|
label,
|
3660
|
+
labelIcon,
|
3637
3661
|
Label: Label2,
|
3638
3662
|
id
|
3639
3663
|
}) => {
|
3640
|
-
return /* @__PURE__ */ jsx16(
|
3641
|
-
|
3664
|
+
return /* @__PURE__ */ jsx16(
|
3665
|
+
Label2,
|
3642
3666
|
{
|
3643
|
-
|
3644
|
-
|
3645
|
-
autoComplete: "off",
|
3646
|
-
name,
|
3647
|
-
value: typeof value === "undefined" ? "" : value,
|
3648
|
-
onChange: (e) => onChange(e.currentTarget.value),
|
3667
|
+
label: label || name,
|
3668
|
+
icon: labelIcon || /* @__PURE__ */ jsx16(Type, { size: 16 }),
|
3649
3669
|
readOnly,
|
3650
|
-
|
3651
|
-
|
3652
|
-
|
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
|
+
)
|
3653
3685
|
}
|
3654
|
-
)
|
3686
|
+
);
|
3655
3687
|
};
|
3656
3688
|
|
3657
3689
|
// components/AutoField/fields/ObjectField/index.tsx
|
@@ -3670,6 +3702,7 @@ var ObjectField = ({
|
|
3670
3702
|
value,
|
3671
3703
|
name,
|
3672
3704
|
label,
|
3705
|
+
labelIcon,
|
3673
3706
|
Label: Label2,
|
3674
3707
|
readOnly,
|
3675
3708
|
id
|
@@ -3683,7 +3716,7 @@ var ObjectField = ({
|
|
3683
3716
|
Label2,
|
3684
3717
|
{
|
3685
3718
|
label: label || name,
|
3686
|
-
icon: /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
|
3719
|
+
icon: labelIcon || /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
|
3687
3720
|
el: "div",
|
3688
3721
|
readOnly,
|
3689
3722
|
children: /* @__PURE__ */ jsx17("div", { className: getClassName14(), children: /* @__PURE__ */ jsx17("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
@@ -3800,6 +3833,7 @@ function AutoFieldInternal(props) {
|
|
3800
3833
|
const { id, Label: Label2 = FieldLabelInternal } = props;
|
3801
3834
|
const field = props.field;
|
3802
3835
|
const label = field.label;
|
3836
|
+
const labelIcon = field.labelIcon;
|
3803
3837
|
const defaultId = useSafeId();
|
3804
3838
|
const resolvedId = id || defaultId;
|
3805
3839
|
const defaultFields = {
|
@@ -3825,6 +3859,7 @@ function AutoFieldInternal(props) {
|
|
3825
3859
|
const mergedProps = __spreadProps(__spreadValues({}, props), {
|
3826
3860
|
field,
|
3827
3861
|
label,
|
3862
|
+
labelIcon,
|
3828
3863
|
Label: Label2,
|
3829
3864
|
id: resolvedId
|
3830
3865
|
});
|
@@ -3887,10 +3922,13 @@ function AutoFieldPrivate(props) {
|
|
3887
3922
|
const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
|
3888
3923
|
const { value, onChange } = props;
|
3889
3924
|
const [localValue, setLocalValue] = useState9(value);
|
3890
|
-
const onChangeLocal = useCallback4(
|
3891
|
-
|
3892
|
-
|
3893
|
-
|
3925
|
+
const onChangeLocal = useCallback4(
|
3926
|
+
(val, ui) => {
|
3927
|
+
setLocalValue(val);
|
3928
|
+
onChange(val, ui);
|
3929
|
+
},
|
3930
|
+
[onChange]
|
3931
|
+
);
|
3894
3932
|
useEffect11(() => {
|
3895
3933
|
if (!isFocused) {
|
3896
3934
|
setLocalValue(value);
|
@@ -3923,7 +3961,7 @@ init_react_import();
|
|
3923
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" };
|
3924
3962
|
|
3925
3963
|
// components/Drawer/index.tsx
|
3926
|
-
import {
|
3964
|
+
import { useMemo as useMemo9, useState as useState16 } from "react";
|
3927
3965
|
|
3928
3966
|
// components/DragDropContext/index.tsx
|
3929
3967
|
init_react_import();
|
@@ -3933,8 +3971,7 @@ import {
|
|
3933
3971
|
useCallback as useCallback10,
|
3934
3972
|
useContext as useContext7,
|
3935
3973
|
useEffect as useEffect17,
|
3936
|
-
|
3937
|
-
useRef as useRef3,
|
3974
|
+
useRef as useRef4,
|
3938
3975
|
useState as useState15
|
3939
3976
|
} from "react";
|
3940
3977
|
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
@@ -3947,7 +3984,7 @@ import {
|
|
3947
3984
|
useContext as useContext6,
|
3948
3985
|
useEffect as useEffect16,
|
3949
3986
|
useMemo as useMemo8,
|
3950
|
-
useRef as
|
3987
|
+
useRef as useRef3
|
3951
3988
|
} from "react";
|
3952
3989
|
|
3953
3990
|
// components/DraggableComponent/index.tsx
|
@@ -3957,7 +3994,7 @@ import {
|
|
3957
3994
|
useContext as useContext5,
|
3958
3995
|
useEffect as useEffect12,
|
3959
3996
|
useMemo as useMemo7,
|
3960
|
-
useRef,
|
3997
|
+
useRef as useRef2,
|
3961
3998
|
useState as useState11
|
3962
3999
|
} from "react";
|
3963
4000
|
|
@@ -4194,7 +4231,7 @@ var DraggableComponent = ({
|
|
4194
4231
|
}
|
4195
4232
|
});
|
4196
4233
|
const thisIsDragging = status === "dragging";
|
4197
|
-
const ref =
|
4234
|
+
const ref = useRef2(null);
|
4198
4235
|
const refSetter = useCallback6(
|
4199
4236
|
(el) => {
|
4200
4237
|
sortableRef(el);
|
@@ -4871,7 +4908,7 @@ var DropZoneEdit = forwardRef3(
|
|
4871
4908
|
return content.map(({ props }) => props.id);
|
4872
4909
|
})
|
4873
4910
|
);
|
4874
|
-
const ref =
|
4911
|
+
const ref = useRef3(null);
|
4875
4912
|
const acceptsTarget = useCallback9(
|
4876
4913
|
(componentType) => {
|
4877
4914
|
if (!componentType) {
|
@@ -5373,7 +5410,7 @@ function useDragListener(type, fn, deps = []) {
|
|
5373
5410
|
}
|
5374
5411
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
5375
5412
|
var useTempDisableFallback = (timeout3) => {
|
5376
|
-
const lastFallbackDisable =
|
5413
|
+
const lastFallbackDisable = useRef4(null);
|
5377
5414
|
return useCallback10((manager) => {
|
5378
5415
|
collisionStore.setState({ fallbackEnabled: false });
|
5379
5416
|
const fallbackId = generateId();
|
@@ -5395,8 +5432,8 @@ var DragDropContextClient = ({
|
|
5395
5432
|
const resolveData2 = useAppStore((s) => s.resolveData);
|
5396
5433
|
const metadata = useAppStore((s) => s.metadata);
|
5397
5434
|
const appStore = useAppStoreApi();
|
5398
|
-
const id =
|
5399
|
-
const debouncedParamsRef =
|
5435
|
+
const id = useSafeId();
|
5436
|
+
const debouncedParamsRef = useRef4(null);
|
5400
5437
|
const tempDisableFallback = useTempDisableFallback(100);
|
5401
5438
|
const [zoneStore] = useState15(
|
5402
5439
|
() => createStore3(() => ({
|
@@ -5516,8 +5553,8 @@ var DragDropContextClient = ({
|
|
5516
5553
|
]);
|
5517
5554
|
const sensors = useSensors();
|
5518
5555
|
const [dragListeners, setDragListeners] = useState15({});
|
5519
|
-
const dragMode =
|
5520
|
-
const initialSelector =
|
5556
|
+
const dragMode = useRef4(null);
|
5557
|
+
const initialSelector = useRef4(void 0);
|
5521
5558
|
return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
|
5522
5559
|
dragListenerContext.Provider,
|
5523
5560
|
{
|
@@ -5849,7 +5886,7 @@ var Drawer = ({
|
|
5849
5886
|
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
5850
5887
|
);
|
5851
5888
|
}
|
5852
|
-
const id =
|
5889
|
+
const id = useSafeId();
|
5853
5890
|
const { ref } = useDroppableSafe({
|
5854
5891
|
id,
|
5855
5892
|
type: "void",
|
@@ -6331,7 +6368,7 @@ var Components = () => {
|
|
6331
6368
|
|
6332
6369
|
// components/Puck/components/Preview/index.tsx
|
6333
6370
|
init_react_import();
|
6334
|
-
import { useCallback as useCallback12, useEffect as useEffect20, useRef as
|
6371
|
+
import { useCallback as useCallback12, useEffect as useEffect20, useRef as useRef5, useMemo as useMemo13 } from "react";
|
6335
6372
|
|
6336
6373
|
// components/AutoFrame/index.tsx
|
6337
6374
|
init_react_import();
|
@@ -6683,7 +6720,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
6683
6720
|
);
|
6684
6721
|
const Frame = useMemo13(() => overrides.iframe, [overrides]);
|
6685
6722
|
const rootProps = root.props || root;
|
6686
|
-
const ref =
|
6723
|
+
const ref = useRef5(null);
|
6687
6724
|
useBubbleIframeEvents(ref);
|
6688
6725
|
const inner = !renderData ? /* @__PURE__ */ jsx32(
|
6689
6726
|
Page,
|
@@ -7115,7 +7152,7 @@ import {
|
|
7115
7152
|
useCallback as useCallback14,
|
7116
7153
|
useEffect as useEffect22,
|
7117
7154
|
useMemo as useMemo16,
|
7118
|
-
useRef as
|
7155
|
+
useRef as useRef6,
|
7119
7156
|
useState as useState20
|
7120
7157
|
} from "react";
|
7121
7158
|
|
@@ -7328,7 +7365,7 @@ var Canvas = () => {
|
|
7328
7365
|
viewports: s.state.ui.viewports
|
7329
7366
|
}))
|
7330
7367
|
);
|
7331
|
-
const frameRef =
|
7368
|
+
const frameRef = useRef6(null);
|
7332
7369
|
const [showTransition, setShowTransition] = useState20(false);
|
7333
7370
|
const defaultRender = useMemo16(() => {
|
7334
7371
|
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment13, { children });
|