algolia-experiences 1.4.0 → 1.4.1

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.
@@ -12706,7 +12706,7 @@
12706
12706
  };
12707
12707
  }
12708
12708
 
12709
- var version$1 = '4.75.1';
12709
+ var version$1 = '4.75.2';
12710
12710
 
12711
12711
  function _typeof$j(obj) {
12712
12712
  "@babel/helpers - typeof";
@@ -18480,7 +18480,9 @@
18480
18480
  args[_key] = arguments[_key];
18481
18481
  }
18482
18482
  _this = _super.call.apply(_super, [this].concat(args));
18483
+ _defineProperty$y(_assertThisInitialized$4(_this), "listRef", y());
18483
18484
  _defineProperty$y(_assertThisInitialized$4(_this), "searchBox", y());
18485
+ _defineProperty$y(_assertThisInitialized$4(_this), "lastRefinedValue", undefined);
18484
18486
  _defineProperty$y(_assertThisInitialized$4(_this), "_generateFacetItem", function (facetValue) {
18485
18487
  var subItems;
18486
18488
  if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) {
@@ -18583,6 +18585,7 @@
18583
18585
  }, {
18584
18586
  key: "refine",
18585
18587
  value: function refine(facetValueToRefine) {
18588
+ this.lastRefinedValue = facetValueToRefine;
18586
18589
  this.props.toggleRefinement(facetValueToRefine);
18587
18590
  }
18588
18591
  }, {
@@ -18592,6 +18595,19 @@
18592
18595
  this.searchBox.current.resetInput();
18593
18596
  }
18594
18597
  }
18598
+
18599
+ /**
18600
+ * This sets focus on the last refined input element after a render
18601
+ * because Preact does not perform it automatically.
18602
+ * @see https://github.com/preactjs/preact/issues/3242
18603
+ */
18604
+ }, {
18605
+ key: "componentDidUpdate",
18606
+ value: function componentDidUpdate() {
18607
+ var _this$listRef$current, _this$listRef$current2;
18608
+ (_this$listRef$current = this.listRef.current) === null || _this$listRef$current === void 0 ? void 0 : (_this$listRef$current2 = _this$listRef$current.querySelector("input[value=\"".concat(this.lastRefinedValue, "\"]"))) === null || _this$listRef$current2 === void 0 ? void 0 : _this$listRef$current2.focus();
18609
+ this.lastRefinedValue = undefined;
18610
+ }
18595
18611
  }, {
18596
18612
  key: "refineFirstValue",
18597
18613
  value: function refineFirstValue() {
@@ -18644,6 +18660,7 @@
18644
18660
  ariaLabel: "Search for filters"
18645
18661
  }));
18646
18662
  var facetValues = this.props.facetValues && this.props.facetValues.length > 0 && h("ul", {
18663
+ ref: this.listRef,
18647
18664
  className: this.props.cssClasses.list
18648
18665
  }, this.props.facetValues.map(this._generateFacetItem, this));
18649
18666
  var noResults = this.props.searchFacetValues && this.props.isFromSearch && (!this.props.facetValues || this.props.facetValues.length === 0) && h(Template, _extends$f({}, this.props.templateProps, {