@biggive/components 1.0.175 → 1.0.176

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/hydrate/index.js CHANGED
@@ -6614,6 +6614,10 @@ class BiggiveCampaignCardFilterGrid {
6614
6614
  registerInstance(this, hostRef);
6615
6615
  this.doSearchAndFilterUpdate = createEvent(this, "doSearchAndFilterUpdate", 7);
6616
6616
  this.sortByPlaceholderText = 'Sort by';
6617
+ this.beneficiariesPlaceHolderText = 'Beneficiary';
6618
+ this.categoriesPlaceHolderText = 'Category';
6619
+ this.locationsPlaceHolderText = 'Location';
6620
+ this.fundingPlaceHolderText = 'Funding';
6617
6621
  this.handleApplyFilterButtonClick = () => {
6618
6622
  const searchAndFilterObj = this.getSearchAndFilterObject();
6619
6623
  this.doSearchAndFilterUpdate.emit(searchAndFilterObj);
@@ -6648,6 +6652,11 @@ class BiggiveCampaignCardFilterGrid {
6648
6652
  this.selectedFilterCategory = null;
6649
6653
  this.selectedFilterFunding = null;
6650
6654
  this.selectedFilterLocation = null;
6655
+ // Clear <biggive-form-field-select> components' internal selectedValue and selectedLabel. DON-654.
6656
+ ['sort-by', 'categories', 'beneficiaries', 'locations', 'funding'].forEach(id => {
6657
+ this.el.shadowRoot.getElementById(id).selectedValue = null;
6658
+ this.el.shadowRoot.getElementById(id).selectedLabel = null;
6659
+ });
6651
6660
  // Emit the doSearchAndFilterUpdate event with null values. DON-654
6652
6661
  this.doSearchAndFilterUpdate.emit({
6653
6662
  searchText: null,
@@ -6667,12 +6676,12 @@ class BiggiveCampaignCardFilterGrid {
6667
6676
  this.beneficiaryOptions = [];
6668
6677
  this.locationOptions = [];
6669
6678
  this.fundingOptions = [];
6670
- this.filtersApplied = undefined;
6671
6679
  this.selectedSortByOption = null;
6672
6680
  this.selectedFilterCategory = null;
6673
6681
  this.selectedFilterBeneficiary = null;
6674
6682
  this.selectedFilterLocation = null;
6675
6683
  this.selectedFilterFunding = null;
6684
+ this.filtersApplied = undefined;
6676
6685
  }
6677
6686
  getSearchAndFilterObject() {
6678
6687
  const event = {
@@ -6686,11 +6695,7 @@ class BiggiveCampaignCardFilterGrid {
6686
6695
  return event;
6687
6696
  }
6688
6697
  doOptionSelectCompletedHandler(event) {
6689
- this.selectedSortByOption = this.el.shadowRoot.getElementById('sort-by').selectedValue;
6690
- this.selectedFilterCategory = this.el.shadowRoot.getElementById('categories').selectedValue;
6691
- this.selectedFilterBeneficiary = this.el.shadowRoot.getElementById('beneficiaries').selectedValue;
6692
- this.selectedFilterLocation = this.el.shadowRoot.getElementById('locations').selectedValue;
6693
- this.selectedFilterFunding = this.el.shadowRoot.getElementById('funding').selectedValue;
6698
+ const nameOfUpdatedDropdown = event.detail.placeholder;
6694
6699
  // If this method was trigerred by the selection of a 'Sort by' dropdown option, then
6695
6700
  // emit an event to search, but do NOT emit an event for example when filter options
6696
6701
  // are selected, until the 'Apply filters' button is pressed which is handled separately
@@ -6699,10 +6704,23 @@ class BiggiveCampaignCardFilterGrid {
6699
6704
  // `<biggive-form-field-select placeholder="Sort by" id="sort-by" onDoSelectChange={this.someHandleMethod}>`
6700
6705
  // but the problem with that is that `someHandleMethod` gets called first and then this
6701
6706
  // method gets called, leading to two calls and more risk for error. DON-570.
6702
- if (event.detail.placeholder === this.sortByPlaceholderText) {
6703
- console.log('emitting event:');
6704
- console.log(this.getSearchAndFilterObject());
6705
- this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
6707
+ switch (nameOfUpdatedDropdown) {
6708
+ case this.sortByPlaceholderText:
6709
+ this.selectedSortByOption = event.detail.value;
6710
+ this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
6711
+ break;
6712
+ case this.beneficiariesPlaceHolderText:
6713
+ this.selectedFilterBeneficiary = event.detail.value;
6714
+ break;
6715
+ case this.categoriesPlaceHolderText:
6716
+ this.selectedFilterCategory = event.detail.value;
6717
+ break;
6718
+ case this.fundingPlaceHolderText:
6719
+ this.selectedFilterFunding = event.detail.value;
6720
+ break;
6721
+ case this.locationsPlaceHolderText:
6722
+ this.selectedFilterLocation = event.detail.value;
6723
+ break;
6706
6724
  }
6707
6725
  }
6708
6726
  componentWillRender() {
@@ -6710,15 +6728,15 @@ class BiggiveCampaignCardFilterGrid {
6710
6728
  this.selectedFilterCategory !== null || this.selectedFilterBeneficiary !== null || this.selectedFilterFunding !== null || this.selectedFilterLocation !== null;
6711
6729
  }
6712
6730
  render() {
6713
- return (hAsync("div", { class: 'container space-below-' + this.spaceBelow }, hAsync("div", { class: "sleeve" }, hAsync("div", { class: "search-wrap" }, hAsync("h4", null, this.intro), hAsync("div", { class: "field-wrap" }, hAsync("div", { class: "input-wrap" }, hAsync("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, hAsync("path", { d: faMagnifyingGlass.icon[4].toString() })), hAsync("input", { type: "text", value: this.searchText, class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), hAsync("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), hAsync("div", { class: "sort-filter-wrap" }, hAsync("div", { class: "clear-all" }, hAsync("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon icon-clear-all", viewBox: "0 0 512 512" }, hAsync("path", { d: faFilterSlash.icon[4].toString() })), hAsync("a", { onClick: this.handleClearAll }, "Clear all")), hAsync("div", { class: "sort-wrap" }, hAsync("biggive-form-field-select", { placeholder: "Sort by", selectedLabel: this.selectedSortByOption, id: "sort-by" }, hAsync("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), hAsync("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), hAsync("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }))), hAsync("div", { class: "filter-wrap" }, hAsync("biggive-button", { class: "filter", colourScheme: this.filtersApplied ? 'secondary' : 'primary', onClick: this.handleFilterButtonClick, label: "Filters", fullWidth: true, "space-below": "0" }), hAsync("biggive-popup", { id: "filter-popup" }, hAsync("h4", { class: "space-above-0 space-below-3 colour-primary" }, "Filters"), hAsync("biggive-form-field-select", { placeholder: "Category", selectedLabel: this.selectedFilterCategory, id: "categories", "space-below": "2" }, this.categoryOptions.length === 0
6731
+ return (hAsync("div", { class: 'container space-below-' + this.spaceBelow }, hAsync("div", { class: "sleeve" }, hAsync("div", { class: "search-wrap" }, hAsync("h4", null, this.intro), hAsync("div", { class: "field-wrap" }, hAsync("div", { class: "input-wrap" }, hAsync("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, hAsync("path", { d: faMagnifyingGlass.icon[4].toString() })), hAsync("input", { type: "text", value: this.searchText, class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), hAsync("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), hAsync("div", { class: "sort-filter-wrap" }, hAsync("div", { class: "clear-all" }, hAsync("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon icon-clear-all", viewBox: "0 0 512 512" }, hAsync("path", { d: faFilterSlash.icon[4].toString() })), hAsync("a", { onClick: this.handleClearAll }, "Clear all")), hAsync("div", { class: "sort-wrap" }, hAsync("biggive-form-field-select", { placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, id: "sort-by" }, hAsync("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), hAsync("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), hAsync("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }))), hAsync("div", { class: "filter-wrap" }, hAsync("biggive-button", { class: "filter", colourScheme: this.filtersApplied ? 'secondary' : 'primary', onClick: this.handleFilterButtonClick, label: "Filters", fullWidth: true, "space-below": "0" }), hAsync("biggive-popup", { id: "filter-popup" }, hAsync("h4", { class: "space-above-0 space-below-3 colour-primary" }, "Filters"), hAsync("biggive-form-field-select", { placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, id: "categories", "space-below": "2" }, this.categoryOptions.length === 0
6714
6732
  ? undefined
6715
- : this.categoryOptions.map(option => hAsync("biggive-form-field-select-option", { value: option, label: option }))), hAsync("biggive-form-field-select", { placeholder: "Beneficiary", selectedLabel: this.selectedFilterBeneficiary, id: "beneficiaries", "space-below": "2" }, this.beneficiaryOptions.length === 0
6733
+ : (Array.isArray(this.categoryOptions) ? this.categoryOptions : JSON.parse(this.categoryOptions)).map(option => (hAsync("biggive-form-field-select-option", { value: option, label: option })))), hAsync("biggive-form-field-select", { placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, id: "beneficiaries", "space-below": "2" }, this.beneficiaryOptions.length === 0
6716
6734
  ? undefined
6717
- : this.beneficiaryOptions.map(option => hAsync("biggive-form-field-select-option", { value: option, label: option }))), hAsync("biggive-form-field-select", { placeholder: "Location", selectedLabel: this.selectedFilterLocation, id: "locations", "space-below": "2" }, this.locationOptions.length === 0
6735
+ : (Array.isArray(this.beneficiaryOptions) ? this.beneficiaryOptions : JSON.parse(this.beneficiaryOptions)).map(option => (hAsync("biggive-form-field-select-option", { value: option, label: option })))), hAsync("biggive-form-field-select", { placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, id: "locations", "space-below": "2" }, this.locationOptions.length === 0
6718
6736
  ? undefined
6719
- : this.locationOptions.map(option => hAsync("biggive-form-field-select-option", { value: option, label: option }))), hAsync("biggive-form-field-select", { placeholder: "Funding", selectedLabel: this.selectedFilterFunding, id: "funding", "space-below": "2" }, this.fundingOptions.length === 0
6737
+ : (Array.isArray(this.locationOptions) ? this.locationOptions : JSON.parse(this.locationOptions)).map(option => (hAsync("biggive-form-field-select-option", { value: option, label: option })))), hAsync("biggive-form-field-select", { placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, id: "funding", "space-below": "2" }, this.fundingOptions.length === 0
6720
6738
  ? undefined
6721
- : this.fundingOptions.map(option => hAsync("biggive-form-field-select-option", { value: option, label: option }))), hAsync("div", { class: "align-right" }, hAsync("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick }))))), hAsync("div", { class: "campaign-grid" }, hAsync("slot", { name: "campaign-grid" })))));
6739
+ : (Array.isArray(this.fundingOptions) ? this.fundingOptions : JSON.parse(this.fundingOptions)).map(option => (hAsync("biggive-form-field-select-option", { value: option, label: option })))), hAsync("div", { class: "align-right" }, hAsync("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick }))))), hAsync("div", { class: "campaign-grid" }, hAsync("slot", { name: "campaign-grid" })))));
6722
6740
  }
6723
6741
  get el() { return getElement(this); }
6724
6742
  static get style() { return biggiveCampaignCardFilterGridCss; }
@@ -6731,16 +6749,16 @@ class BiggiveCampaignCardFilterGrid {
6731
6749
  "searchText": [1, "search-text"],
6732
6750
  "placeholderText": [1, "placeholder-text"],
6733
6751
  "buttonText": [1, "button-text"],
6734
- "categoryOptions": [16],
6735
- "beneficiaryOptions": [16],
6736
- "locationOptions": [16],
6737
- "fundingOptions": [16],
6738
- "filtersApplied": [4, "filters-applied"],
6752
+ "categoryOptions": [1, "category-options"],
6753
+ "beneficiaryOptions": [1, "beneficiary-options"],
6754
+ "locationOptions": [1, "location-options"],
6755
+ "fundingOptions": [1, "funding-options"],
6739
6756
  "selectedSortByOption": [1, "selected-sort-by-option"],
6740
6757
  "selectedFilterCategory": [1, "selected-filter-category"],
6741
6758
  "selectedFilterBeneficiary": [1, "selected-filter-beneficiary"],
6742
6759
  "selectedFilterLocation": [1, "selected-filter-location"],
6743
- "selectedFilterFunding": [1, "selected-filter-funding"]
6760
+ "selectedFilterFunding": [1, "selected-filter-funding"],
6761
+ "filtersApplied": [32]
6744
6762
  },
6745
6763
  "$listeners$": [[0, "doSelectChange", "doOptionSelectCompletedHandler"]],
6746
6764
  "$lazyBundleId$": "-",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biggive/components",
3
- "version": "1.0.175",
3
+ "version": "1.0.176",
4
4
  "description": "Big Give Components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",