@measured/puck 0.16.3-canary.af421c6 → 0.17.0-canary.00ccd1d

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.mjs CHANGED
@@ -178,14 +178,13 @@ init_react_import();
178
178
 
179
179
  // css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
180
180
  init_react_import();
181
- var styles_module_default2 = { "Input": "_Input_3pq3z_1", "Input-label": "_Input-label_3pq3z_26", "Input-labelIcon": "_Input-labelIcon_3pq3z_35", "Input-disabledIcon": "_Input-disabledIcon_3pq3z_42", "Input-input": "_Input-input_3pq3z_47", "Input--readOnly": "_Input--readOnly_3pq3z_91", "Input-radioGroupItems": "_Input-radioGroupItems_3pq3z_102", "Input-radio": "_Input-radio_3pq3z_102", "Input-radioInner": "_Input-radioInner_3pq3z_119", "Input-radioInput": "_Input-radioInput_3pq3z_164" };
181
+ var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input": "_Input_1l5m8_1", "Input-label": "_Input-label_1l5m8_26", "Input-labelIcon": "_Input-labelIcon_1l5m8_35", "Input-disabledIcon": "_Input-disabledIcon_1l5m8_42", "Input-input": "_Input-input_1l5m8_47", "Input--readOnly": "_Input--readOnly_1l5m8_91", "Input-radioGroupItems": "_Input-radioGroupItems_1l5m8_102", "Input-radio": "_Input-radio_1l5m8_102", "Input-radioInner": "_Input-radioInner_1l5m8_119", "Input-radioInput": "_Input-radioInput_1l5m8_164" };
182
182
 
183
183
  // components/AutoField/index.tsx
184
184
  import {
185
185
  useCallback as useCallback5,
186
186
  useEffect as useEffect9,
187
187
  useMemo as useMemo2,
188
- useRef as useRef2,
189
188
  useState as useState10
190
189
  } from "react";
191
190
 
@@ -880,7 +879,8 @@ var defaultAppState = {
880
879
  },
881
880
  options: [],
882
881
  controlsVisible: true
883
- }
882
+ },
883
+ field: { focus: null }
884
884
  }
885
885
  };
886
886
  var defaultContext = {
@@ -1228,11 +1228,13 @@ var ArrayField = ({
1228
1228
  event.source.index,
1229
1229
  (_b = event.destination) == null ? void 0 : _b.index
1230
1230
  );
1231
- onChange(newValue, {
1231
+ const newUi = {
1232
1232
  arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
1233
1233
  [id]: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
1234
1234
  })
1235
- });
1235
+ };
1236
+ setUi(newUi, false);
1237
+ onChange(newValue, newUi);
1236
1238
  setLocalState({
1237
1239
  value: newValue,
1238
1240
  arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
@@ -1298,32 +1300,60 @@ var ArrayField = ({
1298
1300
  children: [
1299
1301
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
1300
1302
  /* @__PURE__ */ jsxs4("div", { className: getClassNameItem("rhs"), children: [
1301
- !readOnly && /* @__PURE__ */ jsx9("div", { className: getClassNameItem("actions"), children: /* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
1302
- IconButton,
1303
- {
1304
- type: "button",
1305
- disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
1306
- onClick: (e) => {
1307
- e.stopPropagation();
1308
- const existingValue = [
1309
- ...value || []
1310
- ];
1311
- const existingItems = [
1312
- ...arrayState.items || []
1313
- ];
1314
- existingValue.splice(i, 1);
1315
- existingItems.splice(i, 1);
1316
- onChange(
1317
- existingValue,
1318
- mapArrayStateToUi({
1319
- items: existingItems
1320
- })
1321
- );
1322
- },
1323
- title: "Delete",
1324
- children: /* @__PURE__ */ jsx9(Trash, { size: 16 })
1325
- }
1326
- ) }) }),
1303
+ !readOnly && /* @__PURE__ */ jsxs4("div", { className: getClassNameItem("actions"), children: [
1304
+ /* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
1305
+ IconButton,
1306
+ {
1307
+ type: "button",
1308
+ disabled: !!addDisabled,
1309
+ onClick: (e) => {
1310
+ e.stopPropagation();
1311
+ const existingValue = [
1312
+ ...value || []
1313
+ ];
1314
+ existingValue.splice(
1315
+ i,
1316
+ 0,
1317
+ existingValue[i]
1318
+ );
1319
+ onChange(
1320
+ existingValue,
1321
+ mapArrayStateToUi(
1322
+ regenerateArrayState(existingValue)
1323
+ )
1324
+ );
1325
+ },
1326
+ title: "Duplicate",
1327
+ children: /* @__PURE__ */ jsx9(Copy, { size: 16 })
1328
+ }
1329
+ ) }),
1330
+ /* @__PURE__ */ jsx9("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx9(
1331
+ IconButton,
1332
+ {
1333
+ type: "button",
1334
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
1335
+ onClick: (e) => {
1336
+ e.stopPropagation();
1337
+ const existingValue = [
1338
+ ...value || []
1339
+ ];
1340
+ const existingItems = [
1341
+ ...arrayState.items || []
1342
+ ];
1343
+ existingValue.splice(i, 1);
1344
+ existingItems.splice(i, 1);
1345
+ onChange(
1346
+ existingValue,
1347
+ mapArrayStateToUi({
1348
+ items: existingItems
1349
+ })
1350
+ );
1351
+ },
1352
+ title: "Delete",
1353
+ children: /* @__PURE__ */ jsx9(Trash, { size: 16 })
1354
+ }
1355
+ ) })
1356
+ ] }),
1327
1357
  /* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9(DragIcon, {}) })
1328
1358
  ] })
1329
1359
  ]
@@ -1419,8 +1449,9 @@ var DefaultField = ({
1419
1449
  className: getClassName6("input"),
1420
1450
  autoComplete: "off",
1421
1451
  type: field.type,
1452
+ title: label || name,
1422
1453
  name,
1423
- value: typeof value === "undefined" ? "" : value,
1454
+ value: typeof value === "undefined" ? "" : value.toString(),
1424
1455
  onChange: (e) => {
1425
1456
  if (field.type === "number") {
1426
1457
  onChange(Number(e.currentTarget.value));
@@ -1445,11 +1476,17 @@ import { useEffect as useEffect8 } from "react";
1445
1476
 
1446
1477
  // components/ExternalInput/index.tsx
1447
1478
  init_react_import();
1448
- import { useMemo, useEffect as useEffect7, useState as useState8, useCallback as useCallback4 } from "react";
1479
+ import {
1480
+ useMemo,
1481
+ useEffect as useEffect7,
1482
+ useState as useState8,
1483
+ useCallback as useCallback4,
1484
+ isValidElement
1485
+ } from "react";
1449
1486
 
1450
1487
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
1451
1488
  init_react_import();
1452
- var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_wprq3_1", "ExternalInput-button": "_ExternalInput-button_wprq3_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_wprq3_24", "ExternalInput--readOnly": "_ExternalInput--readOnly_wprq3_31", "ExternalInput-detachButton": "_ExternalInput-detachButton_wprq3_35", "ExternalInput": "_ExternalInput_wprq3_1", "ExternalInputModal": "_ExternalInputModal_wprq3_79", "ExternalInputModal-grid": "_ExternalInputModal-grid_wprq3_89", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_wprq3_100", "ExternalInputModal-filters": "_ExternalInputModal-filters_wprq3_105", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_wprq3_124", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_wprq3_133", "ExternalInputModal-table": "_ExternalInputModal-table_wprq3_133", "ExternalInputModal-thead": "_ExternalInputModal-thead_wprq3_149", "ExternalInputModal-th": "_ExternalInputModal-th_wprq3_149", "ExternalInputModal-td": "_ExternalInputModal-td_wprq3_164", "ExternalInputModal-tr": "_ExternalInputModal-tr_wprq3_169", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_wprq3_176", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_wprq3_202", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_wprq3_206", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_wprq3_223", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_wprq3_227", "ExternalInputModal-search": "_ExternalInputModal-search_wprq3_227", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_wprq3_264", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_wprq3_289", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_wprq3_299", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_wprq3_313", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_wprq3_326", "ExternalInputModal-footer": "_ExternalInputModal-footer_wprq3_330" };
1489
+ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_8wgzm_1", "ExternalInput-button": "_ExternalInput-button_8wgzm_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_8wgzm_24", "ExternalInput--readOnly": "_ExternalInput--readOnly_8wgzm_31", "ExternalInput-detachButton": "_ExternalInput-detachButton_8wgzm_35", "ExternalInput": "_ExternalInput_8wgzm_1", "ExternalInputModal": "_ExternalInputModal_8wgzm_79", "ExternalInputModal-grid": "_ExternalInputModal-grid_8wgzm_89", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_8wgzm_100", "ExternalInputModal-filters": "_ExternalInputModal-filters_8wgzm_105", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_8wgzm_124", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_8wgzm_133", "ExternalInputModal-table": "_ExternalInputModal-table_8wgzm_133", "ExternalInputModal-thead": "_ExternalInputModal-thead_8wgzm_149", "ExternalInputModal-th": "_ExternalInputModal-th_8wgzm_149", "ExternalInputModal-td": "_ExternalInputModal-td_8wgzm_164", "ExternalInputModal-tr": "_ExternalInputModal-tr_8wgzm_169", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_8wgzm_176", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_8wgzm_202", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_8wgzm_206", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_8wgzm_223", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_8wgzm_227", "ExternalInputModal-search": "_ExternalInputModal-search_8wgzm_227", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_8wgzm_264", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_8wgzm_289", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_8wgzm_299", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_8wgzm_313", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_8wgzm_326", "ExternalInputModal-footerContainer": "_ExternalInputModal-footerContainer_8wgzm_330", "ExternalInputModal-footer": "_ExternalInputModal-footer_8wgzm_330" };
1453
1490
 
1454
1491
  // components/Modal/index.tsx
1455
1492
  init_react_import();
@@ -1606,7 +1643,7 @@ var ExternalInput = ({
1606
1643
  const validKeys = /* @__PURE__ */ new Set();
1607
1644
  for (const item of mappedData) {
1608
1645
  for (const key of Object.keys(item)) {
1609
- if (typeof item[key] === "string" || typeof item[key] === "number") {
1646
+ if (typeof item[key] === "string" || typeof item[key] === "number" || isValidElement(item[key])) {
1610
1647
  validKeys.add(key);
1611
1648
  }
1612
1649
  }
@@ -1627,6 +1664,14 @@ var ExternalInput = ({
1627
1664
  }),
1628
1665
  [id, field]
1629
1666
  );
1667
+ const Footer = useCallback4(
1668
+ (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ jsxs7("span", { className: getClassNameModal("footer"), children: [
1669
+ props.items.length,
1670
+ " result",
1671
+ props.items.length === 1 ? "" : "s"
1672
+ ] }),
1673
+ [field.renderFooter]
1674
+ );
1630
1675
  useEffect7(() => {
1631
1676
  search(searchQuery, filters);
1632
1677
  }, []);
@@ -1766,11 +1811,7 @@ var ExternalInput = ({
1766
1811
  /* @__PURE__ */ jsx14("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx14(Loader, { size: 24 }) })
1767
1812
  ] })
1768
1813
  ] }),
1769
- /* @__PURE__ */ jsxs7("div", { className: getClassNameModal("footer"), children: [
1770
- mappedData.length,
1771
- " result",
1772
- mappedData.length === 1 ? "" : "s"
1773
- ] })
1814
+ /* @__PURE__ */ jsx14("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx14(Footer, { items: mappedData }) })
1774
1815
  ]
1775
1816
  }
1776
1817
  ) })
@@ -1829,6 +1870,19 @@ var ExternalField = ({
1829
1870
 
1830
1871
  // components/AutoField/fields/RadioField/index.tsx
1831
1872
  init_react_import();
1873
+
1874
+ // lib/safe-json-parse.ts
1875
+ init_react_import();
1876
+ var safeJsonParse = (str) => {
1877
+ try {
1878
+ const jsonValue = JSON.parse(str);
1879
+ return jsonValue;
1880
+ } catch (e) {
1881
+ return str;
1882
+ }
1883
+ };
1884
+
1885
+ // components/AutoField/fields/RadioField/index.tsx
1832
1886
  import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
1833
1887
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
1834
1888
  var RadioField = ({
@@ -1863,13 +1917,7 @@ var RadioField = ({
1863
1917
  className: getClassName11("radioInput"),
1864
1918
  value: option.value,
1865
1919
  name,
1866
- onChange: (e) => {
1867
- if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
1868
- onChange(JSON.parse(e.currentTarget.value));
1869
- return;
1870
- }
1871
- onChange(e.currentTarget.value);
1872
- },
1920
+ onChange: ({ target: { value: value2 } }) => onChange(safeJsonParse(value2) || value2),
1873
1921
  disabled: readOnly,
1874
1922
  checked: value === option.value
1875
1923
  }
@@ -1910,15 +1958,10 @@ var SelectField = ({
1910
1958
  "select",
1911
1959
  {
1912
1960
  id,
1961
+ title: label || name,
1913
1962
  className: getClassName12("input"),
1914
1963
  disabled: readOnly,
1915
- onChange: (e) => {
1916
- if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
1917
- onChange(JSON.parse(e.currentTarget.value));
1918
- return;
1919
- }
1920
- onChange(e.currentTarget.value);
1921
- },
1964
+ onChange: ({ target: { value: value2 } }) => onChange(safeJsonParse(value2) || value2),
1922
1965
  value,
1923
1966
  children: field.options.map((option) => /* @__PURE__ */ jsx17(
1924
1967
  "option",
@@ -2050,6 +2093,7 @@ var useSafeId = () => {
2050
2093
  // components/AutoField/index.tsx
2051
2094
  import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
2052
2095
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
2096
+ var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
2053
2097
  var FieldLabel = ({
2054
2098
  children,
2055
2099
  icon,
@@ -2097,7 +2141,7 @@ var FieldLabelInternal2 = ({
2097
2141
  };
2098
2142
  function AutoFieldInternal(props) {
2099
2143
  var _a, _b, _c, _d, _e, _f, _g, _h;
2100
- const { overrides } = useAppContext();
2144
+ const { dispatch, overrides } = useAppContext();
2101
2145
  const { id, Label = FieldLabelInternal2 } = props;
2102
2146
  const field = props.field;
2103
2147
  const label = field.label;
@@ -2129,23 +2173,45 @@ function AutoFieldInternal(props) {
2129
2173
  Label,
2130
2174
  id: resolvedId
2131
2175
  });
2176
+ const onFocus = useCallback5(
2177
+ (e) => {
2178
+ if (mergedProps.name && e.target.nodeName === "INPUT") {
2179
+ e.stopPropagation();
2180
+ dispatch({
2181
+ type: "setUi",
2182
+ ui: {
2183
+ field: { focus: mergedProps.name }
2184
+ }
2185
+ });
2186
+ }
2187
+ },
2188
+ [mergedProps.name]
2189
+ );
2190
+ const onBlur = useCallback5((e) => {
2191
+ if ("name" in e.target) {
2192
+ dispatch({
2193
+ type: "setUi",
2194
+ ui: {
2195
+ field: { focus: null }
2196
+ }
2197
+ });
2198
+ }
2199
+ }, []);
2132
2200
  if (field.type === "custom") {
2133
2201
  if (!field.render) {
2134
2202
  return null;
2135
2203
  }
2136
2204
  const CustomField = field.render;
2137
- return /* @__PURE__ */ jsx20("div", { className: getClassName15(), children: /* @__PURE__ */ jsx20(CustomField, __spreadValues({}, mergedProps)) });
2205
+ return /* @__PURE__ */ jsx20("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx20("div", { className: getClassName15(), children: /* @__PURE__ */ jsx20(CustomField, __spreadValues({}, mergedProps)) }) });
2138
2206
  }
2139
2207
  const children = defaultFields[field.type](mergedProps);
2140
2208
  const Render2 = render[field.type];
2141
- return /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
2209
+ return /* @__PURE__ */ jsx20("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children })) });
2142
2210
  }
2143
- var RECENT_CHANGE_TIMEOUT = 200;
2144
2211
  function AutoFieldPrivate(props) {
2212
+ const { state } = useAppContext();
2145
2213
  const { value, onChange } = props;
2146
2214
  const [localValue, setLocalValue] = useState10(value);
2147
- const [recentlyChanged, setRecentlyChanged] = useState10(false);
2148
- const timeoutRef = useRef2();
2149
2215
  const onChangeDb = useDebouncedCallback(
2150
2216
  (val, ui) => {
2151
2217
  onChange(val, ui);
@@ -2155,15 +2221,10 @@ function AutoFieldPrivate(props) {
2155
2221
  );
2156
2222
  const onChangeLocal = useCallback5((val, ui) => {
2157
2223
  setLocalValue(val);
2158
- setRecentlyChanged(true);
2159
- clearTimeout(timeoutRef.current);
2160
- timeoutRef.current = setTimeout(() => {
2161
- setRecentlyChanged(false);
2162
- }, RECENT_CHANGE_TIMEOUT);
2163
2224
  onChangeDb(val, ui);
2164
2225
  }, []);
2165
2226
  useEffect9(() => {
2166
- if (!recentlyChanged) {
2227
+ if (state.ui.field.focus !== props.name) {
2167
2228
  setLocalValue(value);
2168
2229
  }
2169
2230
  }, [value]);
@@ -3514,6 +3575,22 @@ var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields
3514
3575
 
3515
3576
  // components/Puck/components/Fields/index.tsx
3516
3577
  import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo6, useState as useState15 } from "react";
3578
+
3579
+ // lib/use-parent.ts
3580
+ init_react_import();
3581
+ import { useContext as useContext5 } from "react";
3582
+ var useParent = (itemSelector) => {
3583
+ var _a;
3584
+ const { selectedItem, state } = useAppContext();
3585
+ const { pathData } = useContext5(dropZoneContext) || {};
3586
+ const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
3587
+ const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
3588
+ const lastItem = breadcrumbs[breadcrumbs.length - 1];
3589
+ const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, state.data)) != null ? _a : null : null;
3590
+ return parent || null;
3591
+ };
3592
+
3593
+ // components/Puck/components/Fields/index.tsx
3517
3594
  import { Fragment as Fragment12, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
3518
3595
  var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
3519
3596
  var defaultPageFields = {
@@ -3527,6 +3604,7 @@ var DefaultFields = ({
3527
3604
  var useResolvedFields = () => {
3528
3605
  var _a, _b;
3529
3606
  const { selectedItem, state, config } = useAppContext();
3607
+ const parent = useParent();
3530
3608
  const { data } = state;
3531
3609
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
3532
3610
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
@@ -3557,7 +3635,8 @@ var useResolvedFields = () => {
3557
3635
  fields,
3558
3636
  lastFields: resolvedFields,
3559
3637
  lastData,
3560
- appState: state
3638
+ appState: state,
3639
+ parent
3561
3640
  }
3562
3641
  );
3563
3642
  }
@@ -3567,7 +3646,8 @@ var useResolvedFields = () => {
3567
3646
  fields,
3568
3647
  lastFields: resolvedFields,
3569
3648
  lastData,
3570
- appState: state
3649
+ appState: state,
3650
+ parent
3571
3651
  });
3572
3652
  }
3573
3653
  return defaultResolveFields(componentData, {
@@ -3589,7 +3669,7 @@ var useResolvedFields = () => {
3589
3669
  } else {
3590
3670
  setResolvedFields(defaultFields);
3591
3671
  }
3592
- }, [data, defaultFields, state.ui.itemSelector, hasResolver]);
3672
+ }, [data, defaultFields, selectedItem, hasResolver]);
3593
3673
  return [resolvedFields, fieldsLoading];
3594
3674
  };
3595
3675
  var Fields = () => {
@@ -3896,7 +3976,7 @@ import { useCallback as useCallback8, useMemo as useMemo8 } from "react";
3896
3976
  init_react_import();
3897
3977
  import {
3898
3978
  createContext as createContext4,
3899
- useContext as useContext5,
3979
+ useContext as useContext6,
3900
3980
  useEffect as useEffect15,
3901
3981
  useRef as useRef3,
3902
3982
  useState as useState17
@@ -4106,7 +4186,7 @@ var CopyHostStyles = ({
4106
4186
  return /* @__PURE__ */ jsx31(Fragment13, { children });
4107
4187
  };
4108
4188
  var autoFrameContext = createContext4({});
4109
- var useFrame = () => useContext5(autoFrameContext);
4189
+ var useFrame = () => useContext6(autoFrameContext);
4110
4190
  function AutoFrame(_a) {
4111
4191
  var _b = _a, {
4112
4192
  children,
@@ -4259,7 +4339,7 @@ var scrollIntoView = (el) => {
4259
4339
  };
4260
4340
 
4261
4341
  // components/LayerTree/index.tsx
4262
- import { useContext as useContext6 } from "react";
4342
+ import { useContext as useContext7 } from "react";
4263
4343
 
4264
4344
  // lib/is-child-of-zone.ts
4265
4345
  init_react_import();
@@ -4286,7 +4366,7 @@ var LayerTree = ({
4286
4366
  label
4287
4367
  }) => {
4288
4368
  const zones = data.zones || {};
4289
- const ctx = useContext6(dropZoneContext);
4369
+ const ctx = useContext7(dropZoneContext);
4290
4370
  return /* @__PURE__ */ jsxs17(Fragment15, { children: [
4291
4371
  label && /* @__PURE__ */ jsxs17("div", { className: getClassName24("zoneTitle"), children: [
4292
4372
  /* @__PURE__ */ jsx33("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
@@ -91,9 +91,12 @@ type ExternalField<Props extends {
91
91
  filters: Record<string, any>;
92
92
  }) => Promise<any[] | null>;
93
93
  mapProp?: (value: any) => Props;
94
- mapRow?: (value: any) => Record<string, string | number>;
94
+ mapRow?: (value: any) => Record<string, string | number | ReactElement>;
95
95
  getItemSummary?: (item: Props, index?: number) => string;
96
96
  showSearch?: boolean;
97
+ renderFooter?: (props: {
98
+ items: any[];
99
+ }) => ReactElement;
97
100
  initialQuery?: string;
98
101
  filterFields?: Record<string, Field>;
99
102
  initialFilters?: Record<string, any>;
@@ -142,6 +145,7 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
142
145
  lastFields: Fields<FieldProps>;
143
146
  lastData: DataShape | null;
144
147
  appState: AppState;
148
+ parent: ComponentData | null;
145
149
  }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
146
150
  resolveData?: (data: DataShape, params: {
147
151
  changed: Partial<Record<keyof FieldProps, boolean>>;
@@ -271,6 +275,9 @@ type UiState = {
271
275
  controlsVisible: boolean;
272
276
  options: Viewport[];
273
277
  };
278
+ field: {
279
+ focus?: string | null;
280
+ };
274
281
  };
275
282
  type AppState<UserData extends Data = Data> = {
276
283
  data: UserData;
@@ -91,9 +91,12 @@ type ExternalField<Props extends {
91
91
  filters: Record<string, any>;
92
92
  }) => Promise<any[] | null>;
93
93
  mapProp?: (value: any) => Props;
94
- mapRow?: (value: any) => Record<string, string | number>;
94
+ mapRow?: (value: any) => Record<string, string | number | ReactElement>;
95
95
  getItemSummary?: (item: Props, index?: number) => string;
96
96
  showSearch?: boolean;
97
+ renderFooter?: (props: {
98
+ items: any[];
99
+ }) => ReactElement;
97
100
  initialQuery?: string;
98
101
  filterFields?: Record<string, Field>;
99
102
  initialFilters?: Record<string, any>;
@@ -142,6 +145,7 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
142
145
  lastFields: Fields<FieldProps>;
143
146
  lastData: DataShape | null;
144
147
  appState: AppState;
148
+ parent: ComponentData | null;
145
149
  }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
146
150
  resolveData?: (data: DataShape, params: {
147
151
  changed: Partial<Record<keyof FieldProps, boolean>>;
@@ -271,6 +275,9 @@ type UiState = {
271
275
  controlsVisible: boolean;
272
276
  options: Viewport[];
273
277
  };
278
+ field: {
279
+ focus?: string | null;
280
+ };
274
281
  };
275
282
  type AppState<UserData extends Data = Data> = {
276
283
  data: UserData;
package/dist/rsc.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, D as Data } from './resolve-all-data-BoWgijLi.mjs';
3
- export { a4 as resolveAllData } from './resolve-all-data-BoWgijLi.mjs';
2
+ import { C as Config, D as Data } from './resolve-all-data-C7aAQCY3.mjs';
3
+ export { a4 as resolveAllData } from './resolve-all-data-C7aAQCY3.mjs';
4
4
  import 'react';
5
5
 
6
6
  declare function Render<UserConfig extends Config = Config>({ config, data, }: {
package/dist/rsc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, D as Data } from './resolve-all-data-BoWgijLi.js';
3
- export { a4 as resolveAllData } from './resolve-all-data-BoWgijLi.js';
2
+ import { C as Config, D as Data } from './resolve-all-data-C7aAQCY3.js';
3
+ export { a4 as resolveAllData } from './resolve-all-data-C7aAQCY3.js';
4
4
  import 'react';
5
5
 
6
6
  declare function Render<UserConfig extends Config = Config>({ config, data, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.16.3-canary.af421c6",
3
+ "version": "0.17.0-canary.00ccd1d",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",