@biggive/components 202309211700.0.0 → 202309271411.0.0

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.
@@ -470,7 +470,19 @@ const BiggiveCampaignCardFilterGrid = class {
470
470
  }
471
471
  render() {
472
472
  var _a;
473
- return (index.h("div", { class: 'container space-below-' + this.spaceBelow }, index.h("div", { class: "sleeve" }, index.h("div", { class: "search-wrap" }, index.h("h4", null, this.intro), index.h("div", { class: "field-wrap" }, index.h("div", { class: "input-wrap" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, index.h("path", { d: fontawesomeIcons.faMagnifyingGlass.icon[4].toString() })), index.h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), index.h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), index.h("div", { class: "sort-filter-wrap" }, index.h("div", { class: "filter-wrap" }, index.h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), index.h("biggive-popup", { id: "filter-popup" }, index.h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), index.h("div", { class: "select-wrapper-1" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.categoryOptions, selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), index.h("div", { class: "select-wrapper-2" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.beneficiaryOptions, selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), index.h("div", { class: "select-wrapper-3" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.locationOptions, selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), index.h("div", { class: "select-wrapper-4" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.fundingOptions, selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), index.h("div", { class: "align-right" }, index.h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), index.h("div", { class: "sort-wrap" }, index.h("biggive-form-field-select", { options: { amountRaised: 'Most raised', matchFundsRemaining: 'Match funds remaining' }, prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, index.h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), index.h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? index.h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), index.h("div", { class: "selected-filter-wrap" }, index.h("div", { class: "selected-filters" }), index.h("div", { class: "clear-all" }, index.h("a", { onClick: this.handleClearAll }, "Clear all"))), index.h("div", { class: "campaign-grid" }, index.h("slot", { name: "campaign-grid" })))));
473
+ return (index.h("div", { class: 'container space-below-' + this.spaceBelow }, index.h("div", { class: "sleeve" }, index.h("div", { class: "search-wrap" }, index.h("h4", null, this.intro), index.h("div", { class: "field-wrap" }, index.h("div", { class: "input-wrap" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, index.h("path", { d: fontawesomeIcons.faMagnifyingGlass.icon[4].toString() })), index.h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), index.h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), index.h("div", { class: "sort-filter-wrap" }, index.h("div", { class: "filter-wrap" }, index.h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), index.h("biggive-popup", { id: "filter-popup" }, index.h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), index.h("div", { class: "select-wrapper-1" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), index.h("div", { class: "select-wrapper-2" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), index.h("div", { class: "select-wrapper-3" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), index.h("div", { class: "select-wrapper-4" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), index.h("div", { class: "align-right" }, index.h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), index.h("div", { class: "sort-wrap" }, index.h("biggive-form-field-select", { options: [
474
+ { value: 'amountRaised', label: 'Most raised' },
475
+ { value: 'matchFundsRemaining', label: 'Match funds remaining' },
476
+ ], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, index.h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), index.h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? index.h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), index.h("div", { class: "selected-filter-wrap" }, index.h("div", { class: "selected-filters" }), index.h("div", { class: "clear-all" }, index.h("a", { onClick: this.handleClearAll }, "Clear all"))), index.h("div", { class: "campaign-grid" }, index.h("slot", { name: "campaign-grid" })))));
477
+ }
478
+ optionsToArray(options) {
479
+ if (typeof options === 'string') {
480
+ options = JSON.parse(options);
481
+ }
482
+ if (Array.isArray(options)) {
483
+ return options.map((option) => ({ value: option, label: option }));
484
+ }
485
+ return Object.entries(options).map(entry => ({ value: entry[0], label: entry[1] }));
474
486
  }
475
487
  get el() { return index.getElement(this); }
476
488
  };
@@ -737,23 +749,28 @@ const BiggiveFormFieldSelect = class {
737
749
  const greyIfRequired = this.backgroundColour === 'grey' ? ' grey' : '';
738
750
  let options;
739
751
  if (typeof this.options === 'string') {
740
- options = JSON.parse(this.options);
752
+ let parsed = JSON.parse(this.options);
753
+ if (!Array.isArray(parsed)) {
754
+ throw new Error('Options should be an Array<{ label: string; value: string }>');
755
+ }
756
+ options = parsed;
741
757
  }
742
758
  else {
743
759
  options = this.options;
744
760
  }
745
- if (Array.isArray(options)) {
746
- options = Object.fromEntries(options.map((value) => [value, value]));
747
- }
748
761
  if (typeof this.placeholder === 'string' && typeof this.selectedValue !== 'string') {
749
- options = Object.assign({ __placeholder__: this.placeholder }, options);
762
+ options = [{ value: '__placeholder__', label: this.placeholder }, ...options];
763
+ }
764
+ if (typeof options === 'undefined') {
765
+ console.error('options undefined');
766
+ options = [];
750
767
  }
751
768
  return (index.h("div", { class: "selectWrapper" }, index.h("label", { class: greyIfRequired }, index.h("div", { class: 'prompt' + greyIfRequired }, this.prompt), index.h("div", { class: 'dropdown space-below-' +
752
769
  this.spaceBelow +
753
770
  ' select-style-' +
754
771
  this.selectStyle +
755
772
  (this.prompt === null ? ' noprompt' : '') +
756
- (this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, index.h("div", { class: "sleeve" }, index.h("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler }, Object.entries(options).map((value) => (index.h("option", { selected: this.selectedValue === value[0], value: value[0] }, value[1])))), index.h("div", { class: "arrow" }))))));
773
+ (this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, index.h("div", { class: "sleeve" }, index.h("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler }, options.map(option => (index.h("option", { selected: this.selectedValue === option.value, value: option.value }, option.label)))), index.h("div", { class: "arrow" }))))));
757
774
  }
758
775
  get el() { return index.getElement(this); }
759
776
  };
@@ -42,7 +42,7 @@ const BiggiveBasicCard = class {
42
42
  ' clip-top-right-corner-' +
43
43
  this.clipTopRightCorner +
44
44
  ' add-animation-' +
45
- this.addAnimation, style: { 'background-image': "url('" + this.backgroundImageUrl + "')" } }, index.h("a", { href: this.buttonUrl }, index.h("div", { class: 'sleeve background-colour-' + this.cardColour + ' text-colour-' + this.textColour }, index.h("div", { class: "content-wrap" }, this.icon == true ? (index.h("div", { class: "icon" }, index.h("svg", { width: "53", height: "39", viewBox: "0 0 53 39", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M38.7009 13.6572L52.3535 38.6959H25.0386L38.7009 13.6572Z", class: "fill-black" }), index.h("path", { d: "M20.4789 36.4199L6.36785e-06 5.89713e-05L40.9724 6.61352e-05L20.4789 36.4199Z", class: 'fill-' + this.iconColour })))) : null, this.mainImageUrl != '' ? (index.h("div", { class: "main-image-container" }, index.h("div", { class: "image-wrap" }, index.h("img", { src: this.mainImageUrl, alt: this.mainImageAltText, title: this.mainImageAltText })))) : null, index.h(HeadingTag, { class: "title" }, this.mainTitle), index.h("div", { class: "subtitle" }, this.subtitle), index.h("div", { class: "teaser" }, this.teaser), this.buttonLabel != null && this.buttonUrl != null && this.buttonUrl != '' ? (index.h("div", { class: 'button-wrap align-' + this.buttonAlign }, index.h("biggive-button", { "colour-scheme": this.buttonColourScheme, label: this.buttonLabel }))) : null)))));
45
+ this.addAnimation, style: { 'background-image': "url('" + this.backgroundImageUrl + "')" } }, index.h("a", { href: this.buttonUrl }, index.h("div", { class: 'sleeve background-colour-' + this.cardColour + ' text-colour-' + this.textColour }, index.h("div", { class: "content-wrap" }, this.icon == true ? (index.h("div", { class: "icon" }, index.h("svg", { width: "53", height: "39", viewBox: "0 0 53 39", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M38.7009 13.6572L52.3535 38.6959H25.0386L38.7009 13.6572Z", class: "fill-black" }), index.h("path", { d: "M20.4789 36.4199L6.36785e-06 5.89713e-05L40.9724 6.61352e-05L20.4789 36.4199Z", class: 'fill-' + this.iconColour })))) : null, this.mainImageUrl != '' ? (index.h("div", { class: "main-image-container" }, index.h("div", { class: "image-wrap" }, index.h("img", { src: this.mainImageUrl, alt: this.mainImageAltText, title: this.mainImageAltText })))) : null, index.h(HeadingTag, { class: "title" }, this.mainTitle), index.h("div", { class: "subtitle" }, this.subtitle), index.h("div", { class: "teaser" }, this.teaser), this.buttonLabel != null && this.buttonUrl != null && this.buttonUrl != '' ? (index.h("div", { class: 'button-wrap align-' + this.buttonAlign }, index.h("biggive-button", { "colour-scheme": this.buttonColourScheme, url: this.buttonUrl, label: this.buttonLabel }))) : null)))));
46
46
  }
47
47
  };
48
48
  BiggiveBasicCard.style = biggiveBasicCardCss;
@@ -34,7 +34,7 @@ export class BiggiveBasicCard {
34
34
  ' clip-top-right-corner-' +
35
35
  this.clipTopRightCorner +
36
36
  ' add-animation-' +
37
- this.addAnimation, style: { 'background-image': "url('" + this.backgroundImageUrl + "')" } }, h("a", { href: this.buttonUrl }, h("div", { class: 'sleeve background-colour-' + this.cardColour + ' text-colour-' + this.textColour }, h("div", { class: "content-wrap" }, this.icon == true ? (h("div", { class: "icon" }, h("svg", { width: "53", height: "39", viewBox: "0 0 53 39", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M38.7009 13.6572L52.3535 38.6959H25.0386L38.7009 13.6572Z", class: "fill-black" }), h("path", { d: "M20.4789 36.4199L6.36785e-06 5.89713e-05L40.9724 6.61352e-05L20.4789 36.4199Z", class: 'fill-' + this.iconColour })))) : null, this.mainImageUrl != '' ? (h("div", { class: "main-image-container" }, h("div", { class: "image-wrap" }, h("img", { src: this.mainImageUrl, alt: this.mainImageAltText, title: this.mainImageAltText })))) : null, h(HeadingTag, { class: "title" }, this.mainTitle), h("div", { class: "subtitle" }, this.subtitle), h("div", { class: "teaser" }, this.teaser), this.buttonLabel != null && this.buttonUrl != null && this.buttonUrl != '' ? (h("div", { class: 'button-wrap align-' + this.buttonAlign }, h("biggive-button", { "colour-scheme": this.buttonColourScheme, label: this.buttonLabel }))) : null)))));
37
+ this.addAnimation, style: { 'background-image': "url('" + this.backgroundImageUrl + "')" } }, h("a", { href: this.buttonUrl }, h("div", { class: 'sleeve background-colour-' + this.cardColour + ' text-colour-' + this.textColour }, h("div", { class: "content-wrap" }, this.icon == true ? (h("div", { class: "icon" }, h("svg", { width: "53", height: "39", viewBox: "0 0 53 39", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M38.7009 13.6572L52.3535 38.6959H25.0386L38.7009 13.6572Z", class: "fill-black" }), h("path", { d: "M20.4789 36.4199L6.36785e-06 5.89713e-05L40.9724 6.61352e-05L20.4789 36.4199Z", class: 'fill-' + this.iconColour })))) : null, this.mainImageUrl != '' ? (h("div", { class: "main-image-container" }, h("div", { class: "image-wrap" }, h("img", { src: this.mainImageUrl, alt: this.mainImageAltText, title: this.mainImageAltText })))) : null, h(HeadingTag, { class: "title" }, this.mainTitle), h("div", { class: "subtitle" }, this.subtitle), h("div", { class: "teaser" }, this.teaser), this.buttonLabel != null && this.buttonUrl != null && this.buttonUrl != '' ? (h("div", { class: 'button-wrap align-' + this.buttonAlign }, h("biggive-button", { "colour-scheme": this.buttonColourScheme, url: this.buttonUrl, label: this.buttonLabel }))) : null)))));
38
38
  }
39
39
  static get is() { return "biggive-basic-card"; }
40
40
  static get encapsulation() { return "shadow"; }
@@ -185,7 +185,19 @@ export class BiggiveCampaignCardFilterGrid {
185
185
  }
186
186
  render() {
187
187
  var _a;
188
- return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.categoryOptions, selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.beneficiaryOptions, selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.locationOptions, selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.fundingOptions, selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: { amountRaised: 'Most raised', matchFundsRemaining: 'Match funds remaining' }, prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }), h("div", { class: "clear-all" }, h("a", { onClick: this.handleClearAll }, "Clear all"))), h("div", { class: "campaign-grid" }, h("slot", { name: "campaign-grid" })))));
188
+ return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: [
189
+ { value: 'amountRaised', label: 'Most raised' },
190
+ { value: 'matchFundsRemaining', label: 'Match funds remaining' },
191
+ ], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }), h("div", { class: "clear-all" }, h("a", { onClick: this.handleClearAll }, "Clear all"))), h("div", { class: "campaign-grid" }, h("slot", { name: "campaign-grid" })))));
192
+ }
193
+ optionsToArray(options) {
194
+ if (typeof options === 'string') {
195
+ options = JSON.parse(options);
196
+ }
197
+ if (Array.isArray(options)) {
198
+ return options.map((option) => ({ value: option, label: option }));
199
+ }
200
+ return Object.entries(options).map(entry => ({ value: entry[0], label: entry[1] }));
189
201
  }
190
202
  static get is() { return "biggive-campaign-card-filter-grid"; }
191
203
  static get encapsulation() { return "shadow"; }
@@ -295,8 +307,8 @@ export class BiggiveCampaignCardFilterGrid {
295
307
  "type": "string",
296
308
  "mutable": false,
297
309
  "complexType": {
298
- "original": "string | Record<string, string>",
299
- "resolved": "string | { [x: string]: string; }",
310
+ "original": "string | Record<string, string> | string[]",
311
+ "resolved": "string | string[] | { [x: string]: string; }",
300
312
  "references": {
301
313
  "Record": {
302
314
  "location": "global"
@@ -316,8 +328,8 @@ export class BiggiveCampaignCardFilterGrid {
316
328
  "type": "string",
317
329
  "mutable": false,
318
330
  "complexType": {
319
- "original": "string | Record<string, string>",
320
- "resolved": "string | { [x: string]: string; }",
331
+ "original": "string | Record<string, string> | string[]",
332
+ "resolved": "string | string[] | { [x: string]: string; }",
321
333
  "references": {
322
334
  "Record": {
323
335
  "location": "global"
@@ -337,8 +349,8 @@ export class BiggiveCampaignCardFilterGrid {
337
349
  "type": "string",
338
350
  "mutable": false,
339
351
  "complexType": {
340
- "original": "string | Record<string, string>",
341
- "resolved": "string | { [x: string]: string; }",
352
+ "original": "string | Record<string, string> | string[]",
353
+ "resolved": "string | string[] | { [x: string]: string; }",
342
354
  "references": {
343
355
  "Record": {
344
356
  "location": "global"
@@ -358,8 +370,8 @@ export class BiggiveCampaignCardFilterGrid {
358
370
  "type": "string",
359
371
  "mutable": false,
360
372
  "complexType": {
361
- "original": "string | Record<string, string>",
362
- "resolved": "string | { [x: string]: string; }",
373
+ "original": "string | Record<string, string> | string[]",
374
+ "resolved": "string | string[] | { [x: string]: string; }",
363
375
  "references": {
364
376
  "Record": {
365
377
  "location": "global"
@@ -22,23 +22,28 @@ export class BiggiveFormFieldSelect {
22
22
  const greyIfRequired = this.backgroundColour === 'grey' ? ' grey' : '';
23
23
  let options;
24
24
  if (typeof this.options === 'string') {
25
- options = JSON.parse(this.options);
25
+ let parsed = JSON.parse(this.options);
26
+ if (!Array.isArray(parsed)) {
27
+ throw new Error('Options should be an Array<{ label: string; value: string }>');
28
+ }
29
+ options = parsed;
26
30
  }
27
31
  else {
28
32
  options = this.options;
29
33
  }
30
- if (Array.isArray(options)) {
31
- options = Object.fromEntries(options.map((value) => [value, value]));
32
- }
33
34
  if (typeof this.placeholder === 'string' && typeof this.selectedValue !== 'string') {
34
- options = Object.assign({ __placeholder__: this.placeholder }, options);
35
+ options = [{ value: '__placeholder__', label: this.placeholder }, ...options];
36
+ }
37
+ if (typeof options === 'undefined') {
38
+ console.error('options undefined');
39
+ options = [];
35
40
  }
36
41
  return (h("div", { class: "selectWrapper" }, h("label", { class: greyIfRequired }, h("div", { class: 'prompt' + greyIfRequired }, this.prompt), h("div", { class: 'dropdown space-below-' +
37
42
  this.spaceBelow +
38
43
  ' select-style-' +
39
44
  this.selectStyle +
40
45
  (this.prompt === null ? ' noprompt' : '') +
41
- (this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, h("div", { class: "sleeve" }, h("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler }, Object.entries(options).map((value) => (h("option", { selected: this.selectedValue === value[0], value: value[0] }, value[1])))), h("div", { class: "arrow" }))))));
46
+ (this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, h("div", { class: "sleeve" }, h("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler }, options.map(option => (h("option", { selected: this.selectedValue === option.value, value: option.value }, option.label)))), h("div", { class: "arrow" }))))));
42
47
  }
43
48
  static get is() { return "biggive-form-field-select"; }
44
49
  static get encapsulation() { return "shadow"; }
@@ -124,10 +129,10 @@ export class BiggiveFormFieldSelect {
124
129
  "type": "string",
125
130
  "mutable": false,
126
131
  "complexType": {
127
- "original": "string | Record<string, string>",
128
- "resolved": "string | { [x: string]: string; }",
132
+ "original": "string | Array<{ label: string; value: string }>",
133
+ "resolved": "string | { label: string; value: string; }[]",
129
134
  "references": {
130
- "Record": {
135
+ "Array": {
131
136
  "location": "global"
132
137
  }
133
138
  }
@@ -41,7 +41,7 @@ const BiggiveBasicCard$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
41
41
  ' clip-top-right-corner-' +
42
42
  this.clipTopRightCorner +
43
43
  ' add-animation-' +
44
- this.addAnimation, style: { 'background-image': "url('" + this.backgroundImageUrl + "')" } }, h("a", { href: this.buttonUrl }, h("div", { class: 'sleeve background-colour-' + this.cardColour + ' text-colour-' + this.textColour }, h("div", { class: "content-wrap" }, this.icon == true ? (h("div", { class: "icon" }, h("svg", { width: "53", height: "39", viewBox: "0 0 53 39", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M38.7009 13.6572L52.3535 38.6959H25.0386L38.7009 13.6572Z", class: "fill-black" }), h("path", { d: "M20.4789 36.4199L6.36785e-06 5.89713e-05L40.9724 6.61352e-05L20.4789 36.4199Z", class: 'fill-' + this.iconColour })))) : null, this.mainImageUrl != '' ? (h("div", { class: "main-image-container" }, h("div", { class: "image-wrap" }, h("img", { src: this.mainImageUrl, alt: this.mainImageAltText, title: this.mainImageAltText })))) : null, h(HeadingTag, { class: "title" }, this.mainTitle), h("div", { class: "subtitle" }, this.subtitle), h("div", { class: "teaser" }, this.teaser), this.buttonLabel != null && this.buttonUrl != null && this.buttonUrl != '' ? (h("div", { class: 'button-wrap align-' + this.buttonAlign }, h("biggive-button", { "colour-scheme": this.buttonColourScheme, label: this.buttonLabel }))) : null)))));
44
+ this.addAnimation, style: { 'background-image': "url('" + this.backgroundImageUrl + "')" } }, h("a", { href: this.buttonUrl }, h("div", { class: 'sleeve background-colour-' + this.cardColour + ' text-colour-' + this.textColour }, h("div", { class: "content-wrap" }, this.icon == true ? (h("div", { class: "icon" }, h("svg", { width: "53", height: "39", viewBox: "0 0 53 39", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M38.7009 13.6572L52.3535 38.6959H25.0386L38.7009 13.6572Z", class: "fill-black" }), h("path", { d: "M20.4789 36.4199L6.36785e-06 5.89713e-05L40.9724 6.61352e-05L20.4789 36.4199Z", class: 'fill-' + this.iconColour })))) : null, this.mainImageUrl != '' ? (h("div", { class: "main-image-container" }, h("div", { class: "image-wrap" }, h("img", { src: this.mainImageUrl, alt: this.mainImageAltText, title: this.mainImageAltText })))) : null, h(HeadingTag, { class: "title" }, this.mainTitle), h("div", { class: "subtitle" }, this.subtitle), h("div", { class: "teaser" }, this.teaser), this.buttonLabel != null && this.buttonUrl != null && this.buttonUrl != '' ? (h("div", { class: 'button-wrap align-' + this.buttonAlign }, h("biggive-button", { "colour-scheme": this.buttonColourScheme, url: this.buttonUrl, label: this.buttonLabel }))) : null)))));
45
45
  }
46
46
  static get style() { return biggiveBasicCardCss; }
47
47
  }, [1, "biggive-basic-card", {
@@ -195,7 +195,19 @@ const BiggiveCampaignCardFilterGrid$1 = /*@__PURE__*/ proxyCustomElement(class e
195
195
  }
196
196
  render() {
197
197
  var _a;
198
- return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.categoryOptions, selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.beneficiaryOptions, selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.locationOptions, selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.fundingOptions, selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: { amountRaised: 'Most raised', matchFundsRemaining: 'Match funds remaining' }, prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }), h("div", { class: "clear-all" }, h("a", { onClick: this.handleClearAll }, "Clear all"))), h("div", { class: "campaign-grid" }, h("slot", { name: "campaign-grid" })))));
198
+ return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: [
199
+ { value: 'amountRaised', label: 'Most raised' },
200
+ { value: 'matchFundsRemaining', label: 'Match funds remaining' },
201
+ ], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }), h("div", { class: "clear-all" }, h("a", { onClick: this.handleClearAll }, "Clear all"))), h("div", { class: "campaign-grid" }, h("slot", { name: "campaign-grid" })))));
202
+ }
203
+ optionsToArray(options) {
204
+ if (typeof options === 'string') {
205
+ options = JSON.parse(options);
206
+ }
207
+ if (Array.isArray(options)) {
208
+ return options.map((option) => ({ value: option, label: option }));
209
+ }
210
+ return Object.entries(options).map(entry => ({ value: entry[0], label: entry[1] }));
199
211
  }
200
212
  get el() { return this; }
201
213
  static get style() { return biggiveCampaignCardFilterGridCss; }
@@ -28,23 +28,28 @@ const BiggiveFormFieldSelect = /*@__PURE__*/ proxyCustomElement(class extends HT
28
28
  const greyIfRequired = this.backgroundColour === 'grey' ? ' grey' : '';
29
29
  let options;
30
30
  if (typeof this.options === 'string') {
31
- options = JSON.parse(this.options);
31
+ let parsed = JSON.parse(this.options);
32
+ if (!Array.isArray(parsed)) {
33
+ throw new Error('Options should be an Array<{ label: string; value: string }>');
34
+ }
35
+ options = parsed;
32
36
  }
33
37
  else {
34
38
  options = this.options;
35
39
  }
36
- if (Array.isArray(options)) {
37
- options = Object.fromEntries(options.map((value) => [value, value]));
38
- }
39
40
  if (typeof this.placeholder === 'string' && typeof this.selectedValue !== 'string') {
40
- options = Object.assign({ __placeholder__: this.placeholder }, options);
41
+ options = [{ value: '__placeholder__', label: this.placeholder }, ...options];
42
+ }
43
+ if (typeof options === 'undefined') {
44
+ console.error('options undefined');
45
+ options = [];
41
46
  }
42
47
  return (h("div", { class: "selectWrapper" }, h("label", { class: greyIfRequired }, h("div", { class: 'prompt' + greyIfRequired }, this.prompt), h("div", { class: 'dropdown space-below-' +
43
48
  this.spaceBelow +
44
49
  ' select-style-' +
45
50
  this.selectStyle +
46
51
  (this.prompt === null ? ' noprompt' : '') +
47
- (this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, h("div", { class: "sleeve" }, h("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler }, Object.entries(options).map((value) => (h("option", { selected: this.selectedValue === value[0], value: value[0] }, value[1])))), h("div", { class: "arrow" }))))));
52
+ (this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, h("div", { class: "sleeve" }, h("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler }, options.map(option => (h("option", { selected: this.selectedValue === option.value, value: option.value }, option.label)))), h("div", { class: "arrow" }))))));
48
53
  }
49
54
  get el() { return this; }
50
55
  static get style() { return biggiveFormFieldSelectCss; }
@@ -466,7 +466,19 @@ const BiggiveCampaignCardFilterGrid = class {
466
466
  }
467
467
  render() {
468
468
  var _a;
469
- return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.categoryOptions, selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.beneficiaryOptions, selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.locationOptions, selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.fundingOptions, selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: { amountRaised: 'Most raised', matchFundsRemaining: 'Match funds remaining' }, prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }), h("div", { class: "clear-all" }, h("a", { onClick: this.handleClearAll }, "Clear all"))), h("div", { class: "campaign-grid" }, h("slot", { name: "campaign-grid" })))));
469
+ return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: [
470
+ { value: 'amountRaised', label: 'Most raised' },
471
+ { value: 'matchFundsRemaining', label: 'Match funds remaining' },
472
+ ], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }), h("div", { class: "clear-all" }, h("a", { onClick: this.handleClearAll }, "Clear all"))), h("div", { class: "campaign-grid" }, h("slot", { name: "campaign-grid" })))));
473
+ }
474
+ optionsToArray(options) {
475
+ if (typeof options === 'string') {
476
+ options = JSON.parse(options);
477
+ }
478
+ if (Array.isArray(options)) {
479
+ return options.map((option) => ({ value: option, label: option }));
480
+ }
481
+ return Object.entries(options).map(entry => ({ value: entry[0], label: entry[1] }));
470
482
  }
471
483
  get el() { return getElement(this); }
472
484
  };
@@ -733,23 +745,28 @@ const BiggiveFormFieldSelect = class {
733
745
  const greyIfRequired = this.backgroundColour === 'grey' ? ' grey' : '';
734
746
  let options;
735
747
  if (typeof this.options === 'string') {
736
- options = JSON.parse(this.options);
748
+ let parsed = JSON.parse(this.options);
749
+ if (!Array.isArray(parsed)) {
750
+ throw new Error('Options should be an Array<{ label: string; value: string }>');
751
+ }
752
+ options = parsed;
737
753
  }
738
754
  else {
739
755
  options = this.options;
740
756
  }
741
- if (Array.isArray(options)) {
742
- options = Object.fromEntries(options.map((value) => [value, value]));
743
- }
744
757
  if (typeof this.placeholder === 'string' && typeof this.selectedValue !== 'string') {
745
- options = Object.assign({ __placeholder__: this.placeholder }, options);
758
+ options = [{ value: '__placeholder__', label: this.placeholder }, ...options];
759
+ }
760
+ if (typeof options === 'undefined') {
761
+ console.error('options undefined');
762
+ options = [];
746
763
  }
747
764
  return (h("div", { class: "selectWrapper" }, h("label", { class: greyIfRequired }, h("div", { class: 'prompt' + greyIfRequired }, this.prompt), h("div", { class: 'dropdown space-below-' +
748
765
  this.spaceBelow +
749
766
  ' select-style-' +
750
767
  this.selectStyle +
751
768
  (this.prompt === null ? ' noprompt' : '') +
752
- (this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, h("div", { class: "sleeve" }, h("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler }, Object.entries(options).map((value) => (h("option", { selected: this.selectedValue === value[0], value: value[0] }, value[1])))), h("div", { class: "arrow" }))))));
769
+ (this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, h("div", { class: "sleeve" }, h("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler }, options.map(option => (h("option", { selected: this.selectedValue === option.value, value: option.value }, option.label)))), h("div", { class: "arrow" }))))));
753
770
  }
754
771
  get el() { return getElement(this); }
755
772
  };
@@ -38,7 +38,7 @@ const BiggiveBasicCard = class {
38
38
  ' clip-top-right-corner-' +
39
39
  this.clipTopRightCorner +
40
40
  ' add-animation-' +
41
- this.addAnimation, style: { 'background-image': "url('" + this.backgroundImageUrl + "')" } }, h("a", { href: this.buttonUrl }, h("div", { class: 'sleeve background-colour-' + this.cardColour + ' text-colour-' + this.textColour }, h("div", { class: "content-wrap" }, this.icon == true ? (h("div", { class: "icon" }, h("svg", { width: "53", height: "39", viewBox: "0 0 53 39", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M38.7009 13.6572L52.3535 38.6959H25.0386L38.7009 13.6572Z", class: "fill-black" }), h("path", { d: "M20.4789 36.4199L6.36785e-06 5.89713e-05L40.9724 6.61352e-05L20.4789 36.4199Z", class: 'fill-' + this.iconColour })))) : null, this.mainImageUrl != '' ? (h("div", { class: "main-image-container" }, h("div", { class: "image-wrap" }, h("img", { src: this.mainImageUrl, alt: this.mainImageAltText, title: this.mainImageAltText })))) : null, h(HeadingTag, { class: "title" }, this.mainTitle), h("div", { class: "subtitle" }, this.subtitle), h("div", { class: "teaser" }, this.teaser), this.buttonLabel != null && this.buttonUrl != null && this.buttonUrl != '' ? (h("div", { class: 'button-wrap align-' + this.buttonAlign }, h("biggive-button", { "colour-scheme": this.buttonColourScheme, label: this.buttonLabel }))) : null)))));
41
+ this.addAnimation, style: { 'background-image': "url('" + this.backgroundImageUrl + "')" } }, h("a", { href: this.buttonUrl }, h("div", { class: 'sleeve background-colour-' + this.cardColour + ' text-colour-' + this.textColour }, h("div", { class: "content-wrap" }, this.icon == true ? (h("div", { class: "icon" }, h("svg", { width: "53", height: "39", viewBox: "0 0 53 39", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M38.7009 13.6572L52.3535 38.6959H25.0386L38.7009 13.6572Z", class: "fill-black" }), h("path", { d: "M20.4789 36.4199L6.36785e-06 5.89713e-05L40.9724 6.61352e-05L20.4789 36.4199Z", class: 'fill-' + this.iconColour })))) : null, this.mainImageUrl != '' ? (h("div", { class: "main-image-container" }, h("div", { class: "image-wrap" }, h("img", { src: this.mainImageUrl, alt: this.mainImageAltText, title: this.mainImageAltText })))) : null, h(HeadingTag, { class: "title" }, this.mainTitle), h("div", { class: "subtitle" }, this.subtitle), h("div", { class: "teaser" }, this.teaser), this.buttonLabel != null && this.buttonUrl != null && this.buttonUrl != '' ? (h("div", { class: 'button-wrap align-' + this.buttonAlign }, h("biggive-button", { "colour-scheme": this.buttonColourScheme, url: this.buttonUrl, label: this.buttonLabel }))) : null)))));
42
42
  }
43
43
  };
44
44
  BiggiveBasicCard.style = biggiveBasicCardCss;
@@ -47,19 +47,19 @@ export declare class BiggiveCampaignCardFilterGrid {
47
47
  /**
48
48
  * JSON array of category key/values, or takes a stringified equiavalent (for Storybook)
49
49
  */
50
- categoryOptions: string | Record<string, string>;
50
+ categoryOptions: string | Record<string, string> | string[];
51
51
  /**
52
52
  * JSON array of beneficiary key/values, or takes a stringified equiavalent (for Storybook)
53
53
  */
54
- beneficiaryOptions: string | Record<string, string>;
54
+ beneficiaryOptions: string | Record<string, string> | string[];
55
55
  /**
56
56
  * JSON array of location key/values, or takes a stringified equiavalent (for Storybook)
57
57
  */
58
- locationOptions: string | Record<string, string>;
58
+ locationOptions: string | Record<string, string> | string[];
59
59
  /**
60
60
  * JSON array of funding key/values, or takes a stringified equiavalent (for Storybook)
61
61
  */
62
- fundingOptions: string | Record<string, string>;
62
+ fundingOptions: string | Record<string, string> | string[];
63
63
  /**
64
64
  * This helps us inject a pre-selected dropdown value from outside of this component.
65
65
  * This is especially helpful for the Meta campaign and Explore pages, where searching
@@ -103,4 +103,5 @@ export declare class BiggiveCampaignCardFilterGrid {
103
103
  private handleClearAll;
104
104
  componentWillRender(): void;
105
105
  render(): any;
106
+ private optionsToArray;
106
107
  }
@@ -10,7 +10,10 @@ export declare class BiggiveFormFieldSelect {
10
10
  /**
11
11
  * JSON array of category key/values, or takes a stringified equiavalent (for Storybook)
12
12
  */
13
- options: string | Record<string, string>;
13
+ options: string | Array<{
14
+ label: string;
15
+ value: string;
16
+ }>;
14
17
  selectStyle: 'bordered' | 'underlined';
15
18
  /**
16
19
  * Must match background of containing element, or unintended shape will appear.
@@ -361,7 +361,7 @@ export namespace Components {
361
361
  /**
362
362
  * JSON array of beneficiary key/values, or takes a stringified equiavalent (for Storybook)
363
363
  */
364
- "beneficiaryOptions": string | Record<string, string>;
364
+ "beneficiaryOptions": string | Record<string, string> | string[];
365
365
  /**
366
366
  * Defines the text on the search button
367
367
  */
@@ -369,11 +369,11 @@ export namespace Components {
369
369
  /**
370
370
  * JSON array of category key/values, or takes a stringified equiavalent (for Storybook)
371
371
  */
372
- "categoryOptions": string | Record<string, string>;
372
+ "categoryOptions": string | Record<string, string> | string[];
373
373
  /**
374
374
  * JSON array of funding key/values, or takes a stringified equiavalent (for Storybook)
375
375
  */
376
- "fundingOptions": string | Record<string, string>;
376
+ "fundingOptions": string | Record<string, string> | string[];
377
377
  /**
378
378
  * Intro
379
379
  */
@@ -381,7 +381,7 @@ export namespace Components {
381
381
  /**
382
382
  * JSON array of location key/values, or takes a stringified equiavalent (for Storybook)
383
383
  */
384
- "locationOptions": string | Record<string, string>;
384
+ "locationOptions": string | Record<string, string> | string[];
385
385
  /**
386
386
  * Defines the text displayed as the placeholder in the input field before the user types anything
387
387
  */
@@ -533,7 +533,7 @@ export namespace Components {
533
533
  /**
534
534
  * JSON array of category key/values, or takes a stringified equiavalent (for Storybook)
535
535
  */
536
- "options": string | Record<string, string>;
536
+ "options": string | Array<{ label: string; value: string }>;
537
537
  /**
538
538
  * Placeholder
539
539
  */
@@ -1891,7 +1891,7 @@ declare namespace LocalJSX {
1891
1891
  /**
1892
1892
  * JSON array of beneficiary key/values, or takes a stringified equiavalent (for Storybook)
1893
1893
  */
1894
- "beneficiaryOptions"?: string | Record<string, string>;
1894
+ "beneficiaryOptions"?: string | Record<string, string> | string[];
1895
1895
  /**
1896
1896
  * Defines the text on the search button
1897
1897
  */
@@ -1899,11 +1899,11 @@ declare namespace LocalJSX {
1899
1899
  /**
1900
1900
  * JSON array of category key/values, or takes a stringified equiavalent (for Storybook)
1901
1901
  */
1902
- "categoryOptions"?: string | Record<string, string>;
1902
+ "categoryOptions"?: string | Record<string, string> | string[];
1903
1903
  /**
1904
1904
  * JSON array of funding key/values, or takes a stringified equiavalent (for Storybook)
1905
1905
  */
1906
- "fundingOptions"?: string | Record<string, string>;
1906
+ "fundingOptions"?: string | Record<string, string> | string[];
1907
1907
  /**
1908
1908
  * Intro
1909
1909
  */
@@ -1911,7 +1911,7 @@ declare namespace LocalJSX {
1911
1911
  /**
1912
1912
  * JSON array of location key/values, or takes a stringified equiavalent (for Storybook)
1913
1913
  */
1914
- "locationOptions"?: string | Record<string, string>;
1914
+ "locationOptions"?: string | Record<string, string> | string[];
1915
1915
  /**
1916
1916
  * This event `doSearchAndFilterUpdate` event is emitted and propogates to the parent component which handles it
1917
1917
  */
@@ -2081,7 +2081,7 @@ declare namespace LocalJSX {
2081
2081
  /**
2082
2082
  * JSON array of category key/values, or takes a stringified equiavalent (for Storybook)
2083
2083
  */
2084
- "options": string | Record<string, string>;
2084
+ "options": string | Array<{ label: string; value: string }>;
2085
2085
  /**
2086
2086
  * Placeholder
2087
2087
  */