@measured/puck 0.18.0-canary.1ea6f98 → 0.18.0-canary.4a04445
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +29 -15
- package/dist/index.mjs +30 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -3664,7 +3664,7 @@ var getClassName17 = get_class_name_factory_default("DropZone", styles_module_de
|
|
3664
3664
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
3665
3665
|
var RENDER_DEBUG = false;
|
3666
3666
|
var DropZoneEdit = (0, import_react29.forwardRef)(
|
3667
|
-
function
|
3667
|
+
function DropZoneEditInternal({
|
3668
3668
|
zone,
|
3669
3669
|
allow,
|
3670
3670
|
disallow,
|
@@ -3825,7 +3825,7 @@ var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3825
3825
|
var _a, _b, _c, _d, _e;
|
3826
3826
|
const componentId = item.props.id;
|
3827
3827
|
const puckProps = {
|
3828
|
-
renderDropZone:
|
3828
|
+
renderDropZone: (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadValues({}, props)),
|
3829
3829
|
isEditing: true,
|
3830
3830
|
dragRef: null
|
3831
3831
|
};
|
@@ -3889,7 +3889,7 @@ var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3889
3889
|
}
|
3890
3890
|
);
|
3891
3891
|
var DropZoneRender = (0, import_react29.forwardRef)(
|
3892
|
-
function
|
3892
|
+
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
3893
3893
|
const ctx = (0, import_react29.useContext)(dropZoneContext);
|
3894
3894
|
const { data, areaId = "root", config } = ctx || {};
|
3895
3895
|
let zoneCompound = rootDroppableId;
|
@@ -3927,7 +3927,7 @@ var DropZoneRender = (0, import_react29.forwardRef)(
|
|
3927
3927
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
3928
3928
|
Component.render,
|
3929
3929
|
__spreadProps(__spreadValues({}, item.props), {
|
3930
|
-
puck: { renderDropZone:
|
3930
|
+
puck: { renderDropZone: DropZoneRender }
|
3931
3931
|
})
|
3932
3932
|
)
|
3933
3933
|
},
|
@@ -5374,7 +5374,7 @@ var Drawer = ({
|
|
5374
5374
|
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
5375
5375
|
);
|
5376
5376
|
}
|
5377
|
-
const
|
5377
|
+
const id = (0, import_react32.useId)();
|
5378
5378
|
const { ref } = useDroppableSafe({
|
5379
5379
|
id,
|
5380
5380
|
type: "void",
|
@@ -5675,19 +5675,33 @@ var useResolvedFields = () => {
|
|
5675
5675
|
lastData
|
5676
5676
|
});
|
5677
5677
|
}),
|
5678
|
-
[data, config, componentData, selectedItem, resolvedFields, state]
|
5678
|
+
[data, config, componentData, selectedItem, resolvedFields, state, parent]
|
5679
5679
|
);
|
5680
|
+
const [hasParent, setHasParent] = (0, import_react35.useState)(false);
|
5680
5681
|
(0, import_react35.useEffect)(() => {
|
5681
|
-
|
5682
|
-
|
5683
|
-
|
5684
|
-
|
5685
|
-
|
5686
|
-
|
5687
|
-
|
5688
|
-
|
5682
|
+
setHasParent(!!parent);
|
5683
|
+
}, [parent]);
|
5684
|
+
(0, import_react35.useEffect)(() => {
|
5685
|
+
var _a2;
|
5686
|
+
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || hasParent) {
|
5687
|
+
if (hasResolver) {
|
5688
|
+
setFieldsLoading(true);
|
5689
|
+
resolveFields(defaultFields).then((fields) => {
|
5690
|
+
setResolvedFields(fields || {});
|
5691
|
+
setFieldsLoading(false);
|
5692
|
+
});
|
5693
|
+
} else {
|
5694
|
+
setResolvedFields(defaultFields);
|
5695
|
+
}
|
5689
5696
|
}
|
5690
|
-
}, [
|
5697
|
+
}, [
|
5698
|
+
data,
|
5699
|
+
defaultFields,
|
5700
|
+
state.ui.itemSelector,
|
5701
|
+
selectedItem,
|
5702
|
+
hasResolver,
|
5703
|
+
hasParent
|
5704
|
+
]);
|
5691
5705
|
return [resolvedFields, fieldsLoading];
|
5692
5706
|
};
|
5693
5707
|
var Fields = () => {
|
package/dist/index.mjs
CHANGED
@@ -2425,7 +2425,7 @@ init_react_import();
|
|
2425
2425
|
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" };
|
2426
2426
|
|
2427
2427
|
// components/Drawer/index.tsx
|
2428
|
-
import { useMemo as useMemo9, useState as useState18 } from "react";
|
2428
|
+
import { useId as useId2, useMemo as useMemo9, useState as useState18 } from "react";
|
2429
2429
|
|
2430
2430
|
// components/DragDropContext/index.tsx
|
2431
2431
|
init_react_import();
|
@@ -3507,7 +3507,7 @@ var getClassName17 = get_class_name_factory_default("DropZone", styles_module_de
|
|
3507
3507
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
3508
3508
|
var RENDER_DEBUG = false;
|
3509
3509
|
var DropZoneEdit = forwardRef3(
|
3510
|
-
function
|
3510
|
+
function DropZoneEditInternal({
|
3511
3511
|
zone,
|
3512
3512
|
allow,
|
3513
3513
|
disallow,
|
@@ -3668,7 +3668,7 @@ var DropZoneEdit = forwardRef3(
|
|
3668
3668
|
var _a, _b, _c, _d, _e;
|
3669
3669
|
const componentId = item.props.id;
|
3670
3670
|
const puckProps = {
|
3671
|
-
renderDropZone:
|
3671
|
+
renderDropZone: (props) => /* @__PURE__ */ jsx22(DropZoneEdit, __spreadValues({}, props)),
|
3672
3672
|
isEditing: true,
|
3673
3673
|
dragRef: null
|
3674
3674
|
};
|
@@ -3732,7 +3732,7 @@ var DropZoneEdit = forwardRef3(
|
|
3732
3732
|
}
|
3733
3733
|
);
|
3734
3734
|
var DropZoneRender = forwardRef3(
|
3735
|
-
function
|
3735
|
+
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
3736
3736
|
const ctx = useContext6(dropZoneContext);
|
3737
3737
|
const { data, areaId = "root", config } = ctx || {};
|
3738
3738
|
let zoneCompound = rootDroppableId;
|
@@ -3770,7 +3770,7 @@ var DropZoneRender = forwardRef3(
|
|
3770
3770
|
children: /* @__PURE__ */ jsx22(
|
3771
3771
|
Component.render,
|
3772
3772
|
__spreadProps(__spreadValues({}, item.props), {
|
3773
|
-
puck: { renderDropZone:
|
3773
|
+
puck: { renderDropZone: DropZoneRender }
|
3774
3774
|
})
|
3775
3775
|
)
|
3776
3776
|
},
|
@@ -5226,7 +5226,7 @@ var Drawer = ({
|
|
5226
5226
|
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
5227
5227
|
);
|
5228
5228
|
}
|
5229
|
-
const
|
5229
|
+
const id = useId2();
|
5230
5230
|
const { ref } = useDroppableSafe({
|
5231
5231
|
id,
|
5232
5232
|
type: "void",
|
@@ -5533,19 +5533,33 @@ var useResolvedFields = () => {
|
|
5533
5533
|
lastData
|
5534
5534
|
});
|
5535
5535
|
}),
|
5536
|
-
[data, config, componentData, selectedItem, resolvedFields, state]
|
5536
|
+
[data, config, componentData, selectedItem, resolvedFields, state, parent]
|
5537
5537
|
);
|
5538
|
+
const [hasParent, setHasParent] = useState19(false);
|
5538
5539
|
useEffect16(() => {
|
5539
|
-
|
5540
|
-
|
5541
|
-
|
5542
|
-
|
5543
|
-
|
5544
|
-
|
5545
|
-
|
5546
|
-
|
5540
|
+
setHasParent(!!parent);
|
5541
|
+
}, [parent]);
|
5542
|
+
useEffect16(() => {
|
5543
|
+
var _a2;
|
5544
|
+
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || hasParent) {
|
5545
|
+
if (hasResolver) {
|
5546
|
+
setFieldsLoading(true);
|
5547
|
+
resolveFields(defaultFields).then((fields) => {
|
5548
|
+
setResolvedFields(fields || {});
|
5549
|
+
setFieldsLoading(false);
|
5550
|
+
});
|
5551
|
+
} else {
|
5552
|
+
setResolvedFields(defaultFields);
|
5553
|
+
}
|
5547
5554
|
}
|
5548
|
-
}, [
|
5555
|
+
}, [
|
5556
|
+
data,
|
5557
|
+
defaultFields,
|
5558
|
+
state.ui.itemSelector,
|
5559
|
+
selectedItem,
|
5560
|
+
hasResolver,
|
5561
|
+
hasParent
|
5562
|
+
]);
|
5549
5563
|
return [resolvedFields, fieldsLoading];
|
5550
5564
|
};
|
5551
5565
|
var Fields = () => {
|
package/package.json
CHANGED