@internetarchive/collection-browser 3.1.0 → 3.1.1-alpha-webdev6778.2

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.
Files changed (81) hide show
  1. package/dist/src/app-root.js +606 -606
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.d.ts +9 -0
  4. package/dist/src/collection-browser.js +7 -0
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/facet-row.js +140 -140
  7. package/dist/src/collection-facets/facet-row.js.map +1 -1
  8. package/dist/src/collection-facets/models.js.map +1 -1
  9. package/dist/src/collection-facets/more-facets-content.d.ts +1 -0
  10. package/dist/src/collection-facets/more-facets-content.js +122 -118
  11. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  12. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
  13. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  14. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
  15. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  16. package/dist/src/collection-facets.d.ts +1 -0
  17. package/dist/src/collection-facets.js +269 -265
  18. package/dist/src/collection-facets.js.map +1 -1
  19. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  20. package/dist/src/data-source/collection-browser-data-source.js +27 -13
  21. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  22. package/dist/src/data-source/collection-browser-query-state.d.ts +1 -0
  23. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  24. package/dist/src/data-source/models.d.ts +1 -1
  25. package/dist/src/data-source/models.js.map +1 -1
  26. package/dist/src/expanded-date-picker.js +52 -52
  27. package/dist/src/expanded-date-picker.js.map +1 -1
  28. package/dist/src/manage/manage-bar.js +77 -77
  29. package/dist/src/manage/manage-bar.js.map +1 -1
  30. package/dist/src/models.js.map +1 -1
  31. package/dist/src/sort-filter-bar/sort-filter-bar.js +376 -376
  32. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  33. package/dist/src/tiles/grid/collection-tile.js +77 -77
  34. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  35. package/dist/src/tiles/grid/item-tile.js +139 -139
  36. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  37. package/dist/src/tiles/grid/search-tile.js +42 -42
  38. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  39. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
  40. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  41. package/dist/src/tiles/list/tile-list.js +297 -297
  42. package/dist/src/tiles/list/tile-list.js.map +1 -1
  43. package/dist/src/tiles/tile-dispatcher.js +200 -200
  44. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  45. package/dist/src/utils/analytics-events.js.map +1 -1
  46. package/dist/test/collection-facets/facet-row.test.js +23 -23
  47. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  48. package/dist/test/collection-facets.test.js +20 -20
  49. package/dist/test/collection-facets.test.js.map +1 -1
  50. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +37 -37
  51. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  52. package/dist/test/tiles/list/tile-list.test.js +113 -113
  53. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  54. package/package.json +2 -2
  55. package/src/app-root.ts +1140 -1140
  56. package/src/collection-browser.ts +14 -0
  57. package/src/collection-facets/facet-row.ts +296 -296
  58. package/src/collection-facets/models.ts +10 -10
  59. package/src/collection-facets/more-facets-content.ts +639 -636
  60. package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
  61. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
  62. package/src/collection-facets.ts +995 -992
  63. package/src/data-source/collection-browser-data-source-interface.ts +333 -333
  64. package/src/data-source/collection-browser-data-source.ts +21 -11
  65. package/src/data-source/collection-browser-query-state.ts +1 -0
  66. package/src/data-source/models.ts +1 -1
  67. package/src/expanded-date-picker.ts +191 -191
  68. package/src/manage/manage-bar.ts +247 -247
  69. package/src/models.ts +870 -870
  70. package/src/sort-filter-bar/sort-filter-bar.ts +1283 -1283
  71. package/src/tiles/grid/collection-tile.ts +162 -162
  72. package/src/tiles/grid/item-tile.ts +339 -339
  73. package/src/tiles/grid/search-tile.ts +90 -90
  74. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  75. package/src/tiles/list/tile-list.ts +696 -696
  76. package/src/tiles/tile-dispatcher.ts +486 -486
  77. package/src/utils/analytics-events.ts +29 -29
  78. package/test/collection-facets/facet-row.test.ts +375 -375
  79. package/test/collection-facets.test.ts +928 -928
  80. package/test/sort-filter-bar/sort-filter-bar.test.ts +885 -885
  81. package/test/tiles/list/tile-list.test.ts +497 -497
@@ -1,636 +1,639 @@
1
- import {
2
- css,
3
- CSSResultGroup,
4
- html,
5
- LitElement,
6
- nothing,
7
- PropertyValues,
8
- TemplateResult,
9
- } from 'lit';
10
- import { customElement, property, state } from 'lit/decorators.js';
11
- import {
12
- Aggregation,
13
- Bucket,
14
- SearchServiceInterface,
15
- SearchParams,
16
- SearchType,
17
- AggregationSortType,
18
- FilterMap,
19
- PageType,
20
- } from '@internetarchive/search-service';
21
- import type { ModalManagerInterface } from '@internetarchive/modal-manager';
22
- import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';
23
- import { msg } from '@lit/localize';
24
- import {
25
- SelectedFacets,
26
- FacetGroup,
27
- FacetBucket,
28
- FacetOption,
29
- facetTitles,
30
- suppressedCollections,
31
- valueFacetSort,
32
- defaultFacetSort,
33
- getDefaultSelectedFacets,
34
- FacetEventDetails,
35
- } from '../models';
36
- import type {
37
- CollectionTitles,
38
- PageSpecifierParams,
39
- TVChannelAliases,
40
- } from '../data-source/models';
41
- import '@internetarchive/ia-activity-indicator';
42
- import './more-facets-pagination';
43
- import './facets-template';
44
- import {
45
- analyticsActions,
46
- analyticsCategories,
47
- } from '../utils/analytics-events';
48
- import './toggle-switch';
49
- import { srOnlyStyle } from '../styles/sr-only';
50
- import {
51
- mergeSelectedFacets,
52
- sortBucketsBySelectionState,
53
- updateSelectedFacetBucket,
54
- } from '../utils/facet-utils';
55
- import {
56
- MORE_FACETS__DEFAULT_PAGE_SIZE,
57
- MORE_FACETS__MAX_AGGREGATIONS,
58
- } from './models';
59
-
60
- @customElement('more-facets-content')
61
- export class MoreFacetsContent extends LitElement {
62
- @property({ type: String }) facetKey?: FacetOption;
63
-
64
- @property({ type: String }) query?: string;
65
-
66
- @property({ type: Object }) filterMap?: FilterMap;
67
-
68
- @property({ type: Number }) searchType?: SearchType;
69
-
70
- @property({ type: Object }) pageSpecifierParams?: PageSpecifierParams;
71
-
72
- @property({ type: Object })
73
- collectionTitles?: CollectionTitles;
74
-
75
- @property({ type: Object })
76
- tvChannelAliases?: TVChannelAliases;
77
-
78
- /**
79
- * Maximum number of facets to show per page within the modal.
80
- */
81
- @property({ type: Number }) facetsPerPage = MORE_FACETS__DEFAULT_PAGE_SIZE;
82
-
83
- /**
84
- * Whether we are waiting for facet data to load.
85
- * We begin with this set to true so that we show an initial loading indicator.
86
- */
87
- @property({ type: Boolean }) facetsLoading = true;
88
-
89
- /**
90
- * The set of pre-existing facet selections (including both selected & negated facets).
91
- */
92
- @property({ type: Object }) selectedFacets?: SelectedFacets;
93
-
94
- @property({ type: Number }) sortedBy: AggregationSortType =
95
- AggregationSortType.COUNT;
96
-
97
- @property({ type: Boolean }) isTvSearch = false;
98
-
99
- @property({ type: Object }) modalManager?: ModalManagerInterface;
100
-
101
- @property({ type: Object }) searchService?: SearchServiceInterface;
102
-
103
- @property({ type: Object, attribute: false })
104
- analyticsHandler?: AnalyticsManagerInterface;
105
-
106
- /**
107
- * The full set of aggregations received from the search service
108
- */
109
- @state() private aggregations?: Record<string, Aggregation>;
110
-
111
- /**
112
- * A FacetGroup storing the full set of facet buckets to be shown on the dialog.
113
- */
114
- @state() private facetGroup?: FacetGroup;
115
-
116
- /**
117
- * An object holding any changes the patron has made to their facet selections
118
- * within the modal dialog but which they have not yet applied. These are
119
- * eventually merged into the existing `selectedFacets` when the patron applies
120
- * their changes, or discarded if they cancel/close the dialog.
121
- */
122
- @state() private unappliedFacetChanges: SelectedFacets =
123
- getDefaultSelectedFacets();
124
-
125
- /**
126
- * Which page of facets we are showing.
127
- */
128
- @state() private pageNumber = 1;
129
-
130
- willUpdate(changed: PropertyValues): void {
131
- if (
132
- changed.has('aggregations') ||
133
- changed.has('facetsPerPage') ||
134
- changed.has('sortedBy') ||
135
- changed.has('selectedFacets') ||
136
- changed.has('unappliedFacetChanges')
137
- ) {
138
- // Convert the merged selected facets & aggregations into a facet group, and
139
- // store it for reuse across pages.
140
- this.facetGroup = this.mergedFacets;
141
- }
142
- }
143
-
144
- updated(changed: PropertyValues): void {
145
- // If any of the search properties change, it triggers a facet fetch
146
- if (
147
- changed.has('facetKey') ||
148
- changed.has('query') ||
149
- changed.has('searchType') ||
150
- changed.has('filterMap')
151
- ) {
152
- this.facetsLoading = true;
153
- this.pageNumber = 1;
154
- this.sortedBy = defaultFacetSort[this.facetKey as FacetOption];
155
-
156
- this.updateSpecificFacets();
157
- }
158
- }
159
-
160
- firstUpdated(): void {
161
- this.setupEscapeListeners();
162
- }
163
-
164
- /**
165
- * Close more facets modal on Escape click
166
- */
167
- private setupEscapeListeners() {
168
- if (this.modalManager) {
169
- document.addEventListener('keydown', (e: KeyboardEvent) => {
170
- if (e.key === 'Escape') {
171
- this.modalManager?.closeModal();
172
- }
173
- });
174
- } else {
175
- document.removeEventListener('keydown', () => {});
176
- }
177
- }
178
-
179
- /**
180
- * Whether facet requests are for the search_results page type (either defaulted or explicitly).
181
- */
182
- private get isSearchResultsPage(): boolean {
183
- // Default page type is search_results when none is specified, so we check
184
- // for undefined as well.
185
- const pageType: PageType | undefined = this.pageSpecifierParams?.pageType;
186
- return pageType === undefined || pageType === 'search_results';
187
- }
188
-
189
- /**
190
- * Get specific facets data from search-service API based of currently query params
191
- * - this.aggregations - hold result of search service and being used for further processing.
192
- */
193
- async updateSpecificFacets(): Promise<void> {
194
- if (!this.facetKey) return; // Can't fetch facets if we don't know what type of facets we need!
195
-
196
- const trimmedQuery = this.query?.trim();
197
- if (!trimmedQuery && this.isSearchResultsPage) return; // The search page _requires_ a query
198
-
199
- const aggregations = {
200
- simpleParams: [this.facetKey],
201
- };
202
- const aggregationsSize = MORE_FACETS__MAX_AGGREGATIONS; // Only request the 10K highest-count facets
203
-
204
- const params: SearchParams = {
205
- ...this.pageSpecifierParams,
206
- query: trimmedQuery || '',
207
- filters: this.filterMap,
208
- aggregations,
209
- aggregationsSize,
210
- rows: 0, // todo - do we want server-side pagination with offset/page/limit flag?
211
- };
212
-
213
- const results = await this.searchService?.search(params, this.searchType);
214
- this.aggregations = results?.success?.response.aggregations;
215
- this.facetsLoading = false;
216
-
217
- const collectionTitles = results?.success?.response?.collectionTitles;
218
- if (collectionTitles) {
219
- for (const [id, title] of Object.entries(collectionTitles)) {
220
- this.collectionTitles?.set(id, title);
221
- }
222
- }
223
- }
224
-
225
- /**
226
- * Handler for page number changes from the pagination widget.
227
- */
228
- private pageNumberClicked(e: CustomEvent<{ page: number }>) {
229
- const page = e?.detail?.page;
230
- if (page) {
231
- this.pageNumber = Number(page);
232
- }
233
-
234
- this.analyticsHandler?.sendEvent({
235
- category: analyticsCategories.default,
236
- action: analyticsActions.moreFacetsPageChange,
237
- label: `${this.pageNumber}`,
238
- });
239
- }
240
-
241
- /**
242
- * Combines the selected facets with the aggregations to create a single list of facets
243
- */
244
- private get mergedFacets(): FacetGroup | undefined {
245
- if (!this.facetKey || !this.selectedFacets) return undefined;
246
-
247
- const { selectedFacetGroup, aggregationFacetGroup } = this;
248
-
249
- // If we don't have any aggregations, then there is nothing to show yet
250
- if (!aggregationFacetGroup) return undefined;
251
-
252
- // Start with either the selected group if we have one, or the aggregate group otherwise
253
- const facetGroup = { ...(selectedFacetGroup ?? aggregationFacetGroup) };
254
-
255
- // Attach the counts to the selected buckets
256
- const bucketsWithCount =
257
- selectedFacetGroup?.buckets.map(bucket => {
258
- const selectedBucket = aggregationFacetGroup.buckets.find(
259
- b => b.key === bucket.key,
260
- );
261
- return selectedBucket
262
- ? {
263
- ...bucket,
264
- count: selectedBucket.count,
265
- }
266
- : bucket;
267
- }) ?? [];
268
-
269
- // Sort the buckets by selection state
270
- // We do this *prior* to considering unapplied selections, because we want the facets
271
- // to remain in position when they are selected/unselected, rather than re-sort themselves.
272
- sortBucketsBySelectionState(bucketsWithCount, this.sortedBy);
273
-
274
- // Append any additional buckets that were not selected
275
- aggregationFacetGroup.buckets.forEach(bucket => {
276
- const existingBucket = selectedFacetGroup?.buckets.find(
277
- b => b.key === bucket.key,
278
- );
279
- if (existingBucket) return;
280
- bucketsWithCount.push(bucket);
281
- });
282
-
283
- // Apply any unapplied selections that appear on this page
284
- const unappliedBuckets = this.unappliedFacetChanges[this.facetKey];
285
- for (const [index, bucket] of bucketsWithCount.entries()) {
286
- const unappliedBucket = unappliedBuckets?.[bucket.key];
287
- if (unappliedBucket) {
288
- bucketsWithCount[index] = { ...unappliedBucket };
289
- }
290
- }
291
-
292
- // For TV creator facets, uppercase the display text
293
- if (this.facetKey === 'creator' && this.isTvSearch) {
294
- bucketsWithCount.forEach(b => {
295
- b.displayText = (b.displayText ?? b.key)?.toLocaleUpperCase();
296
-
297
- const channelLabel = this.tvChannelAliases?.get(b.displayText);
298
- if (channelLabel && channelLabel !== b.displayText) {
299
- b.extraNote = `(${channelLabel})`;
300
- }
301
- });
302
- }
303
-
304
- facetGroup.buckets = bucketsWithCount;
305
- return facetGroup;
306
- }
307
-
308
- /**
309
- * Converts the selected facets for the current facet key to a `FacetGroup`,
310
- * which is easier to work with.
311
- */
312
- private get selectedFacetGroup(): FacetGroup | undefined {
313
- if (!this.selectedFacets || !this.facetKey) return undefined;
314
-
315
- const selectedFacetsForKey = this.selectedFacets[this.facetKey];
316
- if (!selectedFacetsForKey) return undefined;
317
-
318
- const facetGroupTitle = facetTitles[this.facetKey];
319
-
320
- const buckets: FacetBucket[] = Object.entries(selectedFacetsForKey).map(
321
- ([value, data]) => {
322
- const displayText: string = value;
323
- return {
324
- displayText,
325
- key: value,
326
- count: data?.count,
327
- state: data?.state,
328
- };
329
- },
330
- );
331
-
332
- return {
333
- title: facetGroupTitle,
334
- key: this.facetKey,
335
- buckets,
336
- };
337
- }
338
-
339
- /**
340
- * Converts the raw `aggregations` for the current facet key to a `FacetGroup`,
341
- * which is easier to work with.
342
- */
343
- private get aggregationFacetGroup(): FacetGroup | undefined {
344
- if (!this.aggregations || !this.facetKey) return undefined;
345
-
346
- const currentAggregation = this.aggregations[this.facetKey];
347
- if (!currentAggregation) return undefined;
348
-
349
- const facetGroupTitle = facetTitles[this.facetKey];
350
-
351
- // Order the facets according to the current sort option
352
- let sortedBuckets = currentAggregation.getSortedBuckets(
353
- this.sortedBy,
354
- ) as Bucket[];
355
-
356
- if (this.facetKey === 'collection') {
357
- // we are not showing fav- collections or certain deemphasized collections in facets
358
- sortedBuckets = sortedBuckets?.filter(bucket => {
359
- const bucketKey = bucket?.key?.toString();
360
- return (
361
- !suppressedCollections[bucketKey] && !bucketKey?.startsWith('fav-')
362
- );
363
- });
364
- }
365
-
366
- // Construct the array of facet buckets from the aggregation buckets
367
- const facetBuckets: FacetBucket[] = sortedBuckets.map(bucket => {
368
- const bucketKeyStr = `${bucket.key}`;
369
- return {
370
- displayText: `${bucketKeyStr}`,
371
- key: `${bucketKeyStr}`,
372
- count: bucket.doc_count,
373
- state: 'none',
374
- };
375
- });
376
-
377
- return {
378
- title: facetGroupTitle,
379
- key: this.facetKey,
380
- buckets: facetBuckets,
381
- };
382
- }
383
-
384
- /**
385
- * Returns a FacetGroup representing only the current page of facet buckets to show.
386
- */
387
- private get facetGroupForCurrentPage(): FacetGroup | undefined {
388
- const { facetGroup } = this;
389
- if (!facetGroup) return undefined;
390
-
391
- // Slice out only the current page of facet buckets
392
- const firstBucketIndexOnPage = (this.pageNumber - 1) * this.facetsPerPage;
393
- const truncatedBuckets = facetGroup.buckets.slice(
394
- firstBucketIndexOnPage,
395
- firstBucketIndexOnPage + this.facetsPerPage,
396
- );
397
-
398
- return {
399
- ...facetGroup,
400
- buckets: truncatedBuckets,
401
- };
402
- }
403
-
404
- private get moreFacetsTemplate(): TemplateResult {
405
- return html`
406
- <facets-template
407
- .facetGroup=${this.facetGroupForCurrentPage}
408
- .selectedFacets=${this.selectedFacets}
409
- .collectionTitles=${this.collectionTitles}
410
- @facetClick=${(e: CustomEvent<FacetEventDetails>) => {
411
- if (this.facetKey) {
412
- this.unappliedFacetChanges = updateSelectedFacetBucket(
413
- this.unappliedFacetChanges,
414
- this.facetKey,
415
- e.detail.bucket,
416
- );
417
- }
418
- }}
419
- ></facets-template>
420
- `;
421
- }
422
-
423
- private get loaderTemplate(): TemplateResult {
424
- return html`<div class="facets-loader">
425
- <ia-activity-indicator .mode=${'processing'}></ia-activity-indicator>
426
- </div> `;
427
- }
428
-
429
- /**
430
- * How many pages of facets to show in the modal pagination widget
431
- */
432
- private get paginationSize(): number {
433
- if (!this.aggregations || !this.facetKey) return 0;
434
-
435
- // Calculate the appropriate number of pages to show in the modal pagination widget
436
- const length = this.aggregations[this.facetKey]?.buckets.length;
437
- return Math.ceil(length / this.facetsPerPage);
438
- }
439
-
440
- // render pagination if more then 1 page
441
- private get facetsPaginationTemplate() {
442
- return this.paginationSize > 1
443
- ? html`<more-facets-pagination
444
- .size=${this.paginationSize}
445
- .currentPage=${1}
446
- @pageNumberClicked=${this.pageNumberClicked}
447
- ></more-facets-pagination>`
448
- : nothing;
449
- }
450
-
451
- private get footerTemplate() {
452
- if (this.paginationSize > 0) {
453
- return html`${this.facetsPaginationTemplate}
454
- <div class="footer">
455
- <button
456
- class="btn btn-cancel"
457
- type="button"
458
- @click=${this.cancelClick}
459
- >
460
- Cancel
461
- </button>
462
- <button
463
- class="btn btn-submit"
464
- type="button"
465
- @click=${this.applySearchFacetsClicked}
466
- >
467
- Apply filters
468
- </button>
469
- </div> `;
470
- }
471
-
472
- return nothing;
473
- }
474
-
475
- private sortFacetAggregation(facetSortType: AggregationSortType) {
476
- this.sortedBy = facetSortType;
477
- this.dispatchEvent(
478
- new CustomEvent('sortedFacets', { detail: this.sortedBy }),
479
- );
480
- }
481
-
482
- private get modalHeaderTemplate(): TemplateResult {
483
- const facetSort =
484
- this.sortedBy ?? defaultFacetSort[this.facetKey as FacetOption];
485
- const defaultSwitchSide =
486
- facetSort === AggregationSortType.COUNT ? 'left' : 'right';
487
-
488
- return html`<span class="sr-only">${msg('More facets for:')}</span>
489
- <span class="title">
490
- ${this.facetGroup?.title}
491
-
492
- <label class="sort-label">${msg('Sort by:')}</label>
493
- ${this.facetKey
494
- ? html`<toggle-switch
495
- class="sort-toggle"
496
- leftValue=${AggregationSortType.COUNT}
497
- leftLabel="Count"
498
- rightValue=${valueFacetSort[this.facetKey]}
499
- .rightLabel=${this.facetGroup?.title}
500
- side=${defaultSwitchSide}
501
- @change=${(e: CustomEvent<string>) => {
502
- this.sortFacetAggregation(
503
- Number(e.detail) as AggregationSortType,
504
- );
505
- }}
506
- ></toggle-switch>`
507
- : nothing}
508
- </span>`;
509
- }
510
-
511
- render() {
512
- return html`
513
- ${this.facetsLoading
514
- ? this.loaderTemplate
515
- : html`
516
- <section id="more-facets">
517
- <div class="header-content">${this.modalHeaderTemplate}</div>
518
- <div class="facets-content">${this.moreFacetsTemplate}</div>
519
- ${this.footerTemplate}
520
- </section>
521
- `}
522
- `;
523
- }
524
-
525
- private applySearchFacetsClicked() {
526
- const mergedSelections = mergeSelectedFacets(
527
- this.selectedFacets,
528
- this.unappliedFacetChanges,
529
- );
530
-
531
- const event = new CustomEvent<SelectedFacets>('facetsChanged', {
532
- detail: mergedSelections,
533
- bubbles: true,
534
- composed: true,
535
- });
536
- this.dispatchEvent(event);
537
-
538
- // Reset the unapplied changes back to default, now that they have been applied
539
- this.unappliedFacetChanges = getDefaultSelectedFacets();
540
-
541
- this.modalManager?.closeModal();
542
- this.analyticsHandler?.sendEvent({
543
- category: analyticsCategories.default,
544
- action: `${analyticsActions.applyMoreFacetsModal}`,
545
- label: `${this.facetKey}`,
546
- });
547
- }
548
-
549
- private cancelClick() {
550
- // Reset the unapplied changes back to default
551
- this.unappliedFacetChanges = getDefaultSelectedFacets();
552
-
553
- this.modalManager?.closeModal();
554
- this.analyticsHandler?.sendEvent({
555
- category: analyticsCategories.default,
556
- action: analyticsActions.closeMoreFacetsModal,
557
- label: `${this.facetKey}`,
558
- });
559
- }
560
-
561
- static get styles(): CSSResultGroup {
562
- const modalSubmitButton = css`var(--primaryButtonBGColor, #194880)`;
563
-
564
- return [
565
- srOnlyStyle,
566
- css`
567
- section#more-facets {
568
- overflow: auto;
569
- padding: 10px; /* leaves room for scroll bar to appear without overlaying on content */
570
- --facetsColumnCount: 3;
571
- }
572
- .header-content .title {
573
- display: block;
574
- text-align: left;
575
- font-size: 1.8rem;
576
- padding: 0 10px;
577
- font-weight: bold;
578
- }
579
-
580
- .sort-label {
581
- margin-left: 20px;
582
- font-size: 1.3rem;
583
- }
584
-
585
- .sort-toggle {
586
- font-weight: normal;
587
- }
588
-
589
- .facets-content {
590
- font-size: 1.2rem;
591
- max-height: 300px;
592
- overflow: auto;
593
- padding: 10px;
594
- }
595
- .facets-loader {
596
- margin-bottom: 20px;
597
- width: 70px;
598
- display: block;
599
- margin-left: auto;
600
- margin-right: auto;
601
- }
602
- .btn {
603
- border: none;
604
- padding: 10px;
605
- margin-bottom: 10px;
606
- width: auto;
607
- border-radius: 4px;
608
- cursor: pointer;
609
- }
610
- .btn-cancel {
611
- background-color: #2c2c2c;
612
- color: white;
613
- }
614
- .btn-submit {
615
- background-color: ${modalSubmitButton};
616
- color: white;
617
- }
618
- .footer {
619
- text-align: center;
620
- margin-top: 10px;
621
- }
622
-
623
- @media (max-width: 560px) {
624
- section#more-facets {
625
- max-height: 450px;
626
- --facetsColumnCount: 1;
627
- }
628
- .facets-content {
629
- overflow-y: auto;
630
- height: 300px;
631
- }
632
- }
633
- `,
634
- ];
635
- }
636
- }
1
+ import {
2
+ css,
3
+ CSSResultGroup,
4
+ html,
5
+ LitElement,
6
+ nothing,
7
+ PropertyValues,
8
+ TemplateResult,
9
+ } from 'lit';
10
+ import { customElement, property, state } from 'lit/decorators.js';
11
+ import {
12
+ Aggregation,
13
+ Bucket,
14
+ SearchServiceInterface,
15
+ SearchParams,
16
+ SearchType,
17
+ AggregationSortType,
18
+ FilterMap,
19
+ PageType,
20
+ } from '@internetarchive/search-service';
21
+ import type { ModalManagerInterface } from '@internetarchive/modal-manager';
22
+ import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';
23
+ import { msg } from '@lit/localize';
24
+ import {
25
+ SelectedFacets,
26
+ FacetGroup,
27
+ FacetBucket,
28
+ FacetOption,
29
+ facetTitles,
30
+ suppressedCollections,
31
+ valueFacetSort,
32
+ defaultFacetSort,
33
+ getDefaultSelectedFacets,
34
+ FacetEventDetails,
35
+ } from '../models';
36
+ import type {
37
+ CollectionTitles,
38
+ PageSpecifierParams,
39
+ TVChannelAliases,
40
+ } from '../data-source/models';
41
+ import '@internetarchive/ia-activity-indicator';
42
+ import './more-facets-pagination';
43
+ import './facets-template';
44
+ import {
45
+ analyticsActions,
46
+ analyticsCategories,
47
+ } from '../utils/analytics-events';
48
+ import './toggle-switch';
49
+ import { srOnlyStyle } from '../styles/sr-only';
50
+ import {
51
+ mergeSelectedFacets,
52
+ sortBucketsBySelectionState,
53
+ updateSelectedFacetBucket,
54
+ } from '../utils/facet-utils';
55
+ import {
56
+ MORE_FACETS__DEFAULT_PAGE_SIZE,
57
+ MORE_FACETS__MAX_AGGREGATIONS,
58
+ } from './models';
59
+
60
+ @customElement('more-facets-content')
61
+ export class MoreFacetsContent extends LitElement {
62
+ @property({ type: String }) facetKey?: FacetOption;
63
+
64
+ @property({ type: String }) query?: string;
65
+
66
+ @property({ type: Array }) identifiers?: string[];
67
+
68
+ @property({ type: Object }) filterMap?: FilterMap;
69
+
70
+ @property({ type: Number }) searchType?: SearchType;
71
+
72
+ @property({ type: Object }) pageSpecifierParams?: PageSpecifierParams;
73
+
74
+ @property({ type: Object })
75
+ collectionTitles?: CollectionTitles;
76
+
77
+ @property({ type: Object })
78
+ tvChannelAliases?: TVChannelAliases;
79
+
80
+ /**
81
+ * Maximum number of facets to show per page within the modal.
82
+ */
83
+ @property({ type: Number }) facetsPerPage = MORE_FACETS__DEFAULT_PAGE_SIZE;
84
+
85
+ /**
86
+ * Whether we are waiting for facet data to load.
87
+ * We begin with this set to true so that we show an initial loading indicator.
88
+ */
89
+ @property({ type: Boolean }) facetsLoading = true;
90
+
91
+ /**
92
+ * The set of pre-existing facet selections (including both selected & negated facets).
93
+ */
94
+ @property({ type: Object }) selectedFacets?: SelectedFacets;
95
+
96
+ @property({ type: Number }) sortedBy: AggregationSortType =
97
+ AggregationSortType.COUNT;
98
+
99
+ @property({ type: Boolean }) isTvSearch = false;
100
+
101
+ @property({ type: Object }) modalManager?: ModalManagerInterface;
102
+
103
+ @property({ type: Object }) searchService?: SearchServiceInterface;
104
+
105
+ @property({ type: Object, attribute: false })
106
+ analyticsHandler?: AnalyticsManagerInterface;
107
+
108
+ /**
109
+ * The full set of aggregations received from the search service
110
+ */
111
+ @state() private aggregations?: Record<string, Aggregation>;
112
+
113
+ /**
114
+ * A FacetGroup storing the full set of facet buckets to be shown on the dialog.
115
+ */
116
+ @state() private facetGroup?: FacetGroup;
117
+
118
+ /**
119
+ * An object holding any changes the patron has made to their facet selections
120
+ * within the modal dialog but which they have not yet applied. These are
121
+ * eventually merged into the existing `selectedFacets` when the patron applies
122
+ * their changes, or discarded if they cancel/close the dialog.
123
+ */
124
+ @state() private unappliedFacetChanges: SelectedFacets =
125
+ getDefaultSelectedFacets();
126
+
127
+ /**
128
+ * Which page of facets we are showing.
129
+ */
130
+ @state() private pageNumber = 1;
131
+
132
+ willUpdate(changed: PropertyValues): void {
133
+ if (
134
+ changed.has('aggregations') ||
135
+ changed.has('facetsPerPage') ||
136
+ changed.has('sortedBy') ||
137
+ changed.has('selectedFacets') ||
138
+ changed.has('unappliedFacetChanges')
139
+ ) {
140
+ // Convert the merged selected facets & aggregations into a facet group, and
141
+ // store it for reuse across pages.
142
+ this.facetGroup = this.mergedFacets;
143
+ }
144
+ }
145
+
146
+ updated(changed: PropertyValues): void {
147
+ // If any of the search properties change, it triggers a facet fetch
148
+ if (
149
+ changed.has('facetKey') ||
150
+ changed.has('query') ||
151
+ changed.has('searchType') ||
152
+ changed.has('filterMap')
153
+ ) {
154
+ this.facetsLoading = true;
155
+ this.pageNumber = 1;
156
+ this.sortedBy = defaultFacetSort[this.facetKey as FacetOption];
157
+
158
+ this.updateSpecificFacets();
159
+ }
160
+ }
161
+
162
+ firstUpdated(): void {
163
+ this.setupEscapeListeners();
164
+ }
165
+
166
+ /**
167
+ * Close more facets modal on Escape click
168
+ */
169
+ private setupEscapeListeners() {
170
+ if (this.modalManager) {
171
+ document.addEventListener('keydown', (e: KeyboardEvent) => {
172
+ if (e.key === 'Escape') {
173
+ this.modalManager?.closeModal();
174
+ }
175
+ });
176
+ } else {
177
+ document.removeEventListener('keydown', () => {});
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Whether facet requests are for the search_results page type (either defaulted or explicitly).
183
+ */
184
+ private get isSearchResultsPage(): boolean {
185
+ // Default page type is search_results when none is specified, so we check
186
+ // for undefined as well.
187
+ const pageType: PageType | undefined = this.pageSpecifierParams?.pageType;
188
+ return pageType === undefined || pageType === 'search_results';
189
+ }
190
+
191
+ /**
192
+ * Get specific facets data from search-service API based of currently query params
193
+ * - this.aggregations - hold result of search service and being used for further processing.
194
+ */
195
+ async updateSpecificFacets(): Promise<void> {
196
+ if (!this.facetKey) return; // Can't fetch facets if we don't know what type of facets we need!
197
+
198
+ const trimmedQuery = this.query?.trim();
199
+ if (!trimmedQuery && this.isSearchResultsPage) return; // The search page _requires_ a query
200
+
201
+ const aggregations = {
202
+ simpleParams: [this.facetKey],
203
+ };
204
+ const aggregationsSize = MORE_FACETS__MAX_AGGREGATIONS; // Only request the 10K highest-count facets
205
+
206
+ const params: SearchParams = {
207
+ ...this.pageSpecifierParams,
208
+ query: trimmedQuery || '',
209
+ identifiers: this.identifiers,
210
+ filters: this.filterMap,
211
+ aggregations,
212
+ aggregationsSize,
213
+ rows: 0, // todo - do we want server-side pagination with offset/page/limit flag?
214
+ };
215
+
216
+ const results = await this.searchService?.search(params, this.searchType);
217
+ this.aggregations = results?.success?.response.aggregations;
218
+ this.facetsLoading = false;
219
+
220
+ const collectionTitles = results?.success?.response?.collectionTitles;
221
+ if (collectionTitles) {
222
+ for (const [id, title] of Object.entries(collectionTitles)) {
223
+ this.collectionTitles?.set(id, title);
224
+ }
225
+ }
226
+ }
227
+
228
+ /**
229
+ * Handler for page number changes from the pagination widget.
230
+ */
231
+ private pageNumberClicked(e: CustomEvent<{ page: number }>) {
232
+ const page = e?.detail?.page;
233
+ if (page) {
234
+ this.pageNumber = Number(page);
235
+ }
236
+
237
+ this.analyticsHandler?.sendEvent({
238
+ category: analyticsCategories.default,
239
+ action: analyticsActions.moreFacetsPageChange,
240
+ label: `${this.pageNumber}`,
241
+ });
242
+ }
243
+
244
+ /**
245
+ * Combines the selected facets with the aggregations to create a single list of facets
246
+ */
247
+ private get mergedFacets(): FacetGroup | undefined {
248
+ if (!this.facetKey || !this.selectedFacets) return undefined;
249
+
250
+ const { selectedFacetGroup, aggregationFacetGroup } = this;
251
+
252
+ // If we don't have any aggregations, then there is nothing to show yet
253
+ if (!aggregationFacetGroup) return undefined;
254
+
255
+ // Start with either the selected group if we have one, or the aggregate group otherwise
256
+ const facetGroup = { ...(selectedFacetGroup ?? aggregationFacetGroup) };
257
+
258
+ // Attach the counts to the selected buckets
259
+ const bucketsWithCount =
260
+ selectedFacetGroup?.buckets.map(bucket => {
261
+ const selectedBucket = aggregationFacetGroup.buckets.find(
262
+ b => b.key === bucket.key,
263
+ );
264
+ return selectedBucket
265
+ ? {
266
+ ...bucket,
267
+ count: selectedBucket.count,
268
+ }
269
+ : bucket;
270
+ }) ?? [];
271
+
272
+ // Sort the buckets by selection state
273
+ // We do this *prior* to considering unapplied selections, because we want the facets
274
+ // to remain in position when they are selected/unselected, rather than re-sort themselves.
275
+ sortBucketsBySelectionState(bucketsWithCount, this.sortedBy);
276
+
277
+ // Append any additional buckets that were not selected
278
+ aggregationFacetGroup.buckets.forEach(bucket => {
279
+ const existingBucket = selectedFacetGroup?.buckets.find(
280
+ b => b.key === bucket.key,
281
+ );
282
+ if (existingBucket) return;
283
+ bucketsWithCount.push(bucket);
284
+ });
285
+
286
+ // Apply any unapplied selections that appear on this page
287
+ const unappliedBuckets = this.unappliedFacetChanges[this.facetKey];
288
+ for (const [index, bucket] of bucketsWithCount.entries()) {
289
+ const unappliedBucket = unappliedBuckets?.[bucket.key];
290
+ if (unappliedBucket) {
291
+ bucketsWithCount[index] = { ...unappliedBucket };
292
+ }
293
+ }
294
+
295
+ // For TV creator facets, uppercase the display text
296
+ if (this.facetKey === 'creator' && this.isTvSearch) {
297
+ bucketsWithCount.forEach(b => {
298
+ b.displayText = (b.displayText ?? b.key)?.toLocaleUpperCase();
299
+
300
+ const channelLabel = this.tvChannelAliases?.get(b.displayText);
301
+ if (channelLabel && channelLabel !== b.displayText) {
302
+ b.extraNote = `(${channelLabel})`;
303
+ }
304
+ });
305
+ }
306
+
307
+ facetGroup.buckets = bucketsWithCount;
308
+ return facetGroup;
309
+ }
310
+
311
+ /**
312
+ * Converts the selected facets for the current facet key to a `FacetGroup`,
313
+ * which is easier to work with.
314
+ */
315
+ private get selectedFacetGroup(): FacetGroup | undefined {
316
+ if (!this.selectedFacets || !this.facetKey) return undefined;
317
+
318
+ const selectedFacetsForKey = this.selectedFacets[this.facetKey];
319
+ if (!selectedFacetsForKey) return undefined;
320
+
321
+ const facetGroupTitle = facetTitles[this.facetKey];
322
+
323
+ const buckets: FacetBucket[] = Object.entries(selectedFacetsForKey).map(
324
+ ([value, data]) => {
325
+ const displayText: string = value;
326
+ return {
327
+ displayText,
328
+ key: value,
329
+ count: data?.count,
330
+ state: data?.state,
331
+ };
332
+ },
333
+ );
334
+
335
+ return {
336
+ title: facetGroupTitle,
337
+ key: this.facetKey,
338
+ buckets,
339
+ };
340
+ }
341
+
342
+ /**
343
+ * Converts the raw `aggregations` for the current facet key to a `FacetGroup`,
344
+ * which is easier to work with.
345
+ */
346
+ private get aggregationFacetGroup(): FacetGroup | undefined {
347
+ if (!this.aggregations || !this.facetKey) return undefined;
348
+
349
+ const currentAggregation = this.aggregations[this.facetKey];
350
+ if (!currentAggregation) return undefined;
351
+
352
+ const facetGroupTitle = facetTitles[this.facetKey];
353
+
354
+ // Order the facets according to the current sort option
355
+ let sortedBuckets = currentAggregation.getSortedBuckets(
356
+ this.sortedBy,
357
+ ) as Bucket[];
358
+
359
+ if (this.facetKey === 'collection') {
360
+ // we are not showing fav- collections or certain deemphasized collections in facets
361
+ sortedBuckets = sortedBuckets?.filter(bucket => {
362
+ const bucketKey = bucket?.key?.toString();
363
+ return (
364
+ !suppressedCollections[bucketKey] && !bucketKey?.startsWith('fav-')
365
+ );
366
+ });
367
+ }
368
+
369
+ // Construct the array of facet buckets from the aggregation buckets
370
+ const facetBuckets: FacetBucket[] = sortedBuckets.map(bucket => {
371
+ const bucketKeyStr = `${bucket.key}`;
372
+ return {
373
+ displayText: `${bucketKeyStr}`,
374
+ key: `${bucketKeyStr}`,
375
+ count: bucket.doc_count,
376
+ state: 'none',
377
+ };
378
+ });
379
+
380
+ return {
381
+ title: facetGroupTitle,
382
+ key: this.facetKey,
383
+ buckets: facetBuckets,
384
+ };
385
+ }
386
+
387
+ /**
388
+ * Returns a FacetGroup representing only the current page of facet buckets to show.
389
+ */
390
+ private get facetGroupForCurrentPage(): FacetGroup | undefined {
391
+ const { facetGroup } = this;
392
+ if (!facetGroup) return undefined;
393
+
394
+ // Slice out only the current page of facet buckets
395
+ const firstBucketIndexOnPage = (this.pageNumber - 1) * this.facetsPerPage;
396
+ const truncatedBuckets = facetGroup.buckets.slice(
397
+ firstBucketIndexOnPage,
398
+ firstBucketIndexOnPage + this.facetsPerPage,
399
+ );
400
+
401
+ return {
402
+ ...facetGroup,
403
+ buckets: truncatedBuckets,
404
+ };
405
+ }
406
+
407
+ private get moreFacetsTemplate(): TemplateResult {
408
+ return html`
409
+ <facets-template
410
+ .facetGroup=${this.facetGroupForCurrentPage}
411
+ .selectedFacets=${this.selectedFacets}
412
+ .collectionTitles=${this.collectionTitles}
413
+ @facetClick=${(e: CustomEvent<FacetEventDetails>) => {
414
+ if (this.facetKey) {
415
+ this.unappliedFacetChanges = updateSelectedFacetBucket(
416
+ this.unappliedFacetChanges,
417
+ this.facetKey,
418
+ e.detail.bucket,
419
+ );
420
+ }
421
+ }}
422
+ ></facets-template>
423
+ `;
424
+ }
425
+
426
+ private get loaderTemplate(): TemplateResult {
427
+ return html`<div class="facets-loader">
428
+ <ia-activity-indicator .mode=${'processing'}></ia-activity-indicator>
429
+ </div> `;
430
+ }
431
+
432
+ /**
433
+ * How many pages of facets to show in the modal pagination widget
434
+ */
435
+ private get paginationSize(): number {
436
+ if (!this.aggregations || !this.facetKey) return 0;
437
+
438
+ // Calculate the appropriate number of pages to show in the modal pagination widget
439
+ const length = this.aggregations[this.facetKey]?.buckets.length;
440
+ return Math.ceil(length / this.facetsPerPage);
441
+ }
442
+
443
+ // render pagination if more then 1 page
444
+ private get facetsPaginationTemplate() {
445
+ return this.paginationSize > 1
446
+ ? html`<more-facets-pagination
447
+ .size=${this.paginationSize}
448
+ .currentPage=${1}
449
+ @pageNumberClicked=${this.pageNumberClicked}
450
+ ></more-facets-pagination>`
451
+ : nothing;
452
+ }
453
+
454
+ private get footerTemplate() {
455
+ if (this.paginationSize > 0) {
456
+ return html`${this.facetsPaginationTemplate}
457
+ <div class="footer">
458
+ <button
459
+ class="btn btn-cancel"
460
+ type="button"
461
+ @click=${this.cancelClick}
462
+ >
463
+ Cancel
464
+ </button>
465
+ <button
466
+ class="btn btn-submit"
467
+ type="button"
468
+ @click=${this.applySearchFacetsClicked}
469
+ >
470
+ Apply filters
471
+ </button>
472
+ </div> `;
473
+ }
474
+
475
+ return nothing;
476
+ }
477
+
478
+ private sortFacetAggregation(facetSortType: AggregationSortType) {
479
+ this.sortedBy = facetSortType;
480
+ this.dispatchEvent(
481
+ new CustomEvent('sortedFacets', { detail: this.sortedBy }),
482
+ );
483
+ }
484
+
485
+ private get modalHeaderTemplate(): TemplateResult {
486
+ const facetSort =
487
+ this.sortedBy ?? defaultFacetSort[this.facetKey as FacetOption];
488
+ const defaultSwitchSide =
489
+ facetSort === AggregationSortType.COUNT ? 'left' : 'right';
490
+
491
+ return html`<span class="sr-only">${msg('More facets for:')}</span>
492
+ <span class="title">
493
+ ${this.facetGroup?.title}
494
+
495
+ <label class="sort-label">${msg('Sort by:')}</label>
496
+ ${this.facetKey
497
+ ? html`<toggle-switch
498
+ class="sort-toggle"
499
+ leftValue=${AggregationSortType.COUNT}
500
+ leftLabel="Count"
501
+ rightValue=${valueFacetSort[this.facetKey]}
502
+ .rightLabel=${this.facetGroup?.title}
503
+ side=${defaultSwitchSide}
504
+ @change=${(e: CustomEvent<string>) => {
505
+ this.sortFacetAggregation(
506
+ Number(e.detail) as AggregationSortType,
507
+ );
508
+ }}
509
+ ></toggle-switch>`
510
+ : nothing}
511
+ </span>`;
512
+ }
513
+
514
+ render() {
515
+ return html`
516
+ ${this.facetsLoading
517
+ ? this.loaderTemplate
518
+ : html`
519
+ <section id="more-facets">
520
+ <div class="header-content">${this.modalHeaderTemplate}</div>
521
+ <div class="facets-content">${this.moreFacetsTemplate}</div>
522
+ ${this.footerTemplate}
523
+ </section>
524
+ `}
525
+ `;
526
+ }
527
+
528
+ private applySearchFacetsClicked() {
529
+ const mergedSelections = mergeSelectedFacets(
530
+ this.selectedFacets,
531
+ this.unappliedFacetChanges,
532
+ );
533
+
534
+ const event = new CustomEvent<SelectedFacets>('facetsChanged', {
535
+ detail: mergedSelections,
536
+ bubbles: true,
537
+ composed: true,
538
+ });
539
+ this.dispatchEvent(event);
540
+
541
+ // Reset the unapplied changes back to default, now that they have been applied
542
+ this.unappliedFacetChanges = getDefaultSelectedFacets();
543
+
544
+ this.modalManager?.closeModal();
545
+ this.analyticsHandler?.sendEvent({
546
+ category: analyticsCategories.default,
547
+ action: `${analyticsActions.applyMoreFacetsModal}`,
548
+ label: `${this.facetKey}`,
549
+ });
550
+ }
551
+
552
+ private cancelClick() {
553
+ // Reset the unapplied changes back to default
554
+ this.unappliedFacetChanges = getDefaultSelectedFacets();
555
+
556
+ this.modalManager?.closeModal();
557
+ this.analyticsHandler?.sendEvent({
558
+ category: analyticsCategories.default,
559
+ action: analyticsActions.closeMoreFacetsModal,
560
+ label: `${this.facetKey}`,
561
+ });
562
+ }
563
+
564
+ static get styles(): CSSResultGroup {
565
+ const modalSubmitButton = css`var(--primaryButtonBGColor, #194880)`;
566
+
567
+ return [
568
+ srOnlyStyle,
569
+ css`
570
+ section#more-facets {
571
+ overflow: auto;
572
+ padding: 10px; /* leaves room for scroll bar to appear without overlaying on content */
573
+ --facetsColumnCount: 3;
574
+ }
575
+ .header-content .title {
576
+ display: block;
577
+ text-align: left;
578
+ font-size: 1.8rem;
579
+ padding: 0 10px;
580
+ font-weight: bold;
581
+ }
582
+
583
+ .sort-label {
584
+ margin-left: 20px;
585
+ font-size: 1.3rem;
586
+ }
587
+
588
+ .sort-toggle {
589
+ font-weight: normal;
590
+ }
591
+
592
+ .facets-content {
593
+ font-size: 1.2rem;
594
+ max-height: 300px;
595
+ overflow: auto;
596
+ padding: 10px;
597
+ }
598
+ .facets-loader {
599
+ margin-bottom: 20px;
600
+ width: 70px;
601
+ display: block;
602
+ margin-left: auto;
603
+ margin-right: auto;
604
+ }
605
+ .btn {
606
+ border: none;
607
+ padding: 10px;
608
+ margin-bottom: 10px;
609
+ width: auto;
610
+ border-radius: 4px;
611
+ cursor: pointer;
612
+ }
613
+ .btn-cancel {
614
+ background-color: #2c2c2c;
615
+ color: white;
616
+ }
617
+ .btn-submit {
618
+ background-color: ${modalSubmitButton};
619
+ color: white;
620
+ }
621
+ .footer {
622
+ text-align: center;
623
+ margin-top: 10px;
624
+ }
625
+
626
+ @media (max-width: 560px) {
627
+ section#more-facets {
628
+ max-height: 450px;
629
+ --facetsColumnCount: 1;
630
+ }
631
+ .facets-content {
632
+ overflow-y: auto;
633
+ height: 300px;
634
+ }
635
+ }
636
+ `,
637
+ ];
638
+ }
639
+ }