@internetarchive/collection-browser 4.0.2 → 4.1.0-alpha-webdev8186.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.
Files changed (40) hide show
  1. package/dist/index.js.map +1 -1
  2. package/dist/src/app-root.js +614 -614
  3. package/dist/src/app-root.js.map +1 -1
  4. package/dist/src/collection-browser.js +764 -774
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/more-facets-content.js +121 -121
  7. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  8. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  9. package/dist/src/models.js.map +1 -1
  10. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +13 -172
  11. package/dist/src/sort-filter-bar/sort-filter-bar.js +37 -546
  12. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  13. package/dist/src/tiles/grid/collection-tile.js +89 -89
  14. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  15. package/dist/src/tiles/grid/item-tile.js +138 -138
  16. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  17. package/dist/src/tiles/hover/hover-pane-controller.js +28 -28
  18. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  19. package/dist/src/tiles/models.js.map +1 -1
  20. package/dist/src/tiles/tile-dispatcher.js +216 -216
  21. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  22. package/dist/test/collection-browser.test.js +197 -202
  23. package/dist/test/collection-browser.test.js.map +1 -1
  24. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +86 -401
  25. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  26. package/index.ts +28 -28
  27. package/package.json +1 -1
  28. package/src/app-root.ts +1166 -1166
  29. package/src/collection-browser.ts +3065 -3075
  30. package/src/collection-facets/more-facets-content.ts +644 -644
  31. package/src/data-source/collection-browser-query-state.ts +59 -59
  32. package/src/models.ts +873 -873
  33. package/src/sort-filter-bar/sort-filter-bar.ts +42 -603
  34. package/src/tiles/grid/collection-tile.ts +184 -184
  35. package/src/tiles/grid/item-tile.ts +346 -346
  36. package/src/tiles/hover/hover-pane-controller.ts +627 -627
  37. package/src/tiles/models.ts +8 -8
  38. package/src/tiles/tile-dispatcher.ts +518 -518
  39. package/test/collection-browser.test.ts +2402 -2413
  40. package/test/sort-filter-bar/sort-filter-bar.test.ts +110 -566
@@ -2,9 +2,7 @@ import { __decorate } from "tslib";
2
2
  import { LitElement, html, css, nothing, } from 'lit';
3
3
  import { customElement, property, query, state } from 'lit/decorators.js';
4
4
  import { msg } from '@lit/localize';
5
- import '@internetarchive/ia-dropdown';
6
- import { ALL_DATE_SORT_FIELDS, ALL_VIEWS_SORT_FIELDS, defaultSortAvailability, SORT_OPTIONS, SortField, } from '../models';
7
- import './alpha-bar';
5
+ import { defaultSortAvailability, SORT_OPTIONS, SortField, } from '../models';
8
6
  import { sortUpIcon } from './img/sort-toggle-up';
9
7
  import { sortDownIcon } from './img/sort-toggle-down';
10
8
  import { sortDisabledIcon } from './img/sort-toggle-disabled';
@@ -12,6 +10,8 @@ import { tileIcon } from './img/tile';
12
10
  import { listIcon } from './img/list';
13
11
  import { compactIcon } from './img/compact';
14
12
  import { srOnlyStyle } from '../styles/sr-only';
13
+ import '@internetarchive/ia-dropdown';
14
+ import './alpha-bar';
15
15
  let SortFilterBar = class SortFilterBar extends LitElement {
16
16
  constructor() {
17
17
  super(...arguments);
@@ -19,10 +19,6 @@ let SortFilterBar = class SortFilterBar extends LitElement {
19
19
  this.defaultSortDirection = null;
20
20
  /** The default sort field to use if none is set */
21
21
  this.defaultSortField = SortField.relevance;
22
- /** Which view sort option to expose by default. */
23
- this.defaultViewSort = SortField.weeklyview;
24
- /** Which date sort option to expose by default */
25
- this.defaultDateSort = SortField.date;
26
22
  /** The current sort direction (asc/desc), or null if none is set */
27
23
  this.sortDirection = null;
28
24
  /** The field currently being sorted on (e.g., 'title'). Defaults to relevance. */
@@ -49,14 +45,6 @@ let SortFilterBar = class SortFilterBar extends LitElement {
49
45
  this.enableSortOptionsSlot = false;
50
46
  /** Whether to suppress showing the three display mode options on the right of the bar (default `false`) */
51
47
  this.suppressDisplayModes = false;
52
- /**
53
- * The Views sort option that was most recently selected (or the default, if none has been selected yet)
54
- */
55
- this.lastSelectedViewSort = this.defaultViewSort;
56
- /**
57
- * The Date sort option that was most recently selected (or the default, if none has been selected yet)
58
- */
59
- this.lastSelectedDateSort = this.defaultDateSort;
60
48
  /**
61
49
  * Which of the alphabet bars (title/creator) should be shown, or null if one
62
50
  * should not currently be rendered.
@@ -67,19 +55,9 @@ let SortFilterBar = class SortFilterBar extends LitElement {
67
55
  * should be rendered.
68
56
  */
69
57
  this.dropdownBackdropVisible = false;
70
- /**
71
- * The width of the desktop view sort option container, updated upon each resize.
72
- * Used for dynamically determining whether to use desktop or mobile view.
73
- */
74
- this.desktopSortContainerWidth = 0;
75
- /**
76
- * The width of the full sort bar, updated upon each resize.
77
- * Used for dynamically determining whether to use desktop or mobile view.
78
- */
79
- this.selectorBarContainerWidth = 0;
80
58
  this.boundSortBarSelectorEscapeListener = (e) => {
81
59
  if (e.key === 'Escape') {
82
- this.closeDropdowns();
60
+ this.closeDropdown();
83
61
  }
84
62
  };
85
63
  }
@@ -96,8 +74,7 @@ let SortFilterBar = class SortFilterBar extends LitElement {
96
74
  </div>
97
75
  <span class="sort-by-text">${msg('Sort by:')}</span>
98
76
  <div id="sort-selector-container">
99
- ${this.mobileSortSelectorTemplate}
100
- ${this.desktopSortSelectorTemplate}
77
+ ${this.sortSelectorTemplate}
101
78
  </div>
102
79
  `
103
80
  : html `<slot name="sort-options"></slot>`}
@@ -126,19 +103,6 @@ let SortFilterBar = class SortFilterBar extends LitElement {
126
103
  const sortOption = SORT_OPTIONS[this.finalizedSortField];
127
104
  this.sortDirection = sortOption.defaultSortDirection;
128
105
  }
129
- if (this.viewOptionSelected) {
130
- this.lastSelectedViewSort = this.finalizedSortField;
131
- }
132
- else if (this.dateOptionSelected) {
133
- this.lastSelectedDateSort = this.finalizedSortField;
134
- }
135
- }
136
- // If we change which dropdown options are defaulted, update the default selections
137
- if (changed.has('defaultViewSort')) {
138
- this.lastSelectedViewSort = this.defaultViewSort;
139
- }
140
- if (changed.has('defaultDateSort')) {
141
- this.lastSelectedDateSort = this.defaultDateSort;
142
106
  }
143
107
  }
144
108
  updated(changed) {
@@ -154,12 +118,6 @@ let SortFilterBar = class SortFilterBar extends LitElement {
154
118
  if (changed.has('dropdownBackdropVisible')) {
155
119
  this.setupEscapeListeners();
156
120
  }
157
- if (changed.has('resizeObserver') || changed.has('enableSortOptionsSlot')) {
158
- const oldObserver = changed.get('resizeObserver');
159
- if (oldObserver)
160
- this.disconnectResizeObserver(oldObserver);
161
- this.setupResizeObserver();
162
- }
163
121
  }
164
122
  setupEscapeListeners() {
165
123
  if (this.dropdownBackdropVisible) {
@@ -169,60 +127,6 @@ let SortFilterBar = class SortFilterBar extends LitElement {
169
127
  document.removeEventListener('keydown', this.boundSortBarSelectorEscapeListener);
170
128
  }
171
129
  }
172
- connectedCallback() {
173
- super.connectedCallback?.();
174
- this.setupResizeObserver();
175
- }
176
- disconnectedCallback() {
177
- if (this.resizeObserver) {
178
- this.disconnectResizeObserver(this.resizeObserver);
179
- }
180
- }
181
- disconnectResizeObserver(resizeObserver) {
182
- if (this.sortSelectorContainer) {
183
- resizeObserver.removeObserver({
184
- target: this.sortSelectorContainer,
185
- handler: this,
186
- });
187
- }
188
- if (this.desktopSortContainer) {
189
- resizeObserver.removeObserver({
190
- target: this.desktopSortContainer,
191
- handler: this,
192
- });
193
- }
194
- }
195
- setupResizeObserver() {
196
- if (!this.resizeObserver)
197
- return;
198
- if (this.sortSelectorContainer) {
199
- this.resizeObserver.addObserver({
200
- target: this.sortSelectorContainer,
201
- handler: this,
202
- });
203
- }
204
- if (this.desktopSortContainer) {
205
- this.resizeObserver.addObserver({
206
- target: this.desktopSortContainer,
207
- handler: this,
208
- });
209
- }
210
- }
211
- handleResize(entry) {
212
- if (entry.target === this.desktopSortContainer) {
213
- this.desktopSortContainerWidth = entry.contentRect.width;
214
- }
215
- else if (entry.target === this.sortSelectorContainer) {
216
- this.selectorBarContainerWidth = entry.contentRect.width;
217
- }
218
- }
219
- /**
220
- * Whether to show the mobile sort bar because there is not enough space
221
- * for the desktop sort bar.
222
- */
223
- get mobileSelectorVisible() {
224
- return this.selectorBarContainerWidth - 10 < this.desktopSortContainerWidth;
225
- }
226
130
  /**
227
131
  * Template to render the alphabet bar, or `nothing` if it should not be rendered
228
132
  * for the current sort
@@ -271,77 +175,26 @@ let SortFilterBar = class SortFilterBar extends LitElement {
271
175
  </div>
272
176
  `;
273
177
  }
274
- /** The template to render all the sort options in desktop view */
275
- get desktopSortSelectorTemplate() {
276
- return html `
277
- <div
278
- id="desktop-sort-container"
279
- class=${this.mobileSelectorVisible ? 'hidden' : 'visible'}
280
- >
281
- <ul id="desktop-sort-selector">
282
- <li>${this.relevanceSortSelectorTemplate}</li>
283
- <li>${this.allViewsSortOptionsTemplate}</li>
284
- <li>${this.titleSortSelectorTemplate}</li>
285
- <li>${this.allDateSortOptionsTemplate}</li>
286
- <li>${this.creatorSortSelectorTemplate}</li>
287
- </ul>
288
- </div>
289
- `;
290
- }
291
- /** The template to render all the sort options in mobile view */
292
- get mobileSortSelectorTemplate() {
178
+ /** The template to render all the sort options in a single dropdown */
179
+ get sortSelectorTemplate() {
293
180
  const displayedOptions = Object.values(SORT_OPTIONS).filter(opt => opt.shownInSortBar && this.sortFieldAvailability[opt.field]);
294
181
  return html `
295
- <div
296
- id="mobile-sort-container"
297
- class=${this.mobileSelectorVisible ? 'visible' : 'hidden'}
298
- >
182
+ <div id="sort-dropdown-container">
299
183
  ${this.getSortDropdown({
300
184
  displayName: SORT_OPTIONS[this.finalizedSortField].displayName,
301
- id: 'mobile-dropdown',
185
+ id: 'sort-dropdown',
302
186
  selected: true,
303
187
  dropdownOptions: displayedOptions.map(opt => this.getDropdownOption(opt.field)),
304
188
  selectedOption: this.finalizedSortField,
305
- onOptionSelected: this.mobileSortChanged,
189
+ onOptionSelected: this.sortOptionSelected,
306
190
  onDropdownClick: () => {
307
- this.dropdownBackdropVisible = this.mobileDropdown.open;
308
- this.mobileDropdown.classList.toggle('open', this.mobileDropdown.open);
191
+ this.dropdownBackdropVisible = this.sortOptionsDropdown.open;
192
+ this.sortOptionsDropdown.classList.toggle('open', this.sortOptionsDropdown.open);
309
193
  },
310
194
  })}
311
195
  </div>
312
196
  `;
313
197
  }
314
- /**
315
- * This generates each of the non-dropdown sort option buttons.
316
- *
317
- * It manages the display value and the selected state of the option.
318
- *
319
- * @param sortField Which sort field the button represents
320
- * @param options Additional options:
321
- * - `onSelected?: (e: Event) => void;` If this is provided, it will also be called when the option is selected.
322
- * Default is to clear any selected alphabetical filters.
323
- */
324
- getSortSelectorButton(sortField, options) {
325
- const isSelected = this.finalizedSortField === sortField;
326
- const displayName = SORT_OPTIONS[sortField].displayName;
327
- const onSelected = options?.onSelected ?? (() => this.clearAlphaBarFilters());
328
- return html `
329
- <button
330
- class=${isSelected ? 'selected' : ''}
331
- data-title=${displayName}
332
- @click=${(e) => {
333
- e.preventDefault();
334
- this.dropdownBackdropVisible = false;
335
- if (this.finalizedSortField !== sortField) {
336
- onSelected?.(e);
337
- this.setSelectedSort(sortField);
338
- }
339
- }}
340
- >
341
- ${displayName}
342
- </button>
343
- `;
344
- }
345
198
  /**
346
199
  * Generates a dropdown component containing multiple grouped sort options.
347
200
  *
@@ -353,8 +206,6 @@ let SortFilterBar = class SortFilterBar extends LitElement {
353
206
  * selected appearance
354
207
  * @param options.onOptionSelected A handler for optionSelected events coming from the dropdown
355
208
  * @param options.onDropdownClick A handler for click events on the dropdown
356
- * @param options.onLabelInteraction A handler for click events and Enter/Space keydown events
357
- * on the dropdown's label
358
209
  */
359
210
  getSortDropdown(options) {
360
211
  return html `
@@ -374,14 +225,6 @@ let SortFilterBar = class SortFilterBar extends LitElement {
374
225
  class="dropdown-label"
375
226
  slot="dropdown-label"
376
227
  data-title=${options.displayName}
377
- @click=${options.onLabelInteraction ?? nothing}
378
- @keydown=${options.onLabelInteraction
379
- ? (e) => {
380
- if (e.key === 'Enter' || e.key === ' ') {
381
- options.onLabelInteraction?.(e);
382
- }
383
- }
384
- : nothing}
385
228
  >
386
229
  ${options.displayName}
387
230
  </span>
@@ -402,171 +245,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
402
245
  `,
403
246
  };
404
247
  }
405
- /** Handler for when any sort dropdown option is selected */
406
- dropdownOptionSelected(e) {
407
- this.dropdownBackdropVisible = false;
408
- this.clearAlphaBarFilters();
409
- const sortField = e.detail.option.id;
410
- this.setSelectedSort(sortField);
411
- if (this.viewOptionSelected) {
412
- this.lastSelectedViewSort = sortField;
413
- }
414
- else if (this.dateOptionSelected) {
415
- this.lastSelectedDateSort = sortField;
416
- }
417
- }
418
- //
419
- // SORT OPTION TEMPLATES
420
- //
421
- /**
422
- * Template for the Relevance sort selector button, or `nothing` if the relevance
423
- * field is not available for display.
424
- */
425
- get relevanceSortSelectorTemplate() {
426
- if (!this.sortFieldAvailability.relevance)
427
- return nothing;
428
- return this.getSortSelectorButton(SortField.relevance);
429
- }
430
- /**
431
- * Template for the Views sort selector button.
432
- * This is shown instead of the views dropdown when only a single views sort field
433
- * is available.
434
- */
435
- get viewsSortSelectorTemplate() {
436
- const { availableViewsFields } = this;
437
- if (availableViewsFields.length < 1)
438
- return nothing;
439
- return this.getSortSelectorButton(availableViewsFields[0]);
440
- }
441
- /**
442
- * Template for the Title sort selector button, or `nothing` if the title field is
443
- * not available for display.
444
- */
445
- get titleSortSelectorTemplate() {
446
- if (!this.sortFieldAvailability.title)
447
- return nothing;
448
- return this.getSortSelectorButton(SortField.title, {
449
- onSelected: () => {
450
- this.alphaSelectorVisible = 'title';
451
- this.selectedCreatorFilter = null;
452
- this.emitCreatorLetterChangedEvent();
453
- },
454
- });
455
- }
456
- /**
457
- * Template for the Date sort selector button.
458
- * This is shown instead of the dates dropdown when only a single date sort field
459
- * is available.
460
- */
461
- get dateSortSelectorTemplate() {
462
- const { availableDateFields } = this;
463
- if (availableDateFields.length < 1)
464
- return nothing;
465
- return this.getSortSelectorButton(availableDateFields[0]);
466
- }
467
- /**
468
- * Template for the Creator sort selector button, or `nothing` if the creator field
469
- * is not available for display.
470
- */
471
- get creatorSortSelectorTemplate() {
472
- if (!this.sortFieldAvailability.creator)
473
- return nothing;
474
- return this.getSortSelectorButton(SortField.creator, {
475
- onSelected: () => {
476
- this.alphaSelectorVisible = 'creator';
477
- this.selectedTitleFilter = null;
478
- this.emitTitleLetterChangedEvent();
479
- },
480
- });
481
- }
482
- /**
483
- * Template for the Views dropdown, shown when 2+ views sort fields are available.
484
- */
485
- get viewsDropdownTemplate() {
486
- const displayedOptions = ALL_VIEWS_SORT_FIELDS.filter(field => this.sortFieldAvailability[field]).map(field => this.getDropdownOption(field));
487
- return this.getSortDropdown({
488
- displayName: this.viewSortDisplayName,
489
- id: 'views-dropdown',
490
- selected: this.viewOptionSelected,
491
- dropdownOptions: displayedOptions,
492
- selectedOption: this.viewOptionSelected ? this.finalizedSortField : '',
493
- onOptionSelected: this.dropdownOptionSelected,
494
- onDropdownClick: () => {
495
- if (this.dateDropdown)
496
- this.dateDropdown.open = false;
497
- const viewsDropdown = this.viewsDropdown;
498
- this.dropdownBackdropVisible = viewsDropdown.open;
499
- viewsDropdown.classList.toggle('open', viewsDropdown.open);
500
- },
501
- onLabelInteraction: (e) => {
502
- if (!this.viewsDropdown?.open && !this.viewOptionSelected) {
503
- e.stopPropagation();
504
- this.clearAlphaBarFilters();
505
- this.setSelectedSort(this.lastSelectedViewSort);
506
- }
507
- },
508
- });
509
- }
510
- /**
511
- * Template for the Date dropdown, shown when 2+ date sort fields are available.
512
- */
513
- get dateDropdownTemplate() {
514
- const displayedOptions = ALL_DATE_SORT_FIELDS.filter(field => this.sortFieldAvailability[field]).map(field => this.getDropdownOption(field));
515
- return this.getSortDropdown({
516
- displayName: this.dateSortDisplayName,
517
- id: 'date-dropdown',
518
- selected: this.dateOptionSelected,
519
- dropdownOptions: displayedOptions,
520
- selectedOption: this.dateOptionSelected ? this.finalizedSortField : '',
521
- onOptionSelected: this.dropdownOptionSelected,
522
- onDropdownClick: () => {
523
- if (this.viewsDropdown)
524
- this.viewsDropdown.open = false;
525
- const dateDropdown = this.dateDropdown;
526
- this.dropdownBackdropVisible = dateDropdown.open;
527
- dateDropdown.classList.toggle('open', dateDropdown.open);
528
- },
529
- onLabelInteraction: (e) => {
530
- if (!this.dateDropdown?.open && !this.dateOptionSelected) {
531
- e.stopPropagation();
532
- this.clearAlphaBarFilters();
533
- this.setSelectedSort(this.lastSelectedDateSort);
534
- }
535
- },
536
- });
537
- }
538
- /**
539
- * Provides the appropriate template to use for Views sorting, depending on how many
540
- * views sort fields are available.
541
- */
542
- get allViewsSortOptionsTemplate() {
543
- const numViewsSortOptions = this.availableViewsFields.length;
544
- switch (numViewsSortOptions) {
545
- case 0:
546
- return nothing;
547
- case 1:
548
- return this.viewsSortSelectorTemplate;
549
- default:
550
- return this.viewsDropdownTemplate;
551
- }
552
- }
553
- /**
554
- * Provides the appropriate template to use for Date sorting, depending on how many
555
- * date sort fields are available.
556
- */
557
- get allDateSortOptionsTemplate() {
558
- const numDateSortOptions = this.availableDateFields.length;
559
- switch (numDateSortOptions) {
560
- case 0:
561
- return nothing;
562
- case 1:
563
- return this.dateSortSelectorTemplate;
564
- default:
565
- return this.dateDropdownTemplate;
566
- }
567
- }
568
- /** Handler for when a new mobile sort dropdown option is selected */
569
- mobileSortChanged(e) {
248
+ /** Handler for when a new sort dropdown option is selected */
249
+ sortOptionSelected(e) {
570
250
  this.dropdownBackdropVisible = false;
571
251
  const sortField = e.detail.option.id;
572
252
  this.setSelectedSort(sortField);
@@ -635,38 +315,24 @@ let SortFilterBar = class SortFilterBar extends LitElement {
635
315
  return html `
636
316
  <div
637
317
  id="sort-selector-backdrop"
638
- @keyup=${this.closeDropdowns}
639
- @click=${this.closeDropdowns}
318
+ @keyup=${this.closeDropdown}
319
+ @click=${this.closeDropdown}
640
320
  ></div>
641
321
  `;
642
322
  }
643
- /** Closes all of the sorting dropdown components' menus */
644
- closeDropdowns() {
323
+ /** Closes the sorting dropdown component's menus */
324
+ closeDropdown() {
645
325
  this.dropdownBackdropVisible = false;
646
- const allDropdowns = [
647
- this.viewsDropdown,
648
- this.dateDropdown,
649
- this.mobileDropdown,
650
- ];
651
- for (const dropdown of allDropdowns) {
652
- if (!dropdown)
653
- continue;
654
- dropdown.open = false;
655
- dropdown.classList.remove('open');
656
- }
326
+ if (!this.sortOptionsDropdown)
327
+ return;
328
+ this.sortOptionsDropdown.open = false;
329
+ this.sortOptionsDropdown.classList.remove('open');
657
330
  }
658
331
  selectDropdownSortField(sortField) {
659
332
  // When a dropdown sort option is selected, we additionally need to clear the backdrop
660
333
  this.dropdownBackdropVisible = false;
661
334
  this.setSelectedSort(sortField);
662
335
  }
663
- clearAlphaBarFilters() {
664
- this.alphaSelectorVisible = null;
665
- this.selectedTitleFilter = null;
666
- this.selectedCreatorFilter = null;
667
- this.emitTitleLetterChangedEvent();
668
- this.emitCreatorLetterChangedEvent();
669
- }
670
336
  setSortDirection(sortDirection) {
671
337
  this.sortDirection = sortDirection;
672
338
  this.emitSortChangedEvent();
@@ -710,77 +376,6 @@ let SortFilterBar = class SortFilterBar extends LitElement {
710
376
  get canChangeSortDirection() {
711
377
  return SORT_OPTIONS[this.finalizedSortField].canSetDirection;
712
378
  }
713
- /**
714
- * There are four date sort options.
715
- *
716
- * This checks to see if the current sort is one of them.
717
- *
718
- * @readonly
719
- * @private
720
- * @type {boolean}
721
- * @memberof SortFilterBar
722
- */
723
- get dateOptionSelected() {
724
- const dateSortFields = [
725
- SortField.datefavorited,
726
- SortField.datearchived,
727
- SortField.date,
728
- SortField.datereviewed,
729
- SortField.dateadded,
730
- ];
731
- return dateSortFields.includes(this.finalizedSortField);
732
- }
733
- /**
734
- * There are two view sort options.
735
- *
736
- * This checks to see if the current sort is one of them.
737
- *
738
- * @readonly
739
- * @private
740
- * @type {boolean}
741
- * @memberof SortFilterBar
742
- */
743
- get viewOptionSelected() {
744
- const viewSortFields = [
745
- SortField.alltimeview,
746
- SortField.weeklyview,
747
- ];
748
- return viewSortFields.includes(this.finalizedSortField);
749
- }
750
- /**
751
- * The display name of the last selected date field
752
- *
753
- * @readonly
754
- * @private
755
- * @type {string}
756
- * @memberof SortFilterBar
757
- */
758
- get dateSortDisplayName() {
759
- return SORT_OPTIONS[this.lastSelectedDateSort].displayName;
760
- }
761
- /**
762
- * The display name of the last selected view field
763
- *
764
- * @readonly
765
- * @private
766
- * @type {string}
767
- * @memberof SortFilterBar
768
- */
769
- get viewSortDisplayName() {
770
- return SORT_OPTIONS[this.lastSelectedViewSort].displayName;
771
- }
772
- /**
773
- * Array of all the views sorts that should be shown
774
- */
775
- get availableViewsFields() {
776
- return ALL_VIEWS_SORT_FIELDS.filter(field => this.sortFieldAvailability[field]);
777
- }
778
- /**
779
- * Array of all the date sorts that should be shown
780
- */
781
- get availableDateFields() {
782
- return ALL_DATE_SORT_FIELDS.filter(field => this.sortFieldAvailability[field]);
783
- }
784
379
  get titleSelectorBar() {
785
380
  return html ` <alpha-bar
786
381
  .selectedLetter=${this.selectedTitleFilter}
@@ -844,6 +439,7 @@ let SortFilterBar = class SortFilterBar extends LitElement {
844
439
  display: flex;
845
440
  justify-content: flex-start;
846
441
  align-items: center;
442
+ padding-bottom: 1px;
847
443
  border-bottom: 1px solid #2c2c2c;
848
444
  font-size: 1.4rem;
849
445
  }
@@ -880,10 +476,16 @@ let SortFilterBar = class SortFilterBar extends LitElement {
880
476
  }
881
477
 
882
478
  .sort-direction-selector {
883
- padding: 0;
884
- border: none;
479
+ display: flex;
480
+ justify-content: center;
481
+ width: 30px;
482
+ margin: 0 5px 0 3px;
483
+ padding: 7px 8px;
484
+ max-height: fit-content;
485
+ border-radius: 5px;
486
+ background: white;
487
+ border: 1px solid rgb(25, 72, 128);
885
488
  appearance: none;
886
- background: transparent;
887
489
  cursor: pointer;
888
490
  }
889
491
 
@@ -899,27 +501,14 @@ let SortFilterBar = class SortFilterBar extends LitElement {
899
501
  border: none;
900
502
  padding: 0;
901
503
  outline: inherit;
902
- width: 14px;
903
- height: 14px;
504
+ width: 12px;
505
+ height: 12px;
904
506
  }
905
507
 
906
508
  .sort-direction-icon > svg {
907
509
  flex: 1;
908
510
  }
909
511
 
910
- #date-sort-selector,
911
- #view-sort-selector {
912
- position: absolute;
913
- left: 150px;
914
- top: 45px;
915
-
916
- z-index: 1;
917
- padding: 1rem;
918
- background-color: white;
919
- border-radius: 2.5rem;
920
- border: 1px solid #404142;
921
- }
922
-
923
512
  #sort-selector-container {
924
513
  flex: 1;
925
514
  display: flex;
@@ -927,30 +516,12 @@ let SortFilterBar = class SortFilterBar extends LitElement {
927
516
  align-items: center;
928
517
  }
929
518
 
930
- #desktop-sort-container,
931
- #mobile-sort-container {
519
+ #sort-dropdown-container {
932
520
  display: flex;
933
521
  justify-content: flex-start;
934
522
  align-items: center;
935
523
  }
936
524
 
937
- /*
938
- we move the desktop sort selector offscreen instead of display: none
939
- because we need to observe the width of it vs its container to determine
940
- if it's wide enough to display the desktop version and if you display: none,
941
- the width becomes 0
942
- */
943
- #desktop-sort-container.hidden {
944
- position: absolute;
945
- top: -9999px;
946
- left: -9999px;
947
- visibility: hidden;
948
- }
949
-
950
- #mobile-sort-container.hidden {
951
- display: none;
952
- }
953
-
954
525
  #sort-selector-backdrop {
955
526
  position: fixed;
956
527
  top: 0;
@@ -961,53 +532,6 @@ let SortFilterBar = class SortFilterBar extends LitElement {
961
532
  background-color: transparent;
962
533
  }
963
534
 
964
- #desktop-sort-selector {
965
- display: inline-flex;
966
- }
967
-
968
- #desktop-sort-selector li {
969
- display: flex;
970
- align-items: center;
971
- padding-left: 5px;
972
- padding-right: 5px;
973
- }
974
-
975
- #desktop-sort-selector li a {
976
- padding: 0 5px;
977
- text-decoration: none;
978
- color: #333;
979
- line-height: 2;
980
- }
981
-
982
- #desktop-sort-selector li button {
983
- padding: 0px 5px;
984
- border: none;
985
- background: none;
986
- font-family: inherit;
987
- font-size: inherit;
988
- color: #333;
989
- line-height: 2;
990
- cursor: pointer;
991
- appearance: none;
992
- }
993
-
994
- #desktop-sort-selector li button.selected {
995
- font-weight: bold;
996
- }
997
-
998
- /**
999
- * Fix to not shift the sort-bar options when get selected
1000
- */
1001
- #desktop-sort-selector li button::before,
1002
- #desktop-sort-selector .dropdown-label::before {
1003
- display: block;
1004
- content: attr(data-title);
1005
- font-weight: bold;
1006
- height: 0;
1007
- overflow: hidden;
1008
- visibility: hidden;
1009
- }
1010
-
1011
535
  #display-style-selector {
1012
536
  flex: 0;
1013
537
  }
@@ -1078,12 +602,6 @@ __decorate([
1078
602
  __decorate([
1079
603
  property({ type: String })
1080
604
  ], SortFilterBar.prototype, "defaultSortField", void 0);
1081
- __decorate([
1082
- property({ type: String })
1083
- ], SortFilterBar.prototype, "defaultViewSort", void 0);
1084
- __decorate([
1085
- property({ type: String })
1086
- ], SortFilterBar.prototype, "defaultDateSort", void 0);
1087
605
  __decorate([
1088
606
  property({ type: String })
1089
607
  ], SortFilterBar.prototype, "sortDirection", void 0);
@@ -1108,15 +626,6 @@ __decorate([
1108
626
  __decorate([
1109
627
  property({ type: Object })
1110
628
  ], SortFilterBar.prototype, "prefixFilterCountMap", void 0);
1111
- __decorate([
1112
- property({ type: Object })
1113
- ], SortFilterBar.prototype, "resizeObserver", void 0);
1114
- __decorate([
1115
- state()
1116
- ], SortFilterBar.prototype, "lastSelectedViewSort", void 0);
1117
- __decorate([
1118
- state()
1119
- ], SortFilterBar.prototype, "lastSelectedDateSort", void 0);
1120
629
  __decorate([
1121
630
  state()
1122
631
  ], SortFilterBar.prototype, "alphaSelectorVisible", void 0);
@@ -1124,26 +633,8 @@ __decorate([
1124
633
  state()
1125
634
  ], SortFilterBar.prototype, "dropdownBackdropVisible", void 0);
1126
635
  __decorate([
1127
- state()
1128
- ], SortFilterBar.prototype, "desktopSortContainerWidth", void 0);
1129
- __decorate([
1130
- state()
1131
- ], SortFilterBar.prototype, "selectorBarContainerWidth", void 0);
1132
- __decorate([
1133
- query('#desktop-sort-container')
1134
- ], SortFilterBar.prototype, "desktopSortContainer", void 0);
1135
- __decorate([
1136
- query('#sort-selector-container')
1137
- ], SortFilterBar.prototype, "sortSelectorContainer", void 0);
1138
- __decorate([
1139
- query('#views-dropdown')
1140
- ], SortFilterBar.prototype, "viewsDropdown", void 0);
1141
- __decorate([
1142
- query('#date-dropdown')
1143
- ], SortFilterBar.prototype, "dateDropdown", void 0);
1144
- __decorate([
1145
- query('#mobile-dropdown')
1146
- ], SortFilterBar.prototype, "mobileDropdown", void 0);
636
+ query('#sort-dropdown')
637
+ ], SortFilterBar.prototype, "sortOptionsDropdown", void 0);
1147
638
  SortFilterBar = __decorate([
1148
639
  customElement('sort-filter-bar')
1149
640
  ], SortFilterBar);