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

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 +16 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -30139,7 +30139,11 @@ var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (optio
30139
30139
  modifiers = options;
30140
30140
  }
30141
30141
  if (descendant) {
30142
- return baseClass + styles[`${rootClass}-${descendant}`] || "";
30142
+ const style = styles[`${rootClass}-${descendant}`];
30143
+ if (style) {
30144
+ return baseClass + styles[`${rootClass}-${descendant}`] || "";
30145
+ }
30146
+ return "";
30143
30147
  } else if (modifiers) {
30144
30148
  const prefixedModifiers = {};
30145
30149
  for (let modifier in modifiers) {
@@ -30173,7 +30177,7 @@ var Button = ({
30173
30177
  size = "medium"
30174
30178
  }) => {
30175
30179
  const [loading, setLoading] = (0, import_react2.useState)(false);
30176
- const ElementType = href ? "a" : "button";
30180
+ const ElementType = href ? "a" : onClick ? "button" : "div";
30177
30181
  const el = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
30178
30182
  ElementType,
30179
30183
  {
@@ -32470,7 +32474,8 @@ var ArrayField = ({
32470
32474
  items: Array.from(value || []).map((item, idx) => {
32471
32475
  return {
32472
32476
  _originalIndex: idx,
32473
- _arrayId: `${id}-${idx}`
32477
+ _arrayId: `${id}-${idx}`,
32478
+ data: item
32474
32479
  };
32475
32480
  }),
32476
32481
  openId: ""
@@ -32501,14 +32506,11 @@ var ArrayField = ({
32501
32506
  const newItems = Array.from(value2 || []).map((item, idx) => {
32502
32507
  var _a;
32503
32508
  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}`
32509
+ return {
32510
+ _originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex : ++highestIndex,
32511
+ _arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || `${id}-${highestIndex}`,
32512
+ data: item
32507
32513
  };
32508
- if (newItem._originalIndex > highestIndex) {
32509
- highestIndex = newItem._originalIndex;
32510
- }
32511
- return newItem;
32512
32514
  });
32513
32515
  return __spreadProps(__spreadValues({}, arrayState), { items: newItems });
32514
32516
  },
@@ -32517,7 +32519,6 @@ var ArrayField = ({
32517
32519
  (0, import_react27.useEffect)(() => {
32518
32520
  setUi(mapArrayStateToUi(arrayState));
32519
32521
  }, []);
32520
- const [hovering, setHovering] = (0, import_react27.useState)(false);
32521
32522
  if (field.type !== "array" || !field.arrayFields) {
32522
32523
  return null;
32523
32524
  }
@@ -32564,14 +32565,6 @@ var ArrayField = ({
32564
32565
  isDraggingFrom: !!snapshot.draggingFromThisWith,
32565
32566
  hasItems: Array.isArray(value) && value.length > 0
32566
32567
  }),
32567
- onMouseOver: (e) => {
32568
- e.stopPropagation();
32569
- setHovering(true);
32570
- },
32571
- onMouseOut: (e) => {
32572
- e.stopPropagation();
32573
- setHovering(false);
32574
- },
32575
32568
  children: [
32576
32569
  localState.arrayState.items.map((item, i) => {
32577
32570
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
@@ -32586,7 +32579,7 @@ var ArrayField = ({
32586
32579
  isDragging: snapshot2 == null ? void 0 : snapshot2.isDragging,
32587
32580
  readOnly
32588
32581
  }),
32589
- isDragDisabled: readOnly || !hovering,
32582
+ isDragDisabled: readOnly,
32590
32583
  children: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
32591
32584
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
32592
32585
  "div",
@@ -32649,17 +32642,16 @@ var ArrayField = ({
32649
32642
  {
32650
32643
  name: subFieldName,
32651
32644
  label: subField.label || fieldName,
32652
- id: `${_arrayId}_${fieldName}`,
32645
+ id: `${id}_${fieldName}`,
32653
32646
  readOnly: typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName],
32654
32647
  readOnlyFields,
32655
32648
  field: subField,
32656
32649
  value: data[fieldName],
32657
- onChange: (val, ui) => {
32650
+ onChange: (val) => {
32658
32651
  onChange(
32659
32652
  replace(value, i, __spreadProps(__spreadValues({}, data), {
32660
32653
  [fieldName]: val
32661
- })),
32662
- ui
32654
+ }))
32663
32655
  );
32664
32656
  }
32665
32657
  },
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.1a223ad",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",