@measured/puck 0.17.0-canary.8ea38c3 → 0.17.0-canary.f71da6d

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
  ]
@@ -1455,7 +1485,7 @@ import {
1455
1485
 
1456
1486
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
1457
1487
  init_react_import();
1458
- 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" };
1488
+ 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" };
1459
1489
 
1460
1490
  // components/Modal/index.tsx
1461
1491
  init_react_import();
@@ -1633,6 +1663,14 @@ var ExternalInput = ({
1633
1663
  }),
1634
1664
  [id, field]
1635
1665
  );
1666
+ const Footer = useCallback4(
1667
+ (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ jsxs7("span", { className: getClassNameModal("footer"), children: [
1668
+ props.items.length,
1669
+ " result",
1670
+ props.items.length === 1 ? "" : "s"
1671
+ ] }),
1672
+ [field.renderFooter]
1673
+ );
1636
1674
  useEffect7(() => {
1637
1675
  search(searchQuery, filters);
1638
1676
  }, []);
@@ -1772,11 +1810,7 @@ var ExternalInput = ({
1772
1810
  /* @__PURE__ */ jsx14("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx14(Loader, { size: 24 }) })
1773
1811
  ] })
1774
1812
  ] }),
1775
- /* @__PURE__ */ jsxs7("div", { className: getClassNameModal("footer"), children: [
1776
- mappedData.length,
1777
- " result",
1778
- mappedData.length === 1 ? "" : "s"
1779
- ] })
1813
+ /* @__PURE__ */ jsx14("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx14(Footer, { items: mappedData }) })
1780
1814
  ]
1781
1815
  }
1782
1816
  ) })
@@ -2056,6 +2090,7 @@ var useSafeId = () => {
2056
2090
  // components/AutoField/index.tsx
2057
2091
  import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
2058
2092
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
2093
+ var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
2059
2094
  var FieldLabel = ({
2060
2095
  children,
2061
2096
  icon,
@@ -2103,7 +2138,7 @@ var FieldLabelInternal2 = ({
2103
2138
  };
2104
2139
  function AutoFieldInternal(props) {
2105
2140
  var _a, _b, _c, _d, _e, _f, _g, _h;
2106
- const { overrides } = useAppContext();
2141
+ const { dispatch, overrides } = useAppContext();
2107
2142
  const { id, Label = FieldLabelInternal2 } = props;
2108
2143
  const field = props.field;
2109
2144
  const label = field.label;
@@ -2135,23 +2170,45 @@ function AutoFieldInternal(props) {
2135
2170
  Label,
2136
2171
  id: resolvedId
2137
2172
  });
2173
+ const onFocus = useCallback5(
2174
+ (e) => {
2175
+ if (mergedProps.name && e.target.nodeName === "INPUT") {
2176
+ e.stopPropagation();
2177
+ dispatch({
2178
+ type: "setUi",
2179
+ ui: {
2180
+ field: { focus: mergedProps.name }
2181
+ }
2182
+ });
2183
+ }
2184
+ },
2185
+ [mergedProps.name]
2186
+ );
2187
+ const onBlur = useCallback5((e) => {
2188
+ if ("name" in e.target) {
2189
+ dispatch({
2190
+ type: "setUi",
2191
+ ui: {
2192
+ field: { focus: null }
2193
+ }
2194
+ });
2195
+ }
2196
+ }, []);
2138
2197
  if (field.type === "custom") {
2139
2198
  if (!field.render) {
2140
2199
  return null;
2141
2200
  }
2142
2201
  const CustomField = field.render;
2143
- return /* @__PURE__ */ jsx20("div", { className: getClassName15(), children: /* @__PURE__ */ jsx20(CustomField, __spreadValues({}, mergedProps)) });
2202
+ return /* @__PURE__ */ jsx20("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx20("div", { className: getClassName15(), children: /* @__PURE__ */ jsx20(CustomField, __spreadValues({}, mergedProps)) }) });
2144
2203
  }
2145
2204
  const children = defaultFields[field.type](mergedProps);
2146
2205
  const Render2 = render[field.type];
2147
- return /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
2206
+ return /* @__PURE__ */ jsx20("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children })) });
2148
2207
  }
2149
- var RECENT_CHANGE_TIMEOUT = 200;
2150
2208
  function AutoFieldPrivate(props) {
2209
+ const { state } = useAppContext();
2151
2210
  const { value, onChange } = props;
2152
2211
  const [localValue, setLocalValue] = useState10(value);
2153
- const [recentlyChanged, setRecentlyChanged] = useState10(false);
2154
- const timeoutRef = useRef2();
2155
2212
  const onChangeDb = useDebouncedCallback(
2156
2213
  (val, ui) => {
2157
2214
  onChange(val, ui);
@@ -2161,15 +2218,10 @@ function AutoFieldPrivate(props) {
2161
2218
  );
2162
2219
  const onChangeLocal = useCallback5((val, ui) => {
2163
2220
  setLocalValue(val);
2164
- setRecentlyChanged(true);
2165
- clearTimeout(timeoutRef.current);
2166
- timeoutRef.current = setTimeout(() => {
2167
- setRecentlyChanged(false);
2168
- }, RECENT_CHANGE_TIMEOUT);
2169
2221
  onChangeDb(val, ui);
2170
2222
  }, []);
2171
2223
  useEffect9(() => {
2172
- if (!recentlyChanged) {
2224
+ if (state.ui.field.focus !== props.name) {
2173
2225
  setLocalValue(value);
2174
2226
  }
2175
2227
  }, [value]);
@@ -3520,6 +3572,22 @@ var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields
3520
3572
 
3521
3573
  // components/Puck/components/Fields/index.tsx
3522
3574
  import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo6, useState as useState15 } from "react";
3575
+
3576
+ // lib/use-parent.ts
3577
+ init_react_import();
3578
+ import { useContext as useContext5 } from "react";
3579
+ var useParent = (itemSelector) => {
3580
+ var _a;
3581
+ const { selectedItem, state } = useAppContext();
3582
+ const { pathData } = useContext5(dropZoneContext) || {};
3583
+ const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
3584
+ const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
3585
+ const lastItem = breadcrumbs[breadcrumbs.length - 1];
3586
+ const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, state.data)) != null ? _a : null : null;
3587
+ return parent || null;
3588
+ };
3589
+
3590
+ // components/Puck/components/Fields/index.tsx
3523
3591
  import { Fragment as Fragment12, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
3524
3592
  var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
3525
3593
  var defaultPageFields = {
@@ -3533,6 +3601,7 @@ var DefaultFields = ({
3533
3601
  var useResolvedFields = () => {
3534
3602
  var _a, _b;
3535
3603
  const { selectedItem, state, config } = useAppContext();
3604
+ const parent = useParent();
3536
3605
  const { data } = state;
3537
3606
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
3538
3607
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
@@ -3563,7 +3632,8 @@ var useResolvedFields = () => {
3563
3632
  fields,
3564
3633
  lastFields: resolvedFields,
3565
3634
  lastData,
3566
- appState: state
3635
+ appState: state,
3636
+ parent
3567
3637
  }
3568
3638
  );
3569
3639
  }
@@ -3573,7 +3643,8 @@ var useResolvedFields = () => {
3573
3643
  fields,
3574
3644
  lastFields: resolvedFields,
3575
3645
  lastData,
3576
- appState: state
3646
+ appState: state,
3647
+ parent
3577
3648
  });
3578
3649
  }
3579
3650
  return defaultResolveFields(componentData, {
@@ -3595,7 +3666,7 @@ var useResolvedFields = () => {
3595
3666
  } else {
3596
3667
  setResolvedFields(defaultFields);
3597
3668
  }
3598
- }, [data, defaultFields, state.ui.itemSelector, hasResolver]);
3669
+ }, [data, defaultFields, selectedItem, hasResolver]);
3599
3670
  return [resolvedFields, fieldsLoading];
3600
3671
  };
3601
3672
  var Fields = () => {
@@ -3902,7 +3973,7 @@ import { useCallback as useCallback8, useMemo as useMemo8 } from "react";
3902
3973
  init_react_import();
3903
3974
  import {
3904
3975
  createContext as createContext4,
3905
- useContext as useContext5,
3976
+ useContext as useContext6,
3906
3977
  useEffect as useEffect15,
3907
3978
  useRef as useRef3,
3908
3979
  useState as useState17
@@ -4112,7 +4183,7 @@ var CopyHostStyles = ({
4112
4183
  return /* @__PURE__ */ jsx31(Fragment13, { children });
4113
4184
  };
4114
4185
  var autoFrameContext = createContext4({});
4115
- var useFrame = () => useContext5(autoFrameContext);
4186
+ var useFrame = () => useContext6(autoFrameContext);
4116
4187
  function AutoFrame(_a) {
4117
4188
  var _b = _a, {
4118
4189
  children,
@@ -4265,7 +4336,7 @@ var scrollIntoView = (el) => {
4265
4336
  };
4266
4337
 
4267
4338
  // components/LayerTree/index.tsx
4268
- import { useContext as useContext6 } from "react";
4339
+ import { useContext as useContext7 } from "react";
4269
4340
 
4270
4341
  // lib/is-child-of-zone.ts
4271
4342
  init_react_import();
@@ -4292,7 +4363,7 @@ var LayerTree = ({
4292
4363
  label
4293
4364
  }) => {
4294
4365
  const zones = data.zones || {};
4295
- const ctx = useContext6(dropZoneContext);
4366
+ const ctx = useContext7(dropZoneContext);
4296
4367
  return /* @__PURE__ */ jsxs17(Fragment15, { children: [
4297
4368
  label && /* @__PURE__ */ jsxs17("div", { className: getClassName24("zoneTitle"), children: [
4298
4369
  /* @__PURE__ */ jsx33("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
@@ -94,6 +94,9 @@ type ExternalField<Props extends {
94
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;
@@ -94,6 +94,9 @@ type ExternalField<Props extends {
94
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-CaVk1fIL.mjs';
3
- export { a4 as resolveAllData } from './resolve-all-data-CaVk1fIL.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-CaVk1fIL.js';
3
- export { a4 as resolveAllData } from './resolve-all-data-CaVk1fIL.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.17.0-canary.8ea38c3",
3
+ "version": "0.17.0-canary.f71da6d",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",