@measured/puck-plugin-heading-analyzer 0.14.0-canary.22a4182 → 0.14.0-canary.32c0dfa

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -79,11 +79,15 @@ type ExternalField<Props extends {
79
79
  placeholder?: string;
80
80
  fetchList: (params: {
81
81
  query: string;
82
+ filters: Record<string, any>;
82
83
  }) => Promise<any[] | null>;
83
84
  mapProp?: (value: any) => Props;
85
+ mapRow?: (value: any) => Record<string, string | number>;
84
86
  getItemSummary: (item: Props, index?: number) => string;
85
87
  showSearch?: boolean;
86
88
  initialQuery?: string;
89
+ filterFields?: Record<string, Field>;
90
+ initialFilters?: Record<string, any>;
87
91
  };
88
92
  type CustomField<Props extends {
89
93
  [key: string]: any;
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
  );
@@ -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" }],
@@ -72831,7 +72840,7 @@ var require_dist = __commonJS({
72831
72840
  var import_react_spinners6 = (init_esm(), __toCommonJS(esm_exports));
72832
72841
  init_react_import2();
72833
72842
  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" };
72843
+ 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
72844
  var import_react18 = require("react");
72836
72845
  init_react_import2();
72837
72846
  init_react_import2();
@@ -73138,11 +73147,11 @@ var require_dist = __commonJS({
73138
73147
  init_react_import2();
73139
73148
  var import_react16 = require("react");
73140
73149
  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" };
73150
+ 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
73151
  init_react_import2();
73143
73152
  var import_react15 = require("react");
73144
73153
  init_react_import2();
73145
- var styles_module_default12 = { "Modal": "_Modal_1yh4j_1", "Modal--isOpen": "_Modal--isOpen_1yh4j_15", "Modal-inner": "_Modal-inner_1yh4j_19" };
73154
+ var styles_module_default12 = { "Modal": "_Modal_zud0i_1", "Modal--isOpen": "_Modal--isOpen_zud0i_15", "Modal-inner": "_Modal-inner_zud0i_19" };
73146
73155
  var import_react_dom3 = __toESM2(require_react_dom2());
73147
73156
  var import_jsx_runtime14 = require("react/jsx-runtime");
73148
73157
  var getClassName12 = get_class_name_factory_default2("Modal", styles_module_default12);
@@ -73182,13 +73191,23 @@ var require_dist = __commonJS({
73182
73191
  name,
73183
73192
  id
73184
73193
  }) => {
73185
- const { mapProp = (val) => val } = field || {};
73194
+ const {
73195
+ mapProp = (val) => val,
73196
+ mapRow = (val) => val,
73197
+ filterFields
73198
+ } = field || {};
73186
73199
  const [data, setData] = (0, import_react16.useState)([]);
73187
73200
  const [isOpen, setOpen] = (0, import_react16.useState)(false);
73188
73201
  const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
73202
+ const hasFilterFields = !!filterFields;
73203
+ const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
73204
+ const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
73205
+ const mappedData = (0, import_react16.useMemo)(() => {
73206
+ return data.map(mapRow);
73207
+ }, [data]);
73189
73208
  const keys = (0, import_react16.useMemo)(() => {
73190
73209
  const validKeys = /* @__PURE__ */ new Set();
73191
- for (const item of data) {
73210
+ for (const item of mappedData) {
73192
73211
  for (const key of Object.keys(item)) {
73193
73212
  if (typeof item[key] === "string" || typeof item[key] === "number") {
73194
73213
  validKeys.add(key);
@@ -73196,13 +73215,13 @@ var require_dist = __commonJS({
73196
73215
  }
73197
73216
  }
73198
73217
  return Array.from(validKeys);
73199
- }, [data]);
73218
+ }, [mappedData]);
73200
73219
  const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
73201
73220
  const search = (0, import_react16.useCallback)(
73202
- (query) => __async(void 0, null, function* () {
73221
+ (query, filters2) => __async(void 0, null, function* () {
73203
73222
  setIsLoading(true);
73204
- const cacheKey = `${id}-${name}-${query}`;
73205
- const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
73223
+ const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
73224
+ const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
73206
73225
  if (listData) {
73207
73226
  setData(listData);
73208
73227
  setIsLoading(false);
@@ -73212,7 +73231,7 @@ var require_dist = __commonJS({
73212
73231
  [name, field]
73213
73232
  );
73214
73233
  (0, import_react16.useEffect)(() => {
73215
- search(searchQuery);
73234
+ search(searchQuery, filters);
73216
73235
  }, []);
73217
73236
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
73218
73237
  "div",
@@ -73247,78 +73266,109 @@ var require_dist = __commonJS({
73247
73266
  )
73248
73267
  ] }),
73249
73268
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
73250
- "div",
73269
+ "form",
73251
73270
  {
73252
73271
  className: getClassNameModal({
73253
73272
  isLoading,
73254
73273
  loaded: !isLoading,
73255
- hasData: data.length > 0
73274
+ hasData: mappedData.length > 0,
73275
+ filtersToggled
73256
73276
  }),
73277
+ onSubmit: (e2) => {
73278
+ e2.preventDefault();
73279
+ search(searchQuery, filters);
73280
+ },
73257
73281
  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",
73282
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
73283
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
73284
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
73285
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
73286
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73287
+ "input",
73288
+ {
73289
+ className: getClassNameModal("searchInput"),
73290
+ name: "q",
73291
+ type: "search",
73292
+ placeholder: field.placeholder,
73293
+ onChange: (e2) => {
73294
+ setSearchQuery(e2.currentTarget.value);
73295
+ },
73296
+ autoComplete: "off",
73297
+ value: searchQuery
73298
+ }
73299
+ )
73300
+ ] }),
73301
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
73302
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
73303
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73304
+ IconButton,
73305
+ {
73306
+ title: "Toggle filters",
73307
+ onClick: (e2) => {
73308
+ e2.preventDefault();
73309
+ e2.stopPropagation();
73310
+ setFiltersToggled(!filtersToggled);
73311
+ },
73312
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlidersHorizontal, { size: 20 })
73313
+ }
73314
+ ) })
73315
+ ] })
73316
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading2, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
73317
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("grid"), children: [
73318
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
73319
+ const filterField = filterFields[fieldName];
73320
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73321
+ InputOrGroup,
73296
73322
  {
73297
- className: getClassNameModal("th"),
73298
- style: { textAlign: "left" },
73299
- children: key
73323
+ field: filterField,
73324
+ name: fieldName,
73325
+ id: `external_field_${fieldName}_filter`,
73326
+ label: filterField.label || fieldName,
73327
+ value: filters[fieldName],
73328
+ onChange: (value2) => {
73329
+ const newFilters = __spreadProps2(__spreadValues2({}, filters), { [fieldName]: value2 });
73330
+ setFilters(newFilters);
73331
+ search(searchQuery, newFilters);
73332
+ }
73300
73333
  },
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",
73334
+ fieldName
73335
+ );
73336
+ }) }),
73337
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
73338
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
73339
+ /* @__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)(
73340
+ "th",
73306
73341
  {
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))
73342
+ className: getClassNameModal("th"),
73343
+ style: { textAlign: "left" },
73344
+ children: key
73314
73345
  },
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" }) })
73346
+ key
73347
+ )) }) }),
73348
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i2) => {
73349
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
73350
+ "tr",
73351
+ {
73352
+ style: { whiteSpace: "nowrap" },
73353
+ className: getClassNameModal("tr"),
73354
+ onClick: () => {
73355
+ onChange(mapProp(data[i2]));
73356
+ setOpen(false);
73357
+ },
73358
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
73359
+ },
73360
+ i2
73361
+ );
73362
+ }) })
73363
+ ] }),
73364
+ /* @__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" }) })
73365
+ ] })
73320
73366
  ] }),
73321
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No results." })
73367
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("footer"), children: [
73368
+ mappedData.length,
73369
+ " result",
73370
+ mappedData.length === 1 ? "" : "s"
73371
+ ] })
73322
73372
  ]
73323
73373
  }
73324
73374
  ) })
@@ -73362,6 +73412,7 @@ var require_dist = __commonJS({
73362
73412
  // DEPRECATED
73363
73413
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
73364
73414
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
73415
+ mapRow: validField.mapRow,
73365
73416
  fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
73366
73417
  return yield deprecatedField.adaptor.fetchList(
73367
73418
  deprecatedField.adaptorParams
@@ -75544,6 +75595,14 @@ lucide-react/dist/esm/icons/search.js:
75544
75595
  * See the LICENSE file in the root directory of this source tree.
75545
75596
  *)
75546
75597
 
75598
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
75599
+ (**
75600
+ * @license lucide-react v0.298.0 - ISC
75601
+ *
75602
+ * This source code is licensed under the ISC license.
75603
+ * See the LICENSE file in the root directory of this source tree.
75604
+ *)
75605
+
75547
75606
  lucide-react/dist/esm/icons/trash.js:
75548
75607
  (**
75549
75608
  * @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.32c0dfa",
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.32c0dfa",
22
22
  "@types/react": "^18.2.0",
23
23
  "@types/react-dom": "^18.2.0",
24
24
  "eslint": "^7.32.0",