@internetarchive/collection-browser 3.3.4-alpha-webdev7761.3 → 3.3.4-alpha-webdev7761.5

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.
@@ -75,31 +75,34 @@ let CollectionFacets = class CollectionFacets extends LitElement {
75
75
  loading: this.facetsLoading,
76
76
  managing: this.isManageView,
77
77
  });
78
+ const heading = this.isTvSearch
79
+ ? msg('Date Published')
80
+ : msg('Year Published');
78
81
  // Added data-testid for Playwright testing
79
82
  // Using facet-group class and aria-labels is not ideal for Playwright locator
80
83
  const datePickerLabelId = 'date-picker-label';
81
- return html `
82
- <div id="container" class=${containerClasses}>
84
+ return html `
85
+ <div id="container" class=${containerClasses}>
83
86
  ${this.showHistogramDatePicker &&
84
87
  (this.histogramAggregation || this.histogramAggregationLoading)
85
- ? html `
86
- <section
87
- class="facet-group"
88
- aria-labelledby=${datePickerLabelId}
89
- data-testid="facet-group-header-label-date-picker"
90
- >
91
- <h3 id=${datePickerLabelId}>
92
- Year Published <span class="sr-only">range filter</span>
93
- ${this.expandDatePickerBtnTemplate}
94
- </h3>
95
- ${this.histogramTemplate}
96
- </section>
88
+ ? html `
89
+ <section
90
+ class="facet-group"
91
+ aria-labelledby=${datePickerLabelId}
92
+ data-testid="facet-group-header-label-date-picker"
93
+ >
94
+ <h3 id=${datePickerLabelId}>
95
+ ${heading} <span class="sr-only">${msg('range filter')}</span>
96
+ ${this.expandDatePickerBtnTemplate}
97
+ </h3>
98
+ ${this.histogramTemplate}
99
+ </section>
97
100
  `
98
- : nothing}
99
- ${this.collectionPartOfTemplate}
100
- <slot name="facets-top"></slot>
101
- ${this.mergedFacets.map(facetGroup => this.getFacetGroupTemplate(facetGroup))}
102
- </div>
101
+ : nothing}
102
+ ${this.collectionPartOfTemplate}
103
+ <slot name="facets-top"></slot>
104
+ ${this.mergedFacets.map(facetGroup => this.getFacetGroupTemplate(facetGroup))}
105
+ </div>
103
106
  `;
104
107
  }
105
108
  get collectionPartOfTemplate() {
@@ -110,31 +113,31 @@ let CollectionFacets = class CollectionFacets extends LitElement {
110
113
  // Added data-testid for Playwright testing
111
114
  // Using className and aria-labels is not ideal for Playwright locator
112
115
  const headingId = 'partof-heading';
113
- return html `
114
- <section
115
- class="facet-group partof-collections"
116
- aria-labelledby=${headingId}
117
- data-testid="facet-group-partof-collections"
118
- >
119
- <div class="facet-group-header">
120
- <h3 id=${headingId}>${msg('Part Of')}</h3>
121
- </div>
122
- <ul>
116
+ return html `
117
+ <section
118
+ class="facet-group partof-collections"
119
+ aria-labelledby=${headingId}
120
+ data-testid="facet-group-partof-collections"
121
+ >
122
+ <div class="facet-group-header">
123
+ <h3 id=${headingId}>${msg('Part Of')}</h3>
124
+ </div>
125
+ <ul>
123
126
  ${map(this.parentCollections, collxn => {
124
127
  var _a, _b;
125
128
  const collectionURL = `${this.baseNavigationUrl}${this.collectionPagePath}${collxn}`;
126
- return html ` <li>
127
- <a
128
- href=${collectionURL}
129
- data-id=${collxn}
130
- @click=${this.partOfCollectionClicked}
131
- >
132
- ${(_b = (_a = this.collectionTitles) === null || _a === void 0 ? void 0 : _a.get(collxn)) !== null && _b !== void 0 ? _b : collxn}
133
- </a>
129
+ return html ` <li>
130
+ <a
131
+ href=${collectionURL}
132
+ data-id=${collxn}
133
+ @click=${this.partOfCollectionClicked}
134
+ >
135
+ ${(_b = (_a = this.collectionTitles) === null || _a === void 0 ? void 0 : _a.get(collxn)) !== null && _b !== void 0 ? _b : collxn}
136
+ </a>
134
137
  </li>`;
135
- })}
136
- </ul>
137
- </section>
138
+ })}
139
+ </ul>
140
+ </section>
138
141
  `;
139
142
  }
140
143
  partOfCollectionClicked(e) {
@@ -217,24 +220,24 @@ let CollectionFacets = class CollectionFacets extends LitElement {
217
220
  expandedDatePicker.maxSelectedDate = this.maxSelectedDate;
218
221
  }
219
222
  };
220
- const customModalContent = html `
221
- <expanded-date-picker
222
- ${ref(expandedDatePickerChanged)}
223
- .minDate=${minDate}
224
- .maxDate=${maxDate}
225
- .minSelectedDate=${this.minSelectedDate}
226
- .maxSelectedDate=${this.maxSelectedDate}
227
- .customDateFormat=${dateFormat}
228
- .customTooltipDateFormat=${tooltipDateFormat}
229
- .customTooltipLabel=${tooltipLabel}
230
- .binSnapping=${binSnapping}
231
- .barScaling=${barScaling}
232
- .buckets=${buckets}
233
- .modalManager=${this.modalManager}
234
- .analyticsHandler=${this.analyticsHandler}
235
- @histogramDateRangeApplied=${this.histogramDateRangeUpdated}
236
- @modalClosed=${this.handleExpandedDatePickerClosed}
237
- ></expanded-date-picker>
223
+ const customModalContent = html `
224
+ <expanded-date-picker
225
+ ${ref(expandedDatePickerChanged)}
226
+ .minDate=${minDate}
227
+ .maxDate=${maxDate}
228
+ .minSelectedDate=${this.minSelectedDate}
229
+ .maxSelectedDate=${this.maxSelectedDate}
230
+ .customDateFormat=${dateFormat}
231
+ .customTooltipDateFormat=${tooltipDateFormat}
232
+ .customTooltipLabel=${tooltipLabel}
233
+ .binSnapping=${binSnapping}
234
+ .barScaling=${barScaling}
235
+ .buckets=${buckets}
236
+ .modalManager=${this.modalManager}
237
+ .analyticsHandler=${this.analyticsHandler}
238
+ @histogramDateRangeApplied=${this.histogramDateRangeUpdated}
239
+ @modalClosed=${this.handleExpandedDatePickerClosed}
240
+ ></expanded-date-picker>
238
241
  `;
239
242
  const config = new ModalConfig({
240
243
  bodyColor: '#fff',
@@ -273,12 +276,12 @@ let CollectionFacets = class CollectionFacets extends LitElement {
273
276
  */
274
277
  get expandDatePickerBtnTemplate() {
275
278
  return this.allowExpandingDatePicker && !this.facetsLoading
276
- ? html `<button
277
- class="expand-date-picker-btn"
278
- aria-haspopup="dialog"
279
- @click=${this.showDatePickerModal}
280
- >
281
- ${expandIcon}
279
+ ? html `<button
280
+ class="expand-date-picker-btn"
281
+ aria-haspopup="dialog"
282
+ @click=${this.showDatePickerModal}
283
+ >
284
+ ${expandIcon}
282
285
  </button>`
283
286
  : nothing;
284
287
  }
@@ -291,26 +294,26 @@ let CollectionFacets = class CollectionFacets extends LitElement {
291
294
  if (!histogramProps)
292
295
  return nothing;
293
296
  const { buckets, dateFormat, tooltipDateFormat, tooltipLabel, binSnapping, barScaling, minDate, maxDate, } = histogramProps;
294
- return html `
295
- <histogram-date-range
296
- class=${this.isTvSearch ? 'wide-inputs' : ''}
297
- .minDate=${minDate}
298
- .maxDate=${maxDate}
299
- .minSelectedDate=${(_a = this.minSelectedDate) !== null && _a !== void 0 ? _a : minDate}
300
- .maxSelectedDate=${(_b = this.maxSelectedDate) !== null && _b !== void 0 ? _b : maxDate}
301
- .updateDelay=${100}
302
- .dateFormat=${dateFormat}
303
- .tooltipDateFormat=${tooltipDateFormat}
304
- .tooltipLabel=${tooltipLabel}
305
- .binSnapping=${binSnapping}
306
- .barScaling=${barScaling}
307
- .bins=${buckets}
308
- missingDataMessage="..."
297
+ return html `
298
+ <histogram-date-range
299
+ class=${this.isTvSearch ? 'wide-inputs' : ''}
300
+ .minDate=${minDate}
301
+ .maxDate=${maxDate}
302
+ .minSelectedDate=${(_a = this.minSelectedDate) !== null && _a !== void 0 ? _a : minDate}
303
+ .maxSelectedDate=${(_b = this.maxSelectedDate) !== null && _b !== void 0 ? _b : maxDate}
304
+ .updateDelay=${100}
305
+ .dateFormat=${dateFormat}
306
+ .tooltipDateFormat=${tooltipDateFormat}
307
+ .tooltipLabel=${tooltipLabel}
308
+ .binSnapping=${binSnapping}
309
+ .barScaling=${barScaling}
310
+ .bins=${buckets}
311
+ missingDataMessage="..."
309
312
  .width=${this.collapsableFacets && this.contentWidth
310
313
  ? this.contentWidth
311
- : 180}
312
- @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
313
- ></histogram-date-range>
314
+ : 180}
315
+ @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
316
+ ></histogram-date-range>
314
317
  `;
315
318
  }
316
319
  /**
@@ -496,8 +499,8 @@ let CollectionFacets = class CollectionFacets extends LitElement {
496
499
  return nothing;
497
500
  const { key } = facetGroup;
498
501
  const isOpen = this.openFacets[key];
499
- const collapser = html `
500
- <span class="collapser ${isOpen ? 'open' : ''}"> ${chevronIcon} </span>
502
+ const collapser = html `
503
+ <span class="collapser ${isOpen ? 'open' : ''}"> ${chevronIcon} </span>
501
504
  `;
502
505
  const toggleCollapsed = () => {
503
506
  const newOpenFacets = { ...this.openFacets };
@@ -507,40 +510,40 @@ let CollectionFacets = class CollectionFacets extends LitElement {
507
510
  // Added data-testid for Playwright testing
508
511
  // Using className and aria-labels is not ideal for Playwright locator
509
512
  const headerId = `facet-group-header-label-${facetGroup.key}`;
510
- return html `
511
- <section
512
- class="facet-group ${this.collapsableFacets ? 'mobile' : ''}"
513
- aria-labelledby=${headerId}
514
- data-testid=${headerId}
515
- >
516
- <div class="facet-group-header">
517
- <h3
518
- id=${headerId}
519
- @click=${toggleCollapsed}
520
- @keyup=${toggleCollapsed}
521
- >
522
- ${this.collapsableFacets ? collapser : nothing} ${facetGroup.title}
523
- <span class="sr-only">filters</span>
524
- </h3>
525
- </div>
526
- <div
527
- class="facet-group-content ${isOpen ? 'open' : ''}"
528
- data-testid="facet-group-content-${facetGroup.key}"
529
- >
513
+ return html `
514
+ <section
515
+ class="facet-group ${this.collapsableFacets ? 'mobile' : ''}"
516
+ aria-labelledby=${headerId}
517
+ data-testid=${headerId}
518
+ >
519
+ <div class="facet-group-header">
520
+ <h3
521
+ id=${headerId}
522
+ @click=${toggleCollapsed}
523
+ @keyup=${toggleCollapsed}
524
+ >
525
+ ${this.collapsableFacets ? collapser : nothing} ${facetGroup.title}
526
+ <span class="sr-only">filters</span>
527
+ </h3>
528
+ </div>
529
+ <div
530
+ class="facet-group-content ${isOpen ? 'open' : ''}"
531
+ data-testid="facet-group-content-${facetGroup.key}"
532
+ >
530
533
  ${this.facetsLoading
531
534
  ? this.getTombstoneFacetGroupTemplate()
532
- : html `
533
- ${this.getFacetTemplate(facetGroup)}
534
- ${this.searchMoreFacetsLink(facetGroup)}
535
- `}
536
- </div>
537
- </section>
535
+ : html `
536
+ ${this.getFacetTemplate(facetGroup)}
537
+ ${this.searchMoreFacetsLink(facetGroup)}
538
+ `}
539
+ </div>
540
+ </section>
538
541
  `;
539
542
  }
540
543
  getTombstoneFacetGroupTemplate() {
541
544
  // Render five tombstone rows
542
- return html `
543
- ${map(Array(5).fill(null), () => html `<facet-tombstone-row></facet-tombstone-row>`)}
545
+ return html `
546
+ ${map(Array(5).fill(null), () => html `<facet-tombstone-row></facet-tombstone-row>`)}
544
547
  `;
545
548
  }
546
549
  /**
@@ -565,8 +568,8 @@ let CollectionFacets = class CollectionFacets extends LitElement {
565
568
  const facetSort = defaultFacetSort[facetGroup.key];
566
569
  // Added data-testid for Playwright testing
567
570
  // Using the className is not ideal for Playwright locator
568
- return html `<button
569
- class="more-link"
571
+ return html `<button
572
+ class="more-link"
570
573
  @click=${() => {
571
574
  var _a;
572
575
  this.showMoreFacetsModal(facetGroup, facetSort);
@@ -576,30 +579,30 @@ let CollectionFacets = class CollectionFacets extends LitElement {
576
579
  label: facetGroup.key,
577
580
  });
578
581
  this.dispatchEvent(new CustomEvent('showMoreFacets', { detail: facetGroup.key }));
579
- }}
580
- data-testid="more-link-btn"
581
- >
582
- More...
582
+ }}
583
+ data-testid="more-link-btn"
584
+ >
585
+ More...
583
586
  </button>`;
584
587
  }
585
588
  async showMoreFacetsModal(facetGroup, sortedBy) {
586
589
  var _a, _b;
587
- const customModalContent = html `
588
- <more-facets-content
589
- .analyticsHandler=${this.analyticsHandler}
590
- .facetKey=${facetGroup.key}
591
- .query=${this.query}
592
- .identifiers=${this.identifiers}
593
- .filterMap=${this.filterMap}
594
- .pageSpecifierParams=${this.pageSpecifierParams}
595
- .modalManager=${this.modalManager}
596
- .searchService=${this.searchService}
597
- .searchType=${this.searchType}
598
- .collectionTitles=${this.collectionTitles}
599
- .tvChannelAliases=${this.tvChannelAliases}
600
- .selectedFacets=${this.selectedFacets}
601
- .sortedBy=${sortedBy}
602
- .isTvSearch=${this.isTvSearch}
590
+ const customModalContent = html `
591
+ <more-facets-content
592
+ .analyticsHandler=${this.analyticsHandler}
593
+ .facetKey=${facetGroup.key}
594
+ .query=${this.query}
595
+ .identifiers=${this.identifiers}
596
+ .filterMap=${this.filterMap}
597
+ .pageSpecifierParams=${this.pageSpecifierParams}
598
+ .modalManager=${this.modalManager}
599
+ .searchService=${this.searchService}
600
+ .searchType=${this.searchType}
601
+ .collectionTitles=${this.collectionTitles}
602
+ .tvChannelAliases=${this.tvChannelAliases}
603
+ .selectedFacets=${this.selectedFacets}
604
+ .sortedBy=${sortedBy}
605
+ .isTvSearch=${this.isTvSearch}
603
606
  @facetsChanged=${(e) => {
604
607
  const event = new CustomEvent('facetsChanged', {
605
608
  detail: e.detail,
@@ -607,9 +610,9 @@ let CollectionFacets = class CollectionFacets extends LitElement {
607
610
  composed: true,
608
611
  });
609
612
  this.dispatchEvent(event);
610
- }}
611
- >
612
- </more-facets-content>
613
+ }}
614
+ >
615
+ </more-facets-content>
613
616
  `;
614
617
  const config = new ModalConfig({
615
618
  bodyColor: '#fff',
@@ -632,12 +635,12 @@ let CollectionFacets = class CollectionFacets extends LitElement {
632
635
  * Generate the list template for each bucket in a facet group
633
636
  */
634
637
  getFacetTemplate(facetGroup) {
635
- return html `
636
- <facets-template
637
- .collectionPagePath=${this.collectionPagePath}
638
- .facetGroup=${facetGroup}
639
- .selectedFacets=${this.selectedFacets}
640
- .collectionTitles=${this.collectionTitles}
638
+ return html `
639
+ <facets-template
640
+ .collectionPagePath=${this.collectionPagePath}
641
+ .facetGroup=${facetGroup}
642
+ .selectedFacets=${this.selectedFacets}
643
+ .collectionTitles=${this.collectionTitles}
641
644
  @facetClick=${(e) => {
642
645
  this.selectedFacets = updateSelectedFacetBucket(this.selectedFacets, facetGroup.key, e.detail.bucket, true);
643
646
  const event = new CustomEvent('facetsChanged', {
@@ -646,134 +649,134 @@ let CollectionFacets = class CollectionFacets extends LitElement {
646
649
  composed: true,
647
650
  });
648
651
  this.dispatchEvent(event);
649
- }}
650
- ></facets-template>
652
+ }}
653
+ ></facets-template>
651
654
  `;
652
655
  }
653
656
  static get styles() {
654
657
  return [
655
658
  srOnlyStyle,
656
- css `
657
- a:link {
658
- text-decoration: none;
659
- color: var(--ia-theme-link-color, #4b64ff);
660
- }
661
- a:link:hover {
662
- text-decoration: underline;
663
- }
664
-
665
- #container.loading {
666
- opacity: 0.5;
667
- }
668
-
669
- #container.managing {
670
- opacity: 0.3;
671
- }
672
-
673
- .histogram-loading-indicator {
674
- width: 100%;
675
- height: 2.25rem;
676
- margin-top: 1.75rem;
677
- font-size: 1.4rem;
678
- text-align: center;
679
- }
680
-
681
- .collapser {
682
- display: inline-block;
683
- cursor: pointer;
684
- width: 10px;
685
- height: 10px;
686
- }
687
-
688
- .collapser svg {
689
- transition: transform 0.2s ease-in-out;
690
- }
691
-
692
- .collapser.open svg {
693
- transform: rotate(90deg);
694
- }
695
-
696
- .facet-group:not(:last-child) {
697
- margin-bottom: 2rem;
698
- }
699
-
700
- .facet-group h3 {
701
- margin-bottom: 0.7rem;
702
- }
703
-
704
- .facet-group.mobile h3 {
705
- cursor: pointer;
706
- }
707
-
708
- .facet-group-header {
709
- display: flex;
710
- margin-bottom: 0.7rem;
711
- justify-content: space-between;
712
- border-bottom: 1px solid rgb(232, 232, 232);
713
- }
714
-
715
- .facet-group-content {
716
- transition: max-height 0.2s ease-in-out;
717
- }
718
-
719
- .facet-group.mobile .facet-group-content {
720
- max-height: 0;
721
- overflow: hidden;
722
- }
723
-
724
- .facet-group.mobile .facet-group-content.open {
725
- max-height: 2000px;
726
- }
727
-
728
- .partof-collections ul {
729
- list-style-type: none;
730
- padding: 0;
731
- font-size: 1.2rem;
732
- }
733
-
734
- h3 {
735
- font-size: 1.4rem;
736
- margin: 0;
737
- }
738
-
739
- .more-link {
740
- font-size: 1.2rem;
741
- text-decoration: none;
742
- padding: 0;
743
- margin-top: 0.25rem;
744
- background: inherit;
745
- border: 0;
746
- color: var(--ia-theme-link-color, #4b64ff);
747
- cursor: pointer;
748
- }
749
-
750
- #date-picker-label {
751
- display: flex;
752
- justify-content: space-between;
753
- }
754
-
755
- .expand-date-picker-btn {
756
- margin: 0;
757
- padding: 0;
758
- border: 0;
759
- appearance: none;
760
- background: none;
761
- cursor: pointer;
762
- }
763
-
764
- .expand-date-picker-btn > svg {
765
- width: 14px;
766
- height: 14px;
767
- }
768
-
769
- .sorting-icon {
770
- height: 15px;
771
- cursor: pointer;
772
- }
773
-
774
- histogram-date-range.wide-inputs {
775
- --histogramDateRangeInputWidth: 4.8rem;
776
- }
659
+ css `
660
+ a:link {
661
+ text-decoration: none;
662
+ color: var(--ia-theme-link-color, #4b64ff);
663
+ }
664
+ a:link:hover {
665
+ text-decoration: underline;
666
+ }
667
+
668
+ #container.loading {
669
+ opacity: 0.5;
670
+ }
671
+
672
+ #container.managing {
673
+ opacity: 0.3;
674
+ }
675
+
676
+ .histogram-loading-indicator {
677
+ width: 100%;
678
+ height: 2.25rem;
679
+ margin-top: 1.75rem;
680
+ font-size: 1.4rem;
681
+ text-align: center;
682
+ }
683
+
684
+ .collapser {
685
+ display: inline-block;
686
+ cursor: pointer;
687
+ width: 10px;
688
+ height: 10px;
689
+ }
690
+
691
+ .collapser svg {
692
+ transition: transform 0.2s ease-in-out;
693
+ }
694
+
695
+ .collapser.open svg {
696
+ transform: rotate(90deg);
697
+ }
698
+
699
+ .facet-group:not(:last-child) {
700
+ margin-bottom: 2rem;
701
+ }
702
+
703
+ .facet-group h3 {
704
+ margin-bottom: 0.7rem;
705
+ }
706
+
707
+ .facet-group.mobile h3 {
708
+ cursor: pointer;
709
+ }
710
+
711
+ .facet-group-header {
712
+ display: flex;
713
+ margin-bottom: 0.7rem;
714
+ justify-content: space-between;
715
+ border-bottom: 1px solid rgb(232, 232, 232);
716
+ }
717
+
718
+ .facet-group-content {
719
+ transition: max-height 0.2s ease-in-out;
720
+ }
721
+
722
+ .facet-group.mobile .facet-group-content {
723
+ max-height: 0;
724
+ overflow: hidden;
725
+ }
726
+
727
+ .facet-group.mobile .facet-group-content.open {
728
+ max-height: 2000px;
729
+ }
730
+
731
+ .partof-collections ul {
732
+ list-style-type: none;
733
+ padding: 0;
734
+ font-size: 1.2rem;
735
+ }
736
+
737
+ h3 {
738
+ font-size: 1.4rem;
739
+ margin: 0;
740
+ }
741
+
742
+ .more-link {
743
+ font-size: 1.2rem;
744
+ text-decoration: none;
745
+ padding: 0;
746
+ margin-top: 0.25rem;
747
+ background: inherit;
748
+ border: 0;
749
+ color: var(--ia-theme-link-color, #4b64ff);
750
+ cursor: pointer;
751
+ }
752
+
753
+ #date-picker-label {
754
+ display: flex;
755
+ justify-content: space-between;
756
+ }
757
+
758
+ .expand-date-picker-btn {
759
+ margin: 0;
760
+ padding: 0;
761
+ border: 0;
762
+ appearance: none;
763
+ background: none;
764
+ cursor: pointer;
765
+ }
766
+
767
+ .expand-date-picker-btn > svg {
768
+ width: 14px;
769
+ height: 14px;
770
+ }
771
+
772
+ .sorting-icon {
773
+ height: 15px;
774
+ cursor: pointer;
775
+ }
776
+
777
+ histogram-date-range.wide-inputs {
778
+ --histogramDateRangeInputWidth: 4.8rem;
779
+ }
777
780
  `,
778
781
  ];
779
782
  }