@biggive/components 202309260920.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.
- package/dist/biggive/biggive.esm.js +1 -1
- package/dist/biggive/p-c840d826.entry.js +1 -0
- package/dist/cjs/biggive-accordion_42.cjs.entry.js +24 -7
- package/dist/collection/components/biggive-campaign-card-filter-grid/biggive-campaign-card-filter-grid.js +21 -9
- package/dist/collection/components/biggive-form-field-select/biggive-form-field-select.js +14 -9
- package/dist/components/biggive-campaign-card-filter-grid.js +13 -1
- package/dist/components/biggive-form-field-select2.js +11 -6
- package/dist/esm/biggive-accordion_42.entry.js +24 -7
- package/dist/types/components/biggive-campaign-card-filter-grid/biggive-campaign-card-filter-grid.d.ts +5 -4
- package/dist/types/components/biggive-form-field-select/biggive-form-field-select.d.ts +4 -1
- package/dist/types/components.d.ts +10 -10
- package/hydrate/index.js +24 -7
- package/package.json +1 -1
- package/dist/biggive/p-57f9bf7e.entry.js +0 -1
|
@@ -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:
|
|
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
|
-
|
|
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 =
|
|
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 },
|
|
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
|
};
|
|
@@ -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:
|
|
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
|
-
|
|
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 =
|
|
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 },
|
|
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 |
|
|
128
|
-
"resolved": "string | {
|
|
132
|
+
"original": "string | Array<{ label: string; value: string }>",
|
|
133
|
+
"resolved": "string | { label: string; value: string; }[]",
|
|
129
134
|
"references": {
|
|
130
|
-
"
|
|
135
|
+
"Array": {
|
|
131
136
|
"location": "global"
|
|
132
137
|
}
|
|
133
138
|
}
|
|
@@ -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:
|
|
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
|
-
|
|
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 =
|
|
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 },
|
|
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:
|
|
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
|
-
|
|
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 =
|
|
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 },
|
|
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
|
};
|
|
@@ -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 |
|
|
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 |
|
|
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 |
|
|
2084
|
+
"options": string | Array<{ label: string; value: string }>;
|
|
2085
2085
|
/**
|
|
2086
2086
|
* Placeholder
|
|
2087
2087
|
*/
|
package/hydrate/index.js
CHANGED
|
@@ -6969,7 +6969,19 @@ class BiggiveCampaignCardFilterGrid {
|
|
|
6969
6969
|
}
|
|
6970
6970
|
render() {
|
|
6971
6971
|
var _a;
|
|
6972
|
-
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: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', 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: "filter-wrap" }, hAsync("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), hAsync("biggive-popup", { id: "filter-popup" }, hAsync("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), hAsync("div", { class: "select-wrapper-1" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-2" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-3" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-4" }, hAsync("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" })), hAsync("div", { class: "align-right" }, hAsync("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), hAsync("div", { class: "sort-wrap" }, hAsync("biggive-form-field-select", { options:
|
|
6972
|
+
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: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', 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: "filter-wrap" }, hAsync("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), hAsync("biggive-popup", { id: "filter-popup" }, hAsync("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), hAsync("div", { class: "select-wrapper-1" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-2" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-3" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-4" }, hAsync("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" })), hAsync("div", { class: "align-right" }, hAsync("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), hAsync("div", { class: "sort-wrap" }, hAsync("biggive-form-field-select", { options: [
|
|
6973
|
+
{ value: 'amountRaised', label: 'Most raised' },
|
|
6974
|
+
{ value: 'matchFundsRemaining', label: 'Match funds remaining' },
|
|
6975
|
+
], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, 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" }), (this.searchText || '').length > 0 ? hAsync("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), hAsync("div", { class: "selected-filter-wrap" }, hAsync("div", { class: "selected-filters" }), hAsync("div", { class: "clear-all" }, hAsync("a", { onClick: this.handleClearAll }, "Clear all"))), hAsync("div", { class: "campaign-grid" }, hAsync("slot", { name: "campaign-grid" })))));
|
|
6976
|
+
}
|
|
6977
|
+
optionsToArray(options) {
|
|
6978
|
+
if (typeof options === 'string') {
|
|
6979
|
+
options = JSON.parse(options);
|
|
6980
|
+
}
|
|
6981
|
+
if (Array.isArray(options)) {
|
|
6982
|
+
return options.map((option) => ({ value: option, label: option }));
|
|
6983
|
+
}
|
|
6984
|
+
return Object.entries(options).map(entry => ({ value: entry[0], label: entry[1] }));
|
|
6973
6985
|
}
|
|
6974
6986
|
get el() { return getElement(this); }
|
|
6975
6987
|
static get style() { return biggiveCampaignCardFilterGridCss; }
|
|
@@ -7424,23 +7436,28 @@ class BiggiveFormFieldSelect {
|
|
|
7424
7436
|
const greyIfRequired = this.backgroundColour === 'grey' ? ' grey' : '';
|
|
7425
7437
|
let options;
|
|
7426
7438
|
if (typeof this.options === 'string') {
|
|
7427
|
-
|
|
7439
|
+
let parsed = JSON.parse(this.options);
|
|
7440
|
+
if (!Array.isArray(parsed)) {
|
|
7441
|
+
throw new Error('Options should be an Array<{ label: string; value: string }>');
|
|
7442
|
+
}
|
|
7443
|
+
options = parsed;
|
|
7428
7444
|
}
|
|
7429
7445
|
else {
|
|
7430
7446
|
options = this.options;
|
|
7431
7447
|
}
|
|
7432
|
-
if (Array.isArray(options)) {
|
|
7433
|
-
options = Object.fromEntries(options.map((value) => [value, value]));
|
|
7434
|
-
}
|
|
7435
7448
|
if (typeof this.placeholder === 'string' && typeof this.selectedValue !== 'string') {
|
|
7436
|
-
options =
|
|
7449
|
+
options = [{ value: '__placeholder__', label: this.placeholder }, ...options];
|
|
7450
|
+
}
|
|
7451
|
+
if (typeof options === 'undefined') {
|
|
7452
|
+
console.error('options undefined');
|
|
7453
|
+
options = [];
|
|
7437
7454
|
}
|
|
7438
7455
|
return (hAsync("div", { class: "selectWrapper" }, hAsync("label", { class: greyIfRequired }, hAsync("div", { class: 'prompt' + greyIfRequired }, this.prompt), hAsync("div", { class: 'dropdown space-below-' +
|
|
7439
7456
|
this.spaceBelow +
|
|
7440
7457
|
' select-style-' +
|
|
7441
7458
|
this.selectStyle +
|
|
7442
7459
|
(this.prompt === null ? ' noprompt' : '') +
|
|
7443
|
-
(this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, hAsync("div", { class: "sleeve" }, hAsync("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler },
|
|
7460
|
+
(this.selectedOptionColour === 'inherit' ? ' inherit-colour' : '') }, hAsync("div", { class: "sleeve" }, hAsync("select", { class: greyIfRequired, onChange: this.doOptionSelectCompletedHandler }, options.map(option => (hAsync("option", { selected: this.selectedValue === option.value, value: option.value }, option.label)))), hAsync("div", { class: "arrow" }))))));
|
|
7444
7461
|
}
|
|
7445
7462
|
get el() { return getElement(this); }
|
|
7446
7463
|
static get style() { return biggiveFormFieldSelectCss; }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@biggive/components",
|
|
3
3
|
"_comment": "Version number below is automatically replaced during CircleCI build.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "202309271411.0.0",
|
|
5
5
|
"description": "Big Give Components",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.js",
|