@measured/puck 0.19.0-canary.1fc19b5 → 0.19.0-canary.24030a9
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 +235 -196
- package/dist/index.mjs +249 -210
- 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 +3 -2
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();
|
@@ -2566,6 +2566,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
2566
2566
|
import { RestrictToElement } from "@dnd-kit/dom/modifiers";
|
2567
2567
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
2568
2568
|
var SortableProvider = ({
|
2569
|
+
container,
|
2569
2570
|
children,
|
2570
2571
|
onDragStart,
|
2571
2572
|
onDragEnd,
|
@@ -2580,7 +2581,7 @@ var SortableProvider = ({
|
|
2580
2581
|
modifiers: [
|
2581
2582
|
RestrictToElement.configure({
|
2582
2583
|
element() {
|
2583
|
-
return
|
2584
|
+
return container.current;
|
2584
2585
|
}
|
2585
2586
|
})
|
2586
2587
|
],
|
@@ -2693,6 +2694,7 @@ var ArrayField = ({
|
|
2693
2694
|
value: _value,
|
2694
2695
|
name,
|
2695
2696
|
label,
|
2697
|
+
labelIcon,
|
2696
2698
|
readOnly,
|
2697
2699
|
id,
|
2698
2700
|
Label: Label2 = (props) => /* @__PURE__ */ jsx7("div", __spreadValues({}, props))
|
@@ -2757,6 +2759,7 @@ var ArrayField = ({
|
|
2757
2759
|
}
|
2758
2760
|
}, []);
|
2759
2761
|
const [isDragging, setIsDragging] = useState4(false);
|
2762
|
+
const dndContainerRef = useRef(null);
|
2760
2763
|
const canEdit = useAppStore(
|
2761
2764
|
(s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
|
2762
2765
|
);
|
@@ -2769,12 +2772,13 @@ var ArrayField = ({
|
|
2769
2772
|
Label2,
|
2770
2773
|
{
|
2771
2774
|
label: label || name,
|
2772
|
-
icon: /* @__PURE__ */ jsx7(List, { size: 16 }),
|
2775
|
+
icon: labelIcon || /* @__PURE__ */ jsx7(List, { size: 16 }),
|
2773
2776
|
el: "div",
|
2774
2777
|
readOnly,
|
2775
2778
|
children: /* @__PURE__ */ jsx7(
|
2776
2779
|
SortableProvider,
|
2777
2780
|
{
|
2781
|
+
container: dndContainerRef,
|
2778
2782
|
onDragStart: () => setIsDragging(true),
|
2779
2783
|
onDragEnd: () => setIsDragging(false),
|
2780
2784
|
onMove: (move) => {
|
@@ -2805,164 +2809,172 @@ var ArrayField = ({
|
|
2805
2809
|
addDisabled
|
2806
2810
|
}),
|
2807
2811
|
children: [
|
2808
|
-
/* @__PURE__ */ jsx7(
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2812
|
+
/* @__PURE__ */ jsx7(
|
2813
|
+
"div",
|
2814
|
+
{
|
2815
|
+
ref: dndContainerRef,
|
2816
|
+
className: getClassName5("inner"),
|
2817
|
+
"data-dnd-container": true,
|
2818
|
+
children: localState.arrayState.items.map((item, i) => {
|
2819
|
+
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
2820
|
+
const data = Array.from(localState.value || [])[i] || {};
|
2821
|
+
return /* @__PURE__ */ jsx7(
|
2822
|
+
Sortable,
|
2819
2823
|
{
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2824
|
+
id: _arrayId,
|
2825
|
+
index: i,
|
2826
|
+
disabled: readOnly,
|
2827
|
+
children: ({ status, ref }) => /* @__PURE__ */ jsxs3(
|
2828
|
+
"div",
|
2829
|
+
{
|
2830
|
+
ref,
|
2831
|
+
className: getClassNameItem({
|
2832
|
+
isExpanded: arrayState.openId === _arrayId,
|
2833
|
+
isDragging: status === "dragging",
|
2834
|
+
readOnly
|
2835
|
+
}),
|
2836
|
+
children: [
|
2837
|
+
/* @__PURE__ */ jsxs3(
|
2838
|
+
"div",
|
2839
|
+
{
|
2840
|
+
onClick: (e) => {
|
2841
|
+
if (isDragging) return;
|
2842
|
+
e.preventDefault();
|
2843
|
+
e.stopPropagation();
|
2844
|
+
if (arrayState.openId === _arrayId) {
|
2845
|
+
setUi(
|
2846
|
+
mapArrayStateToUi({
|
2847
|
+
openId: ""
|
2848
|
+
})
|
2849
|
+
);
|
2850
|
+
} else {
|
2851
|
+
setUi(
|
2852
|
+
mapArrayStateToUi({
|
2853
|
+
openId: _arrayId
|
2854
|
+
})
|
2855
|
+
);
|
2856
|
+
}
|
2857
|
+
},
|
2858
|
+
className: getClassNameItem("summary"),
|
2859
|
+
children: [
|
2860
|
+
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
2861
|
+
/* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
|
2862
|
+
!readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
|
2863
|
+
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
|
2864
|
+
IconButton,
|
2865
|
+
{
|
2866
|
+
type: "button",
|
2867
|
+
disabled: !!addDisabled,
|
2868
|
+
onClick: (e) => {
|
2869
|
+
e.stopPropagation();
|
2870
|
+
const existingValue = [...value || []];
|
2871
|
+
existingValue.splice(
|
2872
|
+
i,
|
2873
|
+
0,
|
2874
|
+
existingValue[i]
|
2875
|
+
);
|
2876
|
+
onChange(
|
2877
|
+
existingValue,
|
2878
|
+
mapArrayStateToUi(
|
2879
|
+
regenerateArrayState(existingValue)
|
2880
|
+
)
|
2881
|
+
);
|
2882
|
+
},
|
2883
|
+
title: "Duplicate",
|
2884
|
+
children: /* @__PURE__ */ jsx7(Copy, { size: 16 })
|
2885
|
+
}
|
2886
|
+
) }),
|
2887
|
+
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
|
2888
|
+
IconButton,
|
2889
|
+
{
|
2890
|
+
type: "button",
|
2891
|
+
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
2892
|
+
onClick: (e) => {
|
2893
|
+
e.stopPropagation();
|
2894
|
+
const existingValue = [...value || []];
|
2895
|
+
const existingItems = [
|
2896
|
+
...arrayState.items || []
|
2897
|
+
];
|
2898
|
+
existingValue.splice(i, 1);
|
2899
|
+
existingItems.splice(i, 1);
|
2900
|
+
onChange(
|
2901
|
+
existingValue,
|
2902
|
+
mapArrayStateToUi({
|
2903
|
+
items: existingItems
|
2904
|
+
})
|
2905
|
+
);
|
2906
|
+
},
|
2907
|
+
title: "Delete",
|
2908
|
+
children: /* @__PURE__ */ jsx7(Trash, { size: 16 })
|
2909
|
+
}
|
2910
|
+
) })
|
2911
|
+
] }),
|
2912
|
+
/* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(DragIcon, {}) })
|
2913
|
+
] })
|
2914
|
+
]
|
2846
2915
|
}
|
2847
|
-
|
2848
|
-
className: getClassNameItem("
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
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) => {
|
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,
|
2926
|
-
{
|
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
|
-
)
|
2916
|
+
),
|
2917
|
+
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx7(
|
2918
|
+
"fieldset",
|
2919
|
+
{
|
2920
|
+
className: getClassNameItem("fieldset"),
|
2921
|
+
onPointerDownCapture: (e) => {
|
2922
|
+
e.stopPropagation();
|
2953
2923
|
},
|
2954
|
-
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
|
2959
|
-
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
2963
|
-
|
2964
|
-
|
2965
|
-
|
2924
|
+
children: Object.keys(field.arrayFields).map((subName) => {
|
2925
|
+
const subField = field.arrayFields[subName];
|
2926
|
+
const indexName = `${name}[${i}]`;
|
2927
|
+
const subPath = `${indexName}.${subName}`;
|
2928
|
+
const localIndexName = `${localName}[${i}]`;
|
2929
|
+
const localWildcardName = `${localName}[*]`;
|
2930
|
+
const localSubPath = `${localIndexName}.${subName}`;
|
2931
|
+
const localWildcardSubPath = `${localWildcardName}.${subName}`;
|
2932
|
+
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
|
2933
|
+
const label2 = subField.label || subName;
|
2934
|
+
return /* @__PURE__ */ jsx7(
|
2935
|
+
NestedFieldProvider,
|
2936
|
+
{
|
2937
|
+
name: localIndexName,
|
2938
|
+
wildcardName: localWildcardName,
|
2939
|
+
subName,
|
2940
|
+
readOnlyFields,
|
2941
|
+
children: /* @__PURE__ */ jsx7(
|
2942
|
+
AutoFieldPrivate,
|
2943
|
+
{
|
2944
|
+
name: subPath,
|
2945
|
+
label: label2,
|
2946
|
+
id: `${_arrayId}_${subName}`,
|
2947
|
+
readOnly: subReadOnly,
|
2948
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
2949
|
+
label: label2
|
2950
|
+
// May be used by custom fields
|
2951
|
+
}),
|
2952
|
+
value: data[subName],
|
2953
|
+
onChange: (val, ui) => {
|
2954
|
+
onChange(
|
2955
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
2956
|
+
[subName]: val
|
2957
|
+
})),
|
2958
|
+
ui
|
2959
|
+
);
|
2960
|
+
}
|
2961
|
+
}
|
2962
|
+
)
|
2963
|
+
},
|
2964
|
+
subPath
|
2965
|
+
);
|
2966
|
+
})
|
2967
|
+
}
|
2968
|
+
) })
|
2969
|
+
]
|
2970
|
+
}
|
2971
|
+
)
|
2972
|
+
},
|
2973
|
+
_arrayId
|
2974
|
+
);
|
2975
|
+
})
|
2976
|
+
}
|
2977
|
+
),
|
2966
2978
|
!addDisabled && /* @__PURE__ */ jsx7(
|
2967
2979
|
"button",
|
2968
2980
|
{
|
@@ -3001,6 +3013,7 @@ var DefaultField = ({
|
|
3001
3013
|
value: _value,
|
3002
3014
|
name,
|
3003
3015
|
label,
|
3016
|
+
labelIcon,
|
3004
3017
|
Label: Label2,
|
3005
3018
|
id
|
3006
3019
|
}) => {
|
@@ -3009,7 +3022,7 @@ var DefaultField = ({
|
|
3009
3022
|
Label2,
|
3010
3023
|
{
|
3011
3024
|
label: label || name,
|
3012
|
-
icon: /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
3025
|
+
icon: labelIcon || /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
3013
3026
|
field.type === "text" && /* @__PURE__ */ jsx8(Type, { size: 16 }),
|
3014
3027
|
field.type === "number" && /* @__PURE__ */ jsx8(Hash, { size: 16 })
|
3015
3028
|
] }),
|
@@ -3445,6 +3458,7 @@ var ExternalField = ({
|
|
3445
3458
|
value,
|
3446
3459
|
name,
|
3447
3460
|
label,
|
3461
|
+
labelIcon,
|
3448
3462
|
Label: Label2,
|
3449
3463
|
id,
|
3450
3464
|
readOnly
|
@@ -3462,27 +3476,35 @@ var ExternalField = ({
|
|
3462
3476
|
if (field.type !== "external") {
|
3463
3477
|
return null;
|
3464
3478
|
}
|
3465
|
-
return /* @__PURE__ */ jsx13(
|
3466
|
-
|
3479
|
+
return /* @__PURE__ */ jsx13(
|
3480
|
+
Label2,
|
3467
3481
|
{
|
3468
|
-
name,
|
3469
|
-
|
3470
|
-
|
3471
|
-
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3475
|
-
|
3476
|
-
|
3477
|
-
|
3478
|
-
|
3479
|
-
|
3480
|
-
|
3481
|
-
|
3482
|
-
|
3483
|
-
|
3482
|
+
label: label || name,
|
3483
|
+
icon: labelIcon || /* @__PURE__ */ jsx13(Link, { size: 16 }),
|
3484
|
+
el: "div",
|
3485
|
+
children: /* @__PURE__ */ jsx13(
|
3486
|
+
ExternalInput,
|
3487
|
+
{
|
3488
|
+
name,
|
3489
|
+
field: __spreadProps(__spreadValues({}, validField), {
|
3490
|
+
// DEPRECATED
|
3491
|
+
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
3492
|
+
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
3493
|
+
mapRow: validField.mapRow,
|
3494
|
+
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
|
3495
|
+
return yield deprecatedField.adaptor.fetchList(
|
3496
|
+
deprecatedField.adaptorParams
|
3497
|
+
);
|
3498
|
+
}) : validField.fetchList
|
3499
|
+
}),
|
3500
|
+
onChange,
|
3501
|
+
value,
|
3502
|
+
id,
|
3503
|
+
readOnly
|
3504
|
+
}
|
3505
|
+
)
|
3484
3506
|
}
|
3485
|
-
)
|
3507
|
+
);
|
3486
3508
|
};
|
3487
3509
|
|
3488
3510
|
// components/AutoField/fields/RadioField/index.tsx
|
@@ -3511,6 +3533,7 @@ var RadioField = ({
|
|
3511
3533
|
name,
|
3512
3534
|
id,
|
3513
3535
|
label,
|
3536
|
+
labelIcon,
|
3514
3537
|
Label: Label2
|
3515
3538
|
}) => {
|
3516
3539
|
const flatOptions = useMemo3(
|
@@ -3523,7 +3546,7 @@ var RadioField = ({
|
|
3523
3546
|
return /* @__PURE__ */ jsx14(
|
3524
3547
|
Label2,
|
3525
3548
|
{
|
3526
|
-
icon: /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
|
3549
|
+
icon: labelIcon || /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
|
3527
3550
|
label: label || name,
|
3528
3551
|
readOnly,
|
3529
3552
|
el: "div",
|
@@ -3570,6 +3593,7 @@ var SelectField = ({
|
|
3570
3593
|
field,
|
3571
3594
|
onChange,
|
3572
3595
|
label,
|
3596
|
+
labelIcon,
|
3573
3597
|
Label: Label2,
|
3574
3598
|
value,
|
3575
3599
|
name,
|
@@ -3587,7 +3611,7 @@ var SelectField = ({
|
|
3587
3611
|
Label2,
|
3588
3612
|
{
|
3589
3613
|
label: label || name,
|
3590
|
-
icon: /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
|
3614
|
+
icon: labelIcon || /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
|
3591
3615
|
readOnly,
|
3592
3616
|
children: /* @__PURE__ */ jsx15(
|
3593
3617
|
"select",
|
@@ -3631,24 +3655,33 @@ var TextareaField = ({
|
|
3631
3655
|
value,
|
3632
3656
|
name,
|
3633
3657
|
label,
|
3658
|
+
labelIcon,
|
3634
3659
|
Label: Label2,
|
3635
3660
|
id
|
3636
3661
|
}) => {
|
3637
|
-
return /* @__PURE__ */ jsx16(
|
3638
|
-
|
3662
|
+
return /* @__PURE__ */ jsx16(
|
3663
|
+
Label2,
|
3639
3664
|
{
|
3640
|
-
|
3641
|
-
|
3642
|
-
autoComplete: "off",
|
3643
|
-
name,
|
3644
|
-
value: typeof value === "undefined" ? "" : value,
|
3645
|
-
onChange: (e) => onChange(e.currentTarget.value),
|
3665
|
+
label: label || name,
|
3666
|
+
icon: labelIcon || /* @__PURE__ */ jsx16(Type, { size: 16 }),
|
3646
3667
|
readOnly,
|
3647
|
-
|
3648
|
-
|
3649
|
-
|
3668
|
+
children: /* @__PURE__ */ jsx16(
|
3669
|
+
"textarea",
|
3670
|
+
{
|
3671
|
+
id,
|
3672
|
+
className: getClassName13("input"),
|
3673
|
+
autoComplete: "off",
|
3674
|
+
name,
|
3675
|
+
value: typeof value === "undefined" ? "" : value,
|
3676
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
3677
|
+
readOnly,
|
3678
|
+
tabIndex: readOnly ? -1 : void 0,
|
3679
|
+
rows: 5,
|
3680
|
+
placeholder: field.type === "textarea" ? field.placeholder : void 0
|
3681
|
+
}
|
3682
|
+
)
|
3650
3683
|
}
|
3651
|
-
)
|
3684
|
+
);
|
3652
3685
|
};
|
3653
3686
|
|
3654
3687
|
// components/AutoField/fields/ObjectField/index.tsx
|
@@ -3667,6 +3700,7 @@ var ObjectField = ({
|
|
3667
3700
|
value,
|
3668
3701
|
name,
|
3669
3702
|
label,
|
3703
|
+
labelIcon,
|
3670
3704
|
Label: Label2,
|
3671
3705
|
readOnly,
|
3672
3706
|
id
|
@@ -3680,7 +3714,7 @@ var ObjectField = ({
|
|
3680
3714
|
Label2,
|
3681
3715
|
{
|
3682
3716
|
label: label || name,
|
3683
|
-
icon: /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
|
3717
|
+
icon: labelIcon || /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
|
3684
3718
|
el: "div",
|
3685
3719
|
readOnly,
|
3686
3720
|
children: /* @__PURE__ */ jsx17("div", { className: getClassName14(), children: /* @__PURE__ */ jsx17("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
@@ -3797,6 +3831,7 @@ function AutoFieldInternal(props) {
|
|
3797
3831
|
const { id, Label: Label2 = FieldLabelInternal } = props;
|
3798
3832
|
const field = props.field;
|
3799
3833
|
const label = field.label;
|
3834
|
+
const labelIcon = field.labelIcon;
|
3800
3835
|
const defaultId = useSafeId();
|
3801
3836
|
const resolvedId = id || defaultId;
|
3802
3837
|
const defaultFields = {
|
@@ -3822,6 +3857,7 @@ function AutoFieldInternal(props) {
|
|
3822
3857
|
const mergedProps = __spreadProps(__spreadValues({}, props), {
|
3823
3858
|
field,
|
3824
3859
|
label,
|
3860
|
+
labelIcon,
|
3825
3861
|
Label: Label2,
|
3826
3862
|
id: resolvedId
|
3827
3863
|
});
|
@@ -3884,10 +3920,13 @@ function AutoFieldPrivate(props) {
|
|
3884
3920
|
const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
|
3885
3921
|
const { value, onChange } = props;
|
3886
3922
|
const [localValue, setLocalValue] = useState9(value);
|
3887
|
-
const onChangeLocal = useCallback4(
|
3888
|
-
|
3889
|
-
|
3890
|
-
|
3923
|
+
const onChangeLocal = useCallback4(
|
3924
|
+
(val, ui) => {
|
3925
|
+
setLocalValue(val);
|
3926
|
+
onChange(val, ui);
|
3927
|
+
},
|
3928
|
+
[onChange]
|
3929
|
+
);
|
3891
3930
|
useEffect11(() => {
|
3892
3931
|
if (!isFocused) {
|
3893
3932
|
setLocalValue(value);
|
@@ -3931,7 +3970,7 @@ import {
|
|
3931
3970
|
useContext as useContext7,
|
3932
3971
|
useEffect as useEffect17,
|
3933
3972
|
useId,
|
3934
|
-
useRef as
|
3973
|
+
useRef as useRef4,
|
3935
3974
|
useState as useState15
|
3936
3975
|
} from "react";
|
3937
3976
|
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
@@ -3944,7 +3983,7 @@ import {
|
|
3944
3983
|
useContext as useContext6,
|
3945
3984
|
useEffect as useEffect16,
|
3946
3985
|
useMemo as useMemo8,
|
3947
|
-
useRef as
|
3986
|
+
useRef as useRef3
|
3948
3987
|
} from "react";
|
3949
3988
|
|
3950
3989
|
// components/DraggableComponent/index.tsx
|
@@ -3954,7 +3993,7 @@ import {
|
|
3954
3993
|
useContext as useContext5,
|
3955
3994
|
useEffect as useEffect12,
|
3956
3995
|
useMemo as useMemo7,
|
3957
|
-
useRef,
|
3996
|
+
useRef as useRef2,
|
3958
3997
|
useState as useState11
|
3959
3998
|
} from "react";
|
3960
3999
|
|
@@ -4191,7 +4230,7 @@ var DraggableComponent = ({
|
|
4191
4230
|
}
|
4192
4231
|
});
|
4193
4232
|
const thisIsDragging = status === "dragging";
|
4194
|
-
const ref =
|
4233
|
+
const ref = useRef2(null);
|
4195
4234
|
const refSetter = useCallback6(
|
4196
4235
|
(el) => {
|
4197
4236
|
sortableRef(el);
|
@@ -4868,7 +4907,7 @@ var DropZoneEdit = forwardRef3(
|
|
4868
4907
|
return content.map(({ props }) => props.id);
|
4869
4908
|
})
|
4870
4909
|
);
|
4871
|
-
const ref =
|
4910
|
+
const ref = useRef3(null);
|
4872
4911
|
const acceptsTarget = useCallback9(
|
4873
4912
|
(componentType) => {
|
4874
4913
|
if (!componentType) {
|
@@ -5370,7 +5409,7 @@ function useDragListener(type, fn, deps = []) {
|
|
5370
5409
|
}
|
5371
5410
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
5372
5411
|
var useTempDisableFallback = (timeout3) => {
|
5373
|
-
const lastFallbackDisable =
|
5412
|
+
const lastFallbackDisable = useRef4(null);
|
5374
5413
|
return useCallback10((manager) => {
|
5375
5414
|
collisionStore.setState({ fallbackEnabled: false });
|
5376
5415
|
const fallbackId = generateId();
|
@@ -5393,7 +5432,7 @@ var DragDropContextClient = ({
|
|
5393
5432
|
const metadata = useAppStore((s) => s.metadata);
|
5394
5433
|
const appStore = useAppStoreApi();
|
5395
5434
|
const id = useId();
|
5396
|
-
const debouncedParamsRef =
|
5435
|
+
const debouncedParamsRef = useRef4(null);
|
5397
5436
|
const tempDisableFallback = useTempDisableFallback(100);
|
5398
5437
|
const [zoneStore] = useState15(
|
5399
5438
|
() => createStore3(() => ({
|
@@ -5513,8 +5552,8 @@ var DragDropContextClient = ({
|
|
5513
5552
|
]);
|
5514
5553
|
const sensors = useSensors();
|
5515
5554
|
const [dragListeners, setDragListeners] = useState15({});
|
5516
|
-
const dragMode =
|
5517
|
-
const initialSelector =
|
5555
|
+
const dragMode = useRef4(null);
|
5556
|
+
const initialSelector = useRef4(void 0);
|
5518
5557
|
return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
|
5519
5558
|
dragListenerContext.Provider,
|
5520
5559
|
{
|
@@ -6328,7 +6367,7 @@ var Components = () => {
|
|
6328
6367
|
|
6329
6368
|
// components/Puck/components/Preview/index.tsx
|
6330
6369
|
init_react_import();
|
6331
|
-
import { useCallback as useCallback12, useEffect as useEffect20, useRef as
|
6370
|
+
import { useCallback as useCallback12, useEffect as useEffect20, useRef as useRef5, useMemo as useMemo13 } from "react";
|
6332
6371
|
|
6333
6372
|
// components/AutoFrame/index.tsx
|
6334
6373
|
init_react_import();
|
@@ -6680,7 +6719,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
6680
6719
|
);
|
6681
6720
|
const Frame = useMemo13(() => overrides.iframe, [overrides]);
|
6682
6721
|
const rootProps = root.props || root;
|
6683
|
-
const ref =
|
6722
|
+
const ref = useRef5(null);
|
6684
6723
|
useBubbleIframeEvents(ref);
|
6685
6724
|
const inner = !renderData ? /* @__PURE__ */ jsx32(
|
6686
6725
|
Page,
|
@@ -7112,7 +7151,7 @@ import {
|
|
7112
7151
|
useCallback as useCallback14,
|
7113
7152
|
useEffect as useEffect22,
|
7114
7153
|
useMemo as useMemo16,
|
7115
|
-
useRef as
|
7154
|
+
useRef as useRef6,
|
7116
7155
|
useState as useState20
|
7117
7156
|
} from "react";
|
7118
7157
|
|
@@ -7325,7 +7364,7 @@ var Canvas = () => {
|
|
7325
7364
|
viewports: s.state.ui.viewports
|
7326
7365
|
}))
|
7327
7366
|
);
|
7328
|
-
const frameRef =
|
7367
|
+
const frameRef = useRef6(null);
|
7329
7368
|
const [showTransition, setShowTransition] = useState20(false);
|
7330
7369
|
const defaultRender = useMemo16(() => {
|
7331
7370
|
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment13, { children });
|