@measured/puck 0.19.0-canary.59cb0d9 → 0.19.0-canary.61c8658
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 +237 -201
- package/dist/index.mjs +252 -217
- 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();
|
@@ -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) => {
|
@@ -2804,168 +2808,173 @@ var ArrayField = ({
|
|
2804
2808
|
hasItems: Array.isArray(value) && value.length > 0,
|
2805
2809
|
addDisabled
|
2806
2810
|
}),
|
2807
|
-
onClick: (e) => {
|
2808
|
-
e.preventDefault();
|
2809
|
-
},
|
2810
2811
|
children: [
|
2811
|
-
/* @__PURE__ */ jsx7(
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
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,
|
2822
2823
|
{
|
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
|
-
|
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
|
+
]
|
2849
2915
|
}
|
2850
|
-
|
2851
|
-
className: getClassNameItem("
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
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) => {
|
2918
|
-
const subField = field.arrayFields[subName];
|
2919
|
-
const indexName = `${name}[${i}]`;
|
2920
|
-
const subPath = `${indexName}.${subName}`;
|
2921
|
-
const localIndexName = `${localName}[${i}]`;
|
2922
|
-
const localWildcardName = `${localName}[*]`;
|
2923
|
-
const localSubPath = `${localIndexName}.${subName}`;
|
2924
|
-
const localWildcardSubPath = `${localWildcardName}.${subName}`;
|
2925
|
-
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
|
2926
|
-
const label2 = subField.label || subName;
|
2927
|
-
return /* @__PURE__ */ jsx7(
|
2928
|
-
NestedFieldProvider,
|
2929
|
-
{
|
2930
|
-
name: localIndexName,
|
2931
|
-
wildcardName: localWildcardName,
|
2932
|
-
subName,
|
2933
|
-
readOnlyFields,
|
2934
|
-
children: /* @__PURE__ */ jsx7(
|
2935
|
-
AutoFieldPrivate,
|
2936
|
-
{
|
2937
|
-
name: subPath,
|
2938
|
-
label: label2,
|
2939
|
-
id: `${_arrayId}_${subName}`,
|
2940
|
-
readOnly: subReadOnly,
|
2941
|
-
field: __spreadProps(__spreadValues({}, subField), {
|
2942
|
-
label: label2
|
2943
|
-
// May be used by custom fields
|
2944
|
-
}),
|
2945
|
-
value: data[subName],
|
2946
|
-
onChange: (val, ui) => {
|
2947
|
-
onChange(
|
2948
|
-
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
2949
|
-
[subName]: val
|
2950
|
-
})),
|
2951
|
-
ui
|
2952
|
-
);
|
2953
|
-
}
|
2954
|
-
}
|
2955
|
-
)
|
2916
|
+
),
|
2917
|
+
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx7(
|
2918
|
+
"fieldset",
|
2919
|
+
{
|
2920
|
+
className: getClassNameItem("fieldset"),
|
2921
|
+
onPointerDownCapture: (e) => {
|
2922
|
+
e.stopPropagation();
|
2956
2923
|
},
|
2957
|
-
|
2958
|
-
|
2959
|
-
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
2963
|
-
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
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
|
+
),
|
2969
2978
|
!addDisabled && /* @__PURE__ */ jsx7(
|
2970
2979
|
"button",
|
2971
2980
|
{
|
@@ -3004,6 +3013,7 @@ var DefaultField = ({
|
|
3004
3013
|
value: _value,
|
3005
3014
|
name,
|
3006
3015
|
label,
|
3016
|
+
labelIcon,
|
3007
3017
|
Label: Label2,
|
3008
3018
|
id
|
3009
3019
|
}) => {
|
@@ -3012,7 +3022,7 @@ var DefaultField = ({
|
|
3012
3022
|
Label2,
|
3013
3023
|
{
|
3014
3024
|
label: label || name,
|
3015
|
-
icon: /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
3025
|
+
icon: labelIcon || /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
3016
3026
|
field.type === "text" && /* @__PURE__ */ jsx8(Type, { size: 16 }),
|
3017
3027
|
field.type === "number" && /* @__PURE__ */ jsx8(Hash, { size: 16 })
|
3018
3028
|
] }),
|
@@ -3448,6 +3458,7 @@ var ExternalField = ({
|
|
3448
3458
|
value,
|
3449
3459
|
name,
|
3450
3460
|
label,
|
3461
|
+
labelIcon,
|
3451
3462
|
Label: Label2,
|
3452
3463
|
id,
|
3453
3464
|
readOnly
|
@@ -3465,27 +3476,35 @@ var ExternalField = ({
|
|
3465
3476
|
if (field.type !== "external") {
|
3466
3477
|
return null;
|
3467
3478
|
}
|
3468
|
-
return /* @__PURE__ */ jsx13(
|
3469
|
-
|
3479
|
+
return /* @__PURE__ */ jsx13(
|
3480
|
+
Label2,
|
3470
3481
|
{
|
3471
|
-
name,
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3475
|
-
|
3476
|
-
|
3477
|
-
|
3478
|
-
|
3479
|
-
|
3480
|
-
|
3481
|
-
|
3482
|
-
|
3483
|
-
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
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
|
+
)
|
3487
3506
|
}
|
3488
|
-
)
|
3507
|
+
);
|
3489
3508
|
};
|
3490
3509
|
|
3491
3510
|
// components/AutoField/fields/RadioField/index.tsx
|
@@ -3514,6 +3533,7 @@ var RadioField = ({
|
|
3514
3533
|
name,
|
3515
3534
|
id,
|
3516
3535
|
label,
|
3536
|
+
labelIcon,
|
3517
3537
|
Label: Label2
|
3518
3538
|
}) => {
|
3519
3539
|
const flatOptions = useMemo3(
|
@@ -3526,7 +3546,7 @@ var RadioField = ({
|
|
3526
3546
|
return /* @__PURE__ */ jsx14(
|
3527
3547
|
Label2,
|
3528
3548
|
{
|
3529
|
-
icon: /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
|
3549
|
+
icon: labelIcon || /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
|
3530
3550
|
label: label || name,
|
3531
3551
|
readOnly,
|
3532
3552
|
el: "div",
|
@@ -3573,6 +3593,7 @@ var SelectField = ({
|
|
3573
3593
|
field,
|
3574
3594
|
onChange,
|
3575
3595
|
label,
|
3596
|
+
labelIcon,
|
3576
3597
|
Label: Label2,
|
3577
3598
|
value,
|
3578
3599
|
name,
|
@@ -3590,7 +3611,7 @@ var SelectField = ({
|
|
3590
3611
|
Label2,
|
3591
3612
|
{
|
3592
3613
|
label: label || name,
|
3593
|
-
icon: /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
|
3614
|
+
icon: labelIcon || /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
|
3594
3615
|
readOnly,
|
3595
3616
|
children: /* @__PURE__ */ jsx15(
|
3596
3617
|
"select",
|
@@ -3634,24 +3655,33 @@ var TextareaField = ({
|
|
3634
3655
|
value,
|
3635
3656
|
name,
|
3636
3657
|
label,
|
3658
|
+
labelIcon,
|
3637
3659
|
Label: Label2,
|
3638
3660
|
id
|
3639
3661
|
}) => {
|
3640
|
-
return /* @__PURE__ */ jsx16(
|
3641
|
-
|
3662
|
+
return /* @__PURE__ */ jsx16(
|
3663
|
+
Label2,
|
3642
3664
|
{
|
3643
|
-
|
3644
|
-
|
3645
|
-
autoComplete: "off",
|
3646
|
-
name,
|
3647
|
-
value: typeof value === "undefined" ? "" : value,
|
3648
|
-
onChange: (e) => onChange(e.currentTarget.value),
|
3665
|
+
label: label || name,
|
3666
|
+
icon: labelIcon || /* @__PURE__ */ jsx16(Type, { size: 16 }),
|
3649
3667
|
readOnly,
|
3650
|
-
|
3651
|
-
|
3652
|
-
|
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
|
+
)
|
3653
3683
|
}
|
3654
|
-
)
|
3684
|
+
);
|
3655
3685
|
};
|
3656
3686
|
|
3657
3687
|
// components/AutoField/fields/ObjectField/index.tsx
|
@@ -3670,6 +3700,7 @@ var ObjectField = ({
|
|
3670
3700
|
value,
|
3671
3701
|
name,
|
3672
3702
|
label,
|
3703
|
+
labelIcon,
|
3673
3704
|
Label: Label2,
|
3674
3705
|
readOnly,
|
3675
3706
|
id
|
@@ -3683,7 +3714,7 @@ var ObjectField = ({
|
|
3683
3714
|
Label2,
|
3684
3715
|
{
|
3685
3716
|
label: label || name,
|
3686
|
-
icon: /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
|
3717
|
+
icon: labelIcon || /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
|
3687
3718
|
el: "div",
|
3688
3719
|
readOnly,
|
3689
3720
|
children: /* @__PURE__ */ jsx17("div", { className: getClassName14(), children: /* @__PURE__ */ jsx17("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
@@ -3800,6 +3831,7 @@ function AutoFieldInternal(props) {
|
|
3800
3831
|
const { id, Label: Label2 = FieldLabelInternal } = props;
|
3801
3832
|
const field = props.field;
|
3802
3833
|
const label = field.label;
|
3834
|
+
const labelIcon = field.labelIcon;
|
3803
3835
|
const defaultId = useSafeId();
|
3804
3836
|
const resolvedId = id || defaultId;
|
3805
3837
|
const defaultFields = {
|
@@ -3825,6 +3857,7 @@ function AutoFieldInternal(props) {
|
|
3825
3857
|
const mergedProps = __spreadProps(__spreadValues({}, props), {
|
3826
3858
|
field,
|
3827
3859
|
label,
|
3860
|
+
labelIcon,
|
3828
3861
|
Label: Label2,
|
3829
3862
|
id: resolvedId
|
3830
3863
|
});
|
@@ -3887,10 +3920,13 @@ function AutoFieldPrivate(props) {
|
|
3887
3920
|
const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
|
3888
3921
|
const { value, onChange } = props;
|
3889
3922
|
const [localValue, setLocalValue] = useState9(value);
|
3890
|
-
const onChangeLocal = useCallback4(
|
3891
|
-
|
3892
|
-
|
3893
|
-
|
3923
|
+
const onChangeLocal = useCallback4(
|
3924
|
+
(val, ui) => {
|
3925
|
+
setLocalValue(val);
|
3926
|
+
onChange(val, ui);
|
3927
|
+
},
|
3928
|
+
[onChange]
|
3929
|
+
);
|
3894
3930
|
useEffect11(() => {
|
3895
3931
|
if (!isFocused) {
|
3896
3932
|
setLocalValue(value);
|
@@ -3923,7 +3959,7 @@ init_react_import();
|
|
3923
3959
|
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
3960
|
|
3925
3961
|
// components/Drawer/index.tsx
|
3926
|
-
import {
|
3962
|
+
import { useMemo as useMemo9, useState as useState16 } from "react";
|
3927
3963
|
|
3928
3964
|
// components/DragDropContext/index.tsx
|
3929
3965
|
init_react_import();
|
@@ -3933,8 +3969,7 @@ import {
|
|
3933
3969
|
useCallback as useCallback10,
|
3934
3970
|
useContext as useContext7,
|
3935
3971
|
useEffect as useEffect17,
|
3936
|
-
|
3937
|
-
useRef as useRef3,
|
3972
|
+
useRef as useRef4,
|
3938
3973
|
useState as useState15
|
3939
3974
|
} from "react";
|
3940
3975
|
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
@@ -3947,7 +3982,7 @@ import {
|
|
3947
3982
|
useContext as useContext6,
|
3948
3983
|
useEffect as useEffect16,
|
3949
3984
|
useMemo as useMemo8,
|
3950
|
-
useRef as
|
3985
|
+
useRef as useRef3
|
3951
3986
|
} from "react";
|
3952
3987
|
|
3953
3988
|
// components/DraggableComponent/index.tsx
|
@@ -3957,7 +3992,7 @@ import {
|
|
3957
3992
|
useContext as useContext5,
|
3958
3993
|
useEffect as useEffect12,
|
3959
3994
|
useMemo as useMemo7,
|
3960
|
-
useRef,
|
3995
|
+
useRef as useRef2,
|
3961
3996
|
useState as useState11
|
3962
3997
|
} from "react";
|
3963
3998
|
|
@@ -4194,7 +4229,7 @@ var DraggableComponent = ({
|
|
4194
4229
|
}
|
4195
4230
|
});
|
4196
4231
|
const thisIsDragging = status === "dragging";
|
4197
|
-
const ref =
|
4232
|
+
const ref = useRef2(null);
|
4198
4233
|
const refSetter = useCallback6(
|
4199
4234
|
(el) => {
|
4200
4235
|
sortableRef(el);
|
@@ -4871,7 +4906,7 @@ var DropZoneEdit = forwardRef3(
|
|
4871
4906
|
return content.map(({ props }) => props.id);
|
4872
4907
|
})
|
4873
4908
|
);
|
4874
|
-
const ref =
|
4909
|
+
const ref = useRef3(null);
|
4875
4910
|
const acceptsTarget = useCallback9(
|
4876
4911
|
(componentType) => {
|
4877
4912
|
if (!componentType) {
|
@@ -5373,7 +5408,7 @@ function useDragListener(type, fn, deps = []) {
|
|
5373
5408
|
}
|
5374
5409
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
5375
5410
|
var useTempDisableFallback = (timeout3) => {
|
5376
|
-
const lastFallbackDisable =
|
5411
|
+
const lastFallbackDisable = useRef4(null);
|
5377
5412
|
return useCallback10((manager) => {
|
5378
5413
|
collisionStore.setState({ fallbackEnabled: false });
|
5379
5414
|
const fallbackId = generateId();
|
@@ -5395,8 +5430,8 @@ var DragDropContextClient = ({
|
|
5395
5430
|
const resolveData2 = useAppStore((s) => s.resolveData);
|
5396
5431
|
const metadata = useAppStore((s) => s.metadata);
|
5397
5432
|
const appStore = useAppStoreApi();
|
5398
|
-
const id =
|
5399
|
-
const debouncedParamsRef =
|
5433
|
+
const id = useSafeId();
|
5434
|
+
const debouncedParamsRef = useRef4(null);
|
5400
5435
|
const tempDisableFallback = useTempDisableFallback(100);
|
5401
5436
|
const [zoneStore] = useState15(
|
5402
5437
|
() => createStore3(() => ({
|
@@ -5516,8 +5551,8 @@ var DragDropContextClient = ({
|
|
5516
5551
|
]);
|
5517
5552
|
const sensors = useSensors();
|
5518
5553
|
const [dragListeners, setDragListeners] = useState15({});
|
5519
|
-
const dragMode =
|
5520
|
-
const initialSelector =
|
5554
|
+
const dragMode = useRef4(null);
|
5555
|
+
const initialSelector = useRef4(void 0);
|
5521
5556
|
return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
|
5522
5557
|
dragListenerContext.Provider,
|
5523
5558
|
{
|
@@ -5849,7 +5884,7 @@ var Drawer = ({
|
|
5849
5884
|
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
5850
5885
|
);
|
5851
5886
|
}
|
5852
|
-
const id =
|
5887
|
+
const id = useSafeId();
|
5853
5888
|
const { ref } = useDroppableSafe({
|
5854
5889
|
id,
|
5855
5890
|
type: "void",
|
@@ -6331,7 +6366,7 @@ var Components = () => {
|
|
6331
6366
|
|
6332
6367
|
// components/Puck/components/Preview/index.tsx
|
6333
6368
|
init_react_import();
|
6334
|
-
import { useCallback as useCallback12, useEffect as useEffect20, useRef as
|
6369
|
+
import { useCallback as useCallback12, useEffect as useEffect20, useRef as useRef5, useMemo as useMemo13 } from "react";
|
6335
6370
|
|
6336
6371
|
// components/AutoFrame/index.tsx
|
6337
6372
|
init_react_import();
|
@@ -6683,7 +6718,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
6683
6718
|
);
|
6684
6719
|
const Frame = useMemo13(() => overrides.iframe, [overrides]);
|
6685
6720
|
const rootProps = root.props || root;
|
6686
|
-
const ref =
|
6721
|
+
const ref = useRef5(null);
|
6687
6722
|
useBubbleIframeEvents(ref);
|
6688
6723
|
const inner = !renderData ? /* @__PURE__ */ jsx32(
|
6689
6724
|
Page,
|
@@ -7115,7 +7150,7 @@ import {
|
|
7115
7150
|
useCallback as useCallback14,
|
7116
7151
|
useEffect as useEffect22,
|
7117
7152
|
useMemo as useMemo16,
|
7118
|
-
useRef as
|
7153
|
+
useRef as useRef6,
|
7119
7154
|
useState as useState20
|
7120
7155
|
} from "react";
|
7121
7156
|
|
@@ -7328,7 +7363,7 @@ var Canvas = () => {
|
|
7328
7363
|
viewports: s.state.ui.viewports
|
7329
7364
|
}))
|
7330
7365
|
);
|
7331
|
-
const frameRef =
|
7366
|
+
const frameRef = useRef6(null);
|
7332
7367
|
const [showTransition, setShowTransition] = useState20(false);
|
7333
7368
|
const defaultRender = useMemo16(() => {
|
7334
7369
|
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment13, { children });
|