@measured/puck 0.12.1-canary.15284aa → 0.12.1-canary.1c9a026

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -32470,7 +32470,8 @@ var ArrayField = ({
32470
32470
  items: Array.from(value || []).map((item, idx) => {
32471
32471
  return {
32472
32472
  _originalIndex: idx,
32473
- _arrayId: `${id}-${idx}`
32473
+ _arrayId: `${id}-${idx}`,
32474
+ data: item
32474
32475
  };
32475
32476
  }),
32476
32477
  openId: ""
@@ -32501,14 +32502,11 @@ var ArrayField = ({
32501
32502
  const newItems = Array.from(value2 || []).map((item, idx) => {
32502
32503
  var _a;
32503
32504
  const arrayStateItem = arrayState.items[idx];
32504
- const newItem = {
32505
- _originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex : highestIndex + 1,
32506
- _arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || `${id}-${highestIndex + 1}`
32505
+ return {
32506
+ _originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex : ++highestIndex,
32507
+ _arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || `${id}-${highestIndex}`,
32508
+ data: item
32507
32509
  };
32508
- if (newItem._originalIndex > highestIndex) {
32509
- highestIndex = newItem._originalIndex;
32510
- }
32511
- return newItem;
32512
32510
  });
32513
32511
  return __spreadProps(__spreadValues({}, arrayState), { items: newItems });
32514
32512
  },
@@ -32517,7 +32515,6 @@ var ArrayField = ({
32517
32515
  (0, import_react27.useEffect)(() => {
32518
32516
  setUi(mapArrayStateToUi(arrayState));
32519
32517
  }, []);
32520
- const [hovering, setHovering] = (0, import_react27.useState)(false);
32521
32518
  if (field.type !== "array" || !field.arrayFields) {
32522
32519
  return null;
32523
32520
  }
@@ -32564,14 +32561,6 @@ var ArrayField = ({
32564
32561
  isDraggingFrom: !!snapshot.draggingFromThisWith,
32565
32562
  hasItems: Array.isArray(value) && value.length > 0
32566
32563
  }),
32567
- onMouseOver: (e) => {
32568
- e.stopPropagation();
32569
- setHovering(true);
32570
- },
32571
- onMouseOut: (e) => {
32572
- e.stopPropagation();
32573
- setHovering(false);
32574
- },
32575
32564
  children: [
32576
32565
  localState.arrayState.items.map((item, i) => {
32577
32566
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
@@ -32586,7 +32575,7 @@ var ArrayField = ({
32586
32575
  isDragging: snapshot2 == null ? void 0 : snapshot2.isDragging,
32587
32576
  readOnly
32588
32577
  }),
32589
- isDragDisabled: readOnly || !hovering,
32578
+ isDragDisabled: readOnly,
32590
32579
  children: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
32591
32580
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
32592
32581
  "div",
@@ -32649,17 +32638,16 @@ var ArrayField = ({
32649
32638
  {
32650
32639
  name: subFieldName,
32651
32640
  label: subField.label || fieldName,
32652
- id: `${_arrayId}_${fieldName}`,
32641
+ id: `${id}_${fieldName}`,
32653
32642
  readOnly: typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName],
32654
32643
  readOnlyFields,
32655
32644
  field: subField,
32656
32645
  value: data[fieldName],
32657
- onChange: (val, ui) => {
32646
+ onChange: (val) => {
32658
32647
  onChange(
32659
32648
  replace(value, i, __spreadProps(__spreadValues({}, data), {
32660
32649
  [fieldName]: val
32661
- })),
32662
- ui
32650
+ }))
32663
32651
  );
32664
32652
  }
32665
32653
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.12.1-canary.15284aa",
3
+ "version": "0.12.1-canary.1c9a026",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",