@internetarchive/collection-browser 2.19.1-alpha-webdev7818.0 → 2.20.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 (43) hide show
  1. package/dist/src/app-root.js +606 -605
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.js +26 -9
  4. package/dist/src/collection-browser.js.map +1 -1
  5. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
  6. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  7. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
  8. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  9. package/dist/src/collection-facets.js +263 -263
  10. package/dist/src/collection-facets.js.map +1 -1
  11. package/dist/src/expanded-date-picker.js +52 -52
  12. package/dist/src/expanded-date-picker.js.map +1 -1
  13. package/dist/src/models.d.ts +13 -0
  14. package/dist/src/models.js +41 -0
  15. package/dist/src/models.js.map +1 -1
  16. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +79 -24
  17. package/dist/src/sort-filter-bar/sort-filter-bar.js +201 -119
  18. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  19. package/dist/src/tiles/grid/item-tile.js +139 -139
  20. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  21. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +118 -118
  22. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  23. package/dist/src/tiles/list/tile-list.js +289 -289
  24. package/dist/src/tiles/list/tile-list.js.map +1 -1
  25. package/dist/src/tiles/tile-dispatcher.js +200 -200
  26. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  27. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +157 -11
  28. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/app-root.ts +1140 -1140
  31. package/src/collection-browser.ts +30 -8
  32. package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
  33. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
  34. package/src/collection-facets.ts +990 -990
  35. package/src/expanded-date-picker.ts +191 -191
  36. package/src/models.ts +48 -0
  37. package/src/sort-filter-bar/sort-filter-bar.ts +220 -126
  38. package/src/tiles/grid/item-tile.ts +339 -339
  39. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +129 -129
  40. package/src/tiles/list/tile-list.ts +688 -688
  41. package/src/tiles/tile-dispatcher.ts +486 -486
  42. package/test/sort-filter-bar/sort-filter-bar.test.ts +205 -12
  43. package/tsconfig.json +1 -1
@@ -47,6 +47,9 @@ import {
47
47
  tvFacetDisplayOrder,
48
48
  TvClipFilterType,
49
49
  TileBlurOverrideState,
50
+ defaultSortAvailability,
51
+ favoritesSortAvailability,
52
+ tvSortAvailability,
50
53
  } from './models';
51
54
  import {
52
55
  RestorationStateHandlerInterface,
@@ -236,7 +239,7 @@ export class CollectionBrowser
236
239
  */
237
240
  @property({ type: String }) facetLoadStrategy: FacetLoadStrategy = 'eager';
238
241
 
239
- @property({ type: Boolean }) facetPaneVisible = false;
242
+ @property({ type: Boolean, reflect: true }) facetPaneVisible = false;
240
243
 
241
244
  @property({ type: Boolean }) clearResultsOnEmptyQuery = false;
242
245
 
@@ -675,11 +678,7 @@ export class CollectionBrowser
675
678
  */
676
679
  private get desktopLeftColumnTemplate(): TemplateResult {
677
680
  return html`
678
- <div
679
- id="left-column"
680
- class="column"
681
- ?hidden=${!this.facetPaneVisible}
682
- >
681
+ <div id="left-column" class="column" ?hidden=${!this.facetPaneVisible}>
683
682
  ${this.facetTopViewSlot}
684
683
  <div id="facets-header-container">
685
684
  <h2 id="facets-header" class="sr-only">${msg('Filters')}</h2>
@@ -802,14 +801,37 @@ export class CollectionBrowser
802
801
  private get sortFilterBarTemplate(): TemplateResult | typeof nothing {
803
802
  if (this.suppressSortBar) return nothing;
804
803
 
804
+ // Determine the set of sortable fields that should be shown in the sort bar
805
+ let defaultViewSort = SortField.weeklyview;
806
+ let defaultDateSort = SortField.date;
807
+ let sortFieldAvailability = defaultSortAvailability;
808
+
809
+ // We adjust the sort options for a couple of special cases...
810
+ if (this.withinCollection?.startsWith('fav-')) {
811
+ // When viewing a fav- collection, we include the Date Favorited option and show
812
+ // it as the default in the date dropdown.
813
+ defaultDateSort = SortField.datefavorited;
814
+ sortFieldAvailability = favoritesSortAvailability;
815
+ } else if (!this.withinCollection && this.searchType === SearchType.TV) {
816
+ // When viewing TV search results, we default the views dropdown to All-time Views
817
+ // and exclude several of the usual date sort options.
818
+ defaultViewSort = SortField.alltimeview;
819
+ defaultDateSort = SortField.datearchived;
820
+ sortFieldAvailability = tvSortAvailability;
821
+ }
822
+
823
+ // We only show relevance sort if a search query is currently defined
824
+ sortFieldAvailability.relevance = this.isRelevanceSortAvailable;
825
+
805
826
  return html`
806
827
  <sort-filter-bar
807
828
  .defaultSortField=${this.defaultSortField}
808
829
  .defaultSortDirection=${this.defaultSortDirection}
830
+ .defaultViewSort=${defaultViewSort}
831
+ .defaultDateSort=${defaultDateSort}
809
832
  .selectedSort=${this.selectedSort}
810
833
  .sortDirection=${this.sortDirection}
811
- .showRelevance=${this.isRelevanceSortAvailable}
812
- .showDateFavorited=${this.withinCollection?.startsWith('fav-')}
834
+ .sortFieldAvailability=${sortFieldAvailability}
813
835
  .displayMode=${this.displayMode}
814
836
  .selectedTitleFilter=${this.selectedTitleFilter}
815
837
  .selectedCreatorFilter=${this.selectedCreatorFilter}