@measured/puck-plugin-heading-analyzer 0.14.0-canary.b365418 → 0.14.0-canary.ca6bd5f

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.ts CHANGED
@@ -43,6 +43,8 @@ type ArrayField<Props extends {
43
43
  };
44
44
  defaultItemProps?: Props[0];
45
45
  getItemSummary?: (item: Props[0], index?: number) => string;
46
+ max?: number;
47
+ min?: number;
46
48
  };
47
49
  type ObjectField<Props extends {
48
50
  [key: string]: any;
@@ -145,7 +147,7 @@ type RenderFunc<Props extends {
145
147
  [key: string]: any;
146
148
  } = {
147
149
  children: ReactNode;
148
- }> = React.FunctionComponent<Props>;
150
+ }> = (props: Props) => ReactElement;
149
151
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
150
152
  type OverrideKey = (typeof overrideKeys)[number];
151
153
  type OverridesGeneric<Shape extends {
@@ -175,7 +177,10 @@ type Overrides = OverridesGeneric<{
175
177
  className?: string;
176
178
  }>;
177
179
  components: RenderFunc;
178
- componentItem: RenderFunc;
180
+ componentItem: RenderFunc<{
181
+ children: ReactNode;
182
+ name: string;
183
+ }>;
179
184
  outline: RenderFunc;
180
185
  puck: RenderFunc;
181
186
  }>;
package/dist/index.js CHANGED
@@ -71223,10 +71223,10 @@ var require_dist = __commonJS({
71223
71223
  const ctx = (0, import_react32.useContext)(drawerContext);
71224
71224
  const resolvedId = `${ctx.droppableId}::${id || name}`;
71225
71225
  const CustomInner = (0, import_react32.useMemo)(
71226
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
71226
+ () => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
71227
71227
  [children]
71228
71228
  );
71229
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CustomInner, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
71229
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
71230
71230
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("name"), children: name }),
71231
71231
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DragIcon, {}) })
71232
71232
  ] }) }) }) });
@@ -72703,7 +72703,10 @@ var require_dist = __commonJS({
72703
72703
  );
72704
72704
  const runResolvers = () => __async(void 0, null, function* () {
72705
72705
  const newData = newAppState.data;
72706
- const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => !!config.components[item.type].resolveData);
72706
+ const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
72707
+ var _a;
72708
+ return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
72709
+ });
72707
72710
  const applyIfChange = (dynamicDataMap, dynamicRoot) => {
72708
72711
  const processed = applyDynamicProps(
72709
72712
  appState.data,
@@ -73011,6 +73014,7 @@ var require_dist = __commonJS({
73011
73014
  !readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem22("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem22("action"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
73012
73015
  IconButton,
73013
73016
  {
73017
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
73014
73018
  onClick: (e2) => {
73015
73019
  e2.stopPropagation();
73016
73020
  const existingValue = [
@@ -73075,6 +73079,7 @@ var require_dist = __commonJS({
73075
73079
  "button",
73076
73080
  {
73077
73081
  className: getClassName10("addButton"),
73082
+ disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
73078
73083
  onClick: () => {
73079
73084
  const existingValue = value || [];
73080
73085
  const newValue = [
@@ -73084,7 +73089,7 @@ var require_dist = __commonJS({
73084
73089
  const newArrayState = regenerateArrayState(newValue);
73085
73090
  onChange(newValue, mapArrayStateToUi(newArrayState));
73086
73091
  },
73087
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: "21" })
73092
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: 21 })
73088
73093
  }
73089
73094
  )
73090
73095
  ]
@@ -74799,8 +74804,8 @@ var require_dist = __commonJS({
74799
74804
  });
74800
74805
  init_react_import2();
74801
74806
  var usePuck2 = () => {
74802
- const { state: appState, config, dispatch } = useAppContext2();
74803
- return { appState, config, dispatch };
74807
+ const { state: appState, config, history, dispatch } = useAppContext2();
74808
+ return { appState, config, dispatch, history };
74804
74809
  };
74805
74810
  }
74806
74811
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.14.0-canary.b365418",
3
+ "version": "0.14.0-canary.ca6bd5f",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -18,7 +18,7 @@
18
18
  "dist"
19
19
  ],
20
20
  "devDependencies": {
21
- "@measured/puck": "^0.14.0-canary.b365418",
21
+ "@measured/puck": "^0.14.0-canary.ca6bd5f",
22
22
  "@types/react": "^18.2.0",
23
23
  "@types/react-dom": "^18.2.0",
24
24
  "eslint": "^7.32.0",