@measured/puck-plugin-heading-analyzer 0.14.0-canary.22a4182 → 0.14.0-canary.2c15323

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/README.md CHANGED
@@ -31,4 +31,4 @@ export function Page() {
31
31
 
32
32
  ## License
33
33
 
34
- MIT © [Measured Co.](https://github.com/measuredco)
34
+ MIT © [Measured Corporation Ltd](https://measured.co)
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;
@@ -79,11 +81,15 @@ type ExternalField<Props extends {
79
81
  placeholder?: string;
80
82
  fetchList: (params: {
81
83
  query: string;
84
+ filters: Record<string, any>;
82
85
  }) => Promise<any[] | null>;
83
86
  mapProp?: (value: any) => Props;
87
+ mapRow?: (value: any) => Record<string, string | number>;
84
88
  getItemSummary: (item: Props, index?: number) => string;
85
89
  showSearch?: boolean;
86
90
  initialQuery?: string;
91
+ filterFields?: Record<string, Field>;
92
+ initialFilters?: Record<string, any>;
87
93
  };
88
94
  type CustomField<Props extends {
89
95
  [key: string]: any;
@@ -141,7 +147,7 @@ type RenderFunc<Props extends {
141
147
  [key: string]: any;
142
148
  } = {
143
149
  children: ReactNode;
144
- }> = React.FunctionComponent<Props>;
150
+ }> = (props: Props) => ReactElement;
145
151
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
146
152
  type OverrideKey = (typeof overrideKeys)[number];
147
153
  type OverridesGeneric<Shape extends {
@@ -171,7 +177,10 @@ type Overrides = OverridesGeneric<{
171
177
  className?: string;
172
178
  }>;
173
179
  components: RenderFunc;
174
- componentItem: RenderFunc;
180
+ componentItem: RenderFunc<{
181
+ children: ReactNode;
182
+ name: string;
183
+ }>;
175
184
  outline: RenderFunc;
176
185
  puck: RenderFunc;
177
186
  }>;
package/dist/index.js CHANGED
@@ -49958,7 +49958,7 @@ var require_dist = __commonJS({
49958
49958
  var HostPortal = 4;
49959
49959
  var HostComponent = 5;
49960
49960
  var HostText = 6;
49961
- var Fragment14 = 7;
49961
+ var Fragment13 = 7;
49962
49962
  var Mode = 8;
49963
49963
  var ContextConsumer = 9;
49964
49964
  var ContextProvider = 10;
@@ -51114,7 +51114,7 @@ var require_dist = __commonJS({
51114
51114
  return "DehydratedFragment";
51115
51115
  case ForwardRef:
51116
51116
  return getWrappedName$1(type, type.render, "ForwardRef");
51117
- case Fragment14:
51117
+ case Fragment13:
51118
51118
  return "Fragment";
51119
51119
  case HostComponent:
51120
51120
  return type;
@@ -60785,7 +60785,7 @@ var require_dist = __commonJS({
60785
60785
  }
60786
60786
  }
60787
60787
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
60788
- if (current2 === null || current2.tag !== Fragment14) {
60788
+ if (current2 === null || current2.tag !== Fragment13) {
60789
60789
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
60790
60790
  created.return = returnFiber;
60791
60791
  return created;
@@ -61188,7 +61188,7 @@ var require_dist = __commonJS({
61188
61188
  if (child.key === key) {
61189
61189
  var elementType = element.type;
61190
61190
  if (elementType === REACT_FRAGMENT_TYPE) {
61191
- if (child.tag === Fragment14) {
61191
+ if (child.tag === Fragment13) {
61192
61192
  deleteRemainingChildren(returnFiber, child.sibling);
61193
61193
  var existing = useFiber(child, element.props.children);
61194
61194
  existing.return = returnFiber;
@@ -65363,7 +65363,7 @@ var require_dist = __commonJS({
65363
65363
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
65364
65364
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
65365
65365
  }
65366
- case Fragment14:
65366
+ case Fragment13:
65367
65367
  return updateFragment(current2, workInProgress2, renderLanes2);
65368
65368
  case Mode:
65369
65369
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -65636,7 +65636,7 @@ var require_dist = __commonJS({
65636
65636
  case SimpleMemoComponent:
65637
65637
  case FunctionComponent:
65638
65638
  case ForwardRef:
65639
- case Fragment14:
65639
+ case Fragment13:
65640
65640
  case Mode:
65641
65641
  case Profiler:
65642
65642
  case ContextConsumer:
@@ -69895,7 +69895,7 @@ var require_dist = __commonJS({
69895
69895
  return fiber;
69896
69896
  }
69897
69897
  function createFiberFromFragment(elements, mode, lanes, key) {
69898
- var fiber = createFiber(Fragment14, elements, key, mode);
69898
+ var fiber = createFiber(Fragment13, elements, key, mode);
69899
69899
  fiber.lanes = lanes;
69900
69900
  return fiber;
69901
69901
  }
@@ -71035,7 +71035,7 @@ var require_dist = __commonJS({
71035
71035
  init_react_import2();
71036
71036
  var import_react22 = require("react");
71037
71037
  init_react_import2();
71038
- var Button_module_default = { "Button": "_Button_1hb69_1", "Button--medium": "_Button--medium_1hb69_29", "Button--large": "_Button--large_1hb69_37", "Button-icon": "_Button-icon_1hb69_44", "Button--primary": "_Button--primary_1hb69_48", "Button--secondary": "_Button--secondary_1hb69_67", "Button--flush": "_Button--flush_1hb69_82", "Button--disabled": "_Button--disabled_1hb69_86", "Button--fullWidth": "_Button--fullWidth_1hb69_93" };
71038
+ var Button_module_default = { "Button": "_Button_8fn3a_1", "Button--medium": "_Button--medium_8fn3a_29", "Button--large": "_Button--large_8fn3a_37", "Button-icon": "_Button-icon_8fn3a_44", "Button--primary": "_Button--primary_8fn3a_48", "Button--secondary": "_Button--secondary_8fn3a_67", "Button--flush": "_Button--flush_8fn3a_82", "Button--disabled": "_Button--disabled_8fn3a_86", "Button--fullWidth": "_Button--fullWidth_8fn3a_93", "Button-spinner": "_Button-spinner_8fn3a_98" };
71039
71039
  init_react_import2();
71040
71040
  var import_classnames2 = __toESM2(require_classnames2());
71041
71041
  var getClassNameFactory2 = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
@@ -71113,10 +71113,7 @@ var require_dist = __commonJS({
71113
71113
  children: [
71114
71114
  icon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("icon"), children: icon }),
71115
71115
  children,
71116
- loading && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
71117
- "\xA0\xA0",
71118
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" })
71119
- ] })
71116
+ loading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" }) })
71120
71117
  ]
71121
71118
  }
71122
71119
  );
@@ -71226,10 +71223,10 @@ var require_dist = __commonJS({
71226
71223
  const ctx = (0, import_react32.useContext)(drawerContext);
71227
71224
  const resolvedId = `${ctx.droppableId}::${id || name}`;
71228
71225
  const CustomInner = (0, import_react32.useMemo)(
71229
- () => 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 })),
71230
71227
  [children]
71231
71228
  );
71232
- 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: [
71233
71230
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("name"), children: name }),
71234
71231
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DragIcon, {}) })
71235
71232
  ] }) }) }) });
@@ -71404,6 +71401,18 @@ var require_dist = __commonJS({
71404
71401
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
71405
71402
  ]);
71406
71403
  init_react_import2();
71404
+ var SlidersHorizontal = createLucideIcon2("SlidersHorizontal", [
71405
+ ["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
71406
+ ["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
71407
+ ["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
71408
+ ["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
71409
+ ["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
71410
+ ["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
71411
+ ["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
71412
+ ["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
71413
+ ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
71414
+ ]);
71415
+ init_react_import2();
71407
71416
  var Trash = createLucideIcon2("Trash", [
71408
71417
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
71409
71418
  ["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
@@ -72694,7 +72703,10 @@ var require_dist = __commonJS({
72694
72703
  );
72695
72704
  const runResolvers = () => __async(void 0, null, function* () {
72696
72705
  const newData = newAppState.data;
72697
- 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
+ });
72698
72710
  const applyIfChange = (dynamicDataMap, dynamicRoot) => {
72699
72711
  const processed = applyDynamicProps(
72700
72712
  appState.data,
@@ -72831,7 +72843,7 @@ var require_dist = __commonJS({
72831
72843
  var import_react_spinners6 = (init_esm(), __toCommonJS(esm_exports));
72832
72844
  init_react_import2();
72833
72845
  init_react_import2();
72834
- var styles_module_default9 = { "Input": "_Input_3msty_1", "Input-label": "_Input-label_3msty_26", "Input-labelIcon": "_Input-labelIcon_3msty_34", "Input-disabledIcon": "_Input-disabledIcon_3msty_40", "Input-input": "_Input-input_3msty_45", "Input--readOnly": "_Input--readOnly_3msty_89", "Input-radioGroupItems": "_Input-radioGroupItems_3msty_100", "Input-radio": "_Input-radio_3msty_100", "Input-radioInner": "_Input-radioInner_3msty_117", "Input-radioInput": "_Input-radioInput_3msty_162" };
72846
+ var styles_module_default9 = { "Input": "_Input_1qi5b_1", "Input-label": "_Input-label_1qi5b_26", "Input-labelIcon": "_Input-labelIcon_1qi5b_34", "Input-disabledIcon": "_Input-disabledIcon_1qi5b_41", "Input-input": "_Input-input_1qi5b_46", "Input--readOnly": "_Input--readOnly_1qi5b_90", "Input-radioGroupItems": "_Input-radioGroupItems_1qi5b_101", "Input-radio": "_Input-radio_1qi5b_101", "Input-radioInner": "_Input-radioInner_1qi5b_118", "Input-radioInput": "_Input-radioInput_1qi5b_163" };
72835
72847
  var import_react18 = require("react");
72836
72848
  init_react_import2();
72837
72849
  init_react_import2();
@@ -73002,6 +73014,7 @@ var require_dist = __commonJS({
73002
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)(
73003
73015
  IconButton,
73004
73016
  {
73017
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
73005
73018
  onClick: (e2) => {
73006
73019
  e2.stopPropagation();
73007
73020
  const existingValue = [
@@ -73066,6 +73079,7 @@ var require_dist = __commonJS({
73066
73079
  "button",
73067
73080
  {
73068
73081
  className: getClassName10("addButton"),
73082
+ disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
73069
73083
  onClick: () => {
73070
73084
  const existingValue = value || [];
73071
73085
  const newValue = [
@@ -73075,7 +73089,7 @@ var require_dist = __commonJS({
73075
73089
  const newArrayState = regenerateArrayState(newValue);
73076
73090
  onChange(newValue, mapArrayStateToUi(newArrayState));
73077
73091
  },
73078
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: "21" })
73092
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: 21 })
73079
73093
  }
73080
73094
  )
73081
73095
  ]
@@ -73138,11 +73152,11 @@ var require_dist = __commonJS({
73138
73152
  init_react_import2();
73139
73153
  var import_react16 = require("react");
73140
73154
  init_react_import2();
73141
- var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_oqtaj_1", "ExternalInput-button": "_ExternalInput-button_oqtaj_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_oqtaj_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_oqtaj_32", "ExternalInputModal": "_ExternalInputModal_oqtaj_74", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_oqtaj_82", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_oqtaj_90", "ExternalInputModal-table": "_ExternalInputModal-table_oqtaj_90", "ExternalInputModal-thead": "_ExternalInputModal-thead_oqtaj_106", "ExternalInputModal-th": "_ExternalInputModal-th_oqtaj_106", "ExternalInputModal-td": "_ExternalInputModal-td_oqtaj_120", "ExternalInputModal-tr": "_ExternalInputModal-tr_oqtaj_124", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_oqtaj_137", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_oqtaj_157", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_oqtaj_161", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_oqtaj_174", "ExternalInputModal-noContentBanner": "_ExternalInputModal-noContentBanner_oqtaj_178", "ExternalInputModal--loaded": "_ExternalInputModal--loaded_oqtaj_185", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_oqtaj_190", "ExternalInputModal-search": "_ExternalInputModal-search_oqtaj_190", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_oqtaj_221", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_oqtaj_246", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_oqtaj_256" };
73155
+ var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_q3l5a_1", "ExternalInput-button": "_ExternalInput-button_q3l5a_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_q3l5a_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_q3l5a_32", "ExternalInputModal": "_ExternalInputModal_q3l5a_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_q3l5a_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_q3l5a_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_q3l5a_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_q3l5a_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_q3l5a_128", "ExternalInputModal-table": "_ExternalInputModal-table_q3l5a_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_q3l5a_144", "ExternalInputModal-th": "_ExternalInputModal-th_q3l5a_144", "ExternalInputModal-td": "_ExternalInputModal-td_q3l5a_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_q3l5a_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_q3l5a_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_q3l5a_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_q3l5a_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_q3l5a_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_q3l5a_222", "ExternalInputModal-search": "_ExternalInputModal-search_q3l5a_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_q3l5a_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_q3l5a_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_q3l5a_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_q3l5a_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_q3l5a_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_q3l5a_325" };
73142
73156
  init_react_import2();
73143
73157
  var import_react15 = require("react");
73144
73158
  init_react_import2();
73145
- var styles_module_default12 = { "Modal": "_Modal_1yh4j_1", "Modal--isOpen": "_Modal--isOpen_1yh4j_15", "Modal-inner": "_Modal-inner_1yh4j_19" };
73159
+ var styles_module_default12 = { "Modal": "_Modal_zud0i_1", "Modal--isOpen": "_Modal--isOpen_zud0i_15", "Modal-inner": "_Modal-inner_zud0i_19" };
73146
73160
  var import_react_dom3 = __toESM2(require_react_dom2());
73147
73161
  var import_jsx_runtime14 = require("react/jsx-runtime");
73148
73162
  var getClassName12 = get_class_name_factory_default2("Modal", styles_module_default12);
@@ -73182,13 +73196,23 @@ var require_dist = __commonJS({
73182
73196
  name,
73183
73197
  id
73184
73198
  }) => {
73185
- const { mapProp = (val) => val } = field || {};
73199
+ const {
73200
+ mapProp = (val) => val,
73201
+ mapRow = (val) => val,
73202
+ filterFields
73203
+ } = field || {};
73186
73204
  const [data, setData] = (0, import_react16.useState)([]);
73187
73205
  const [isOpen, setOpen] = (0, import_react16.useState)(false);
73188
73206
  const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
73207
+ const hasFilterFields = !!filterFields;
73208
+ const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
73209
+ const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
73210
+ const mappedData = (0, import_react16.useMemo)(() => {
73211
+ return data.map(mapRow);
73212
+ }, [data]);
73189
73213
  const keys = (0, import_react16.useMemo)(() => {
73190
73214
  const validKeys = /* @__PURE__ */ new Set();
73191
- for (const item of data) {
73215
+ for (const item of mappedData) {
73192
73216
  for (const key of Object.keys(item)) {
73193
73217
  if (typeof item[key] === "string" || typeof item[key] === "number") {
73194
73218
  validKeys.add(key);
@@ -73196,13 +73220,13 @@ var require_dist = __commonJS({
73196
73220
  }
73197
73221
  }
73198
73222
  return Array.from(validKeys);
73199
- }, [data]);
73223
+ }, [mappedData]);
73200
73224
  const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
73201
73225
  const search = (0, import_react16.useCallback)(
73202
- (query) => __async(void 0, null, function* () {
73226
+ (query, filters2) => __async(void 0, null, function* () {
73203
73227
  setIsLoading(true);
73204
- const cacheKey = `${id}-${name}-${query}`;
73205
- const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
73228
+ const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
73229
+ const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
73206
73230
  if (listData) {
73207
73231
  setData(listData);
73208
73232
  setIsLoading(false);
@@ -73212,7 +73236,7 @@ var require_dist = __commonJS({
73212
73236
  [name, field]
73213
73237
  );
73214
73238
  (0, import_react16.useEffect)(() => {
73215
- search(searchQuery);
73239
+ search(searchQuery, filters);
73216
73240
  }, []);
73217
73241
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
73218
73242
  "div",
@@ -73247,78 +73271,109 @@ var require_dist = __commonJS({
73247
73271
  )
73248
73272
  ] }),
73249
73273
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
73250
- "div",
73274
+ "form",
73251
73275
  {
73252
73276
  className: getClassNameModal({
73253
73277
  isLoading,
73254
73278
  loaded: !isLoading,
73255
- hasData: data.length > 0
73279
+ hasData: mappedData.length > 0,
73280
+ filtersToggled
73256
73281
  }),
73282
+ onSubmit: (e2) => {
73283
+ e2.preventDefault();
73284
+ search(searchQuery, filters);
73285
+ },
73257
73286
  children: [
73258
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("masthead"), children: [
73259
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading2, { rank: 2, size: "xxl", children: "Select content" }),
73260
- field.showSearch && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
73261
- "form",
73262
- {
73263
- className: getClassNameModal("searchForm"),
73264
- onSubmit: (e2) => {
73265
- e2.preventDefault();
73266
- search(searchQuery);
73267
- },
73268
- children: [
73269
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
73270
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
73271
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
73272
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73273
- "input",
73274
- {
73275
- className: getClassNameModal("searchInput"),
73276
- name: "q",
73277
- type: "search",
73278
- placeholder: "Search",
73279
- onChange: (e2) => {
73280
- setSearchQuery(e2.currentTarget.value);
73281
- },
73282
- autoComplete: "off",
73283
- value: searchQuery
73284
- }
73285
- )
73286
- ] }),
73287
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, disabled: isLoading, children: "Search" })
73288
- ]
73289
- }
73290
- )
73291
- ] }),
73292
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
73293
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
73294
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73295
- "th",
73287
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
73288
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
73289
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
73290
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
73291
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73292
+ "input",
73296
73293
  {
73297
- className: getClassNameModal("th"),
73298
- style: { textAlign: "left" },
73299
- children: key
73294
+ className: getClassNameModal("searchInput"),
73295
+ name: "q",
73296
+ type: "search",
73297
+ placeholder: field.placeholder,
73298
+ onChange: (e2) => {
73299
+ setSearchQuery(e2.currentTarget.value);
73300
+ },
73301
+ autoComplete: "off",
73302
+ value: searchQuery
73303
+ }
73304
+ )
73305
+ ] }),
73306
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
73307
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
73308
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73309
+ IconButton,
73310
+ {
73311
+ title: "Toggle filters",
73312
+ onClick: (e2) => {
73313
+ e2.preventDefault();
73314
+ e2.stopPropagation();
73315
+ setFiltersToggled(!filtersToggled);
73316
+ },
73317
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlidersHorizontal, { size: 20 })
73318
+ }
73319
+ ) })
73320
+ ] })
73321
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading2, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
73322
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("grid"), children: [
73323
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
73324
+ const filterField = filterFields[fieldName];
73325
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73326
+ InputOrGroup,
73327
+ {
73328
+ field: filterField,
73329
+ name: fieldName,
73330
+ id: `external_field_${fieldName}_filter`,
73331
+ label: filterField.label || fieldName,
73332
+ value: filters[fieldName],
73333
+ onChange: (value2) => {
73334
+ const newFilters = __spreadProps2(__spreadValues2({}, filters), { [fieldName]: value2 });
73335
+ setFilters(newFilters);
73336
+ search(searchQuery, newFilters);
73337
+ }
73300
73338
  },
73301
- key
73302
- )) }) }),
73303
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i2) => {
73304
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73305
- "tr",
73339
+ fieldName
73340
+ );
73341
+ }) }),
73342
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
73343
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
73344
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73345
+ "th",
73306
73346
  {
73307
- style: { whiteSpace: "nowrap" },
73308
- className: getClassNameModal("tr"),
73309
- onClick: (e2) => {
73310
- onChange(mapProp(item));
73311
- setOpen(false);
73312
- },
73313
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
73347
+ className: getClassNameModal("th"),
73348
+ style: { textAlign: "left" },
73349
+ children: key
73314
73350
  },
73315
- i2
73316
- );
73317
- }) })
73318
- ] }),
73319
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
73351
+ key
73352
+ )) }) }),
73353
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i2) => {
73354
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73355
+ "tr",
73356
+ {
73357
+ style: { whiteSpace: "nowrap" },
73358
+ className: getClassNameModal("tr"),
73359
+ onClick: () => {
73360
+ onChange(mapProp(data[i2]));
73361
+ setOpen(false);
73362
+ },
73363
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
73364
+ },
73365
+ i2
73366
+ );
73367
+ }) })
73368
+ ] }),
73369
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
73370
+ ] })
73320
73371
  ] }),
73321
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No results." })
73372
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("footer"), children: [
73373
+ mappedData.length,
73374
+ " result",
73375
+ mappedData.length === 1 ? "" : "s"
73376
+ ] })
73322
73377
  ]
73323
73378
  }
73324
73379
  ) })
@@ -73362,6 +73417,7 @@ var require_dist = __commonJS({
73362
73417
  // DEPRECATED
73363
73418
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
73364
73419
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
73420
+ mapRow: validField.mapRow,
73365
73421
  fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
73366
73422
  return yield deprecatedField.adaptor.fetchList(
73367
73423
  deprecatedField.adaptorParams
@@ -74748,8 +74804,8 @@ var require_dist = __commonJS({
74748
74804
  });
74749
74805
  init_react_import2();
74750
74806
  var usePuck2 = () => {
74751
- const { state: appState, config, dispatch } = useAppContext2();
74752
- return { appState, config, dispatch };
74807
+ const { state: appState, config, history, dispatch } = useAppContext2();
74808
+ return { appState, config, dispatch, history };
74753
74809
  };
74754
74810
  }
74755
74811
  });
@@ -75544,6 +75600,14 @@ lucide-react/dist/esm/icons/search.js:
75544
75600
  * See the LICENSE file in the root directory of this source tree.
75545
75601
  *)
75546
75602
 
75603
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
75604
+ (**
75605
+ * @license lucide-react v0.298.0 - ISC
75606
+ *
75607
+ * This source code is licensed under the ISC license.
75608
+ * See the LICENSE file in the root directory of this source tree.
75609
+ *)
75610
+
75547
75611
  lucide-react/dist/esm/icons/trash.js:
75548
75612
  (**
75549
75613
  * @license lucide-react v0.298.0 - ISC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.14.0-canary.22a4182",
3
+ "version": "0.14.0-canary.2c15323",
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.22a4182",
21
+ "@measured/puck": "^0.14.0-canary.2c15323",
22
22
  "@types/react": "^18.2.0",
23
23
  "@types/react-dom": "^18.2.0",
24
24
  "eslint": "^7.32.0",