@internetarchive/collection-browser 0.4.18-alpha.6 → 0.4.19

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 (63) hide show
  1. package/dist/src/collection-browser.d.ts +10 -9
  2. package/dist/src/collection-browser.js +331 -328
  3. package/dist/src/collection-browser.js.map +1 -1
  4. package/dist/src/collection-facets/facets-template.js +0 -2
  5. package/dist/src/collection-facets/facets-template.js.map +1 -1
  6. package/dist/src/collection-facets/more-facets-content.js +70 -63
  7. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  8. package/dist/src/collection-facets/more-facets-pagination.js +55 -49
  9. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  10. package/dist/src/collection-facets/toggle-switch.js +56 -46
  11. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  12. package/dist/src/collection-facets.d.ts +1 -1
  13. package/dist/src/collection-facets.js +84 -94
  14. package/dist/src/collection-facets.js.map +1 -1
  15. package/dist/src/sort-filter-bar/alpha-bar.d.ts +1 -2
  16. package/dist/src/sort-filter-bar/alpha-bar.js +25 -33
  17. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  18. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +1 -1
  19. package/dist/src/sort-filter-bar/sort-filter-bar.js +186 -198
  20. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  21. package/dist/src/tiles/grid/account-tile.js +1 -1
  22. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  23. package/dist/src/tiles/grid/collection-tile.js +2 -2
  24. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  25. package/dist/src/tiles/grid/item-tile.js +2 -2
  26. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  27. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +15 -5
  28. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  29. package/dist/src/tiles/grid/tile-stats.js +65 -58
  30. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  31. package/dist/src/tiles/tile-dispatcher.js +2 -3
  32. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  33. package/dist/test/collection-browser.test.js +2 -2
  34. package/dist/test/collection-browser.test.js.map +1 -1
  35. package/dist/test/collection-facets.test.js +5 -8
  36. package/dist/test/collection-facets.test.js.map +1 -1
  37. package/dist/test/sort-filter-bar/alpha-bar.test.js +12 -12
  38. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
  39. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +2 -2
  40. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  41. package/package.json +5 -5
  42. package/src/collection-browser.ts +339 -330
  43. package/src/collection-facets/facets-template.ts +0 -2
  44. package/src/collection-facets/more-facets-content.ts +70 -63
  45. package/src/collection-facets/more-facets-pagination.ts +55 -49
  46. package/src/collection-facets/toggle-switch.ts +61 -51
  47. package/src/collection-facets.ts +85 -96
  48. package/src/sort-filter-bar/alpha-bar.ts +18 -26
  49. package/src/sort-filter-bar/sort-filter-bar.ts +186 -200
  50. package/src/tiles/grid/account-tile.ts +1 -1
  51. package/src/tiles/grid/collection-tile.ts +2 -2
  52. package/src/tiles/grid/item-tile.ts +2 -2
  53. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +15 -5
  54. package/src/tiles/grid/tile-stats.ts +73 -66
  55. package/src/tiles/tile-dispatcher.ts +0 -1
  56. package/test/collection-browser.test.ts +2 -2
  57. package/test/collection-facets.test.ts +2 -10
  58. package/test/sort-filter-bar/alpha-bar.test.ts +12 -16
  59. package/test/sort-filter-bar/sort-filter-bar.test.ts +2 -2
  60. package/dist/src/styles/sr-only.d.ts +0 -1
  61. package/dist/src/styles/sr-only.js +0 -18
  62. package/dist/src/styles/sr-only.js.map +0 -1
  63. package/src/styles/sr-only.ts +0 -18
@@ -5,7 +5,6 @@ import { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled';
5
5
  import { reviewsIcon } from '../../assets/img/icons/reviews';
6
6
  import { uploadIcon } from '../../assets/img/icons/upload';
7
7
  import { viewsIcon } from '../../assets/img/icons/views';
8
- import { srOnlyStyle } from '../../styles/sr-only';
9
8
 
10
9
  import { formatCount } from '../../utils/format-count';
11
10
 
@@ -79,70 +78,78 @@ export class TileStats extends LitElement {
79
78
  }
80
79
 
81
80
  static get styles(): CSSResultGroup {
82
- return [
83
- srOnlyStyle,
84
- css`
85
- mediatype-icon {
86
- --iconHeight: 25px;
87
- --iconWidth: 25px;
88
- }
89
-
90
- ul {
91
- all: unset; // unset all property values
92
- list-style-type: none; // remove default list-style
93
- }
94
-
95
- li {
96
- list-style-type: none; // remove default list-style
97
- }
98
-
99
- svg {
100
- height: 13px;
101
- width: 13px;
102
- display: block;
103
- margin: auto;
104
- pointer-events: none;
105
- }
106
-
107
- /* Make the reviews icon slightly smaller/lower, for even visual weight */
108
- .reviews svg {
109
- height: 11px;
110
- width: 11px;
111
- margin-top: 2px;
112
- }
113
-
114
- .item-stats {
115
- height: 30px;
116
- padding-left: 5px;
117
- padding-right: 5px;
118
- font-family: 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;
119
- text-align: center;
120
- }
121
-
122
- #stats-row {
123
- display: flex;
124
- justify-content: space-between;
125
- flex-wrap: wrap;
126
- width: 100%;
127
- padding-bottom: 5px;
128
- }
129
-
130
- .col {
131
- min-width: 15px;
132
- max-width: 25%;
133
- height: 25px;
134
- }
135
-
136
- .status-text {
137
- font-size: 14px;
138
- height: 15px;
139
- color: #2c2c2c;
140
- line-height: 17px;
141
- margin: auto;
142
- display: block;
143
- text-align: center;
144
- }
145
- `,
146
- ];
81
+ return css`
82
+ mediatype-icon {
83
+ --iconHeight: 25px;
84
+ --iconWidth: 25px;
85
+ }
86
+
87
+ ul {
88
+ all: unset; // unset all property values
89
+ list-style-type: none; // remove default list-style
90
+ }
91
+
92
+ li {
93
+ list-style-type: none; // remove default list-style
94
+ }
95
+
96
+ svg {
97
+ height: 13px;
98
+ width: 13px;
99
+ display: block;
100
+ margin: auto;
101
+ pointer-events: none;
102
+ }
103
+
104
+ /* Make the reviews icon slightly smaller/lower, for even visual weight */
105
+ .reviews svg {
106
+ height: 11px;
107
+ width: 11px;
108
+ margin-top: 2px;
109
+ }
110
+
111
+ .item-stats {
112
+ height: 30px;
113
+ padding-left: 5px;
114
+ padding-right: 5px;
115
+ font-family: 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;
116
+ text-align: center;
117
+ }
118
+
119
+ #stats-row {
120
+ display: flex;
121
+ justify-content: space-between;
122
+ flex-wrap: wrap;
123
+ width: 100%;
124
+ padding-bottom: 5px;
125
+ }
126
+
127
+ .sr-only {
128
+ position: absolute;
129
+ width: 1px;
130
+ height: 1px;
131
+ padding: 0;
132
+ margin: -1px;
133
+ overflow: hidden;
134
+ clip: rect(0, 0, 0, 0);
135
+ border: 0;
136
+ }
137
+
138
+ .col {
139
+ min-width: 15px;
140
+ max-width: 25%;
141
+ height: 25px;
142
+ }
143
+
144
+ .status-text {
145
+ font-size: 14px;
146
+ height: 15px;
147
+ color: #2c2c2c;
148
+ line-height: 17px;
149
+ margin: auto;
150
+ display: block;
151
+ text-align: center;
152
+ }
153
+ `;
147
154
  }
148
155
  }
@@ -123,7 +123,6 @@ export class TileDispatcher
123
123
  return html`
124
124
  <a
125
125
  href="${this.linkTileHref}"
126
- aria-label=${this.model?.title ?? 'Untitled item'}
127
126
  title=${this.shouldPrepareHoverPane
128
127
  ? nothing // Don't show title tooltips when we have the tile info popups
129
128
  : ifDefined(this.model?.title)}
@@ -393,7 +393,7 @@ describe('Collection Browser', () => {
393
393
  await el.updateComplete;
394
394
 
395
395
  // This shouldn't throw an error
396
- expect(el.fetchPage(2)).to.exist;
396
+ expect(el.fetchPage(3)).to.exist;
397
397
 
398
398
  // Should continue showing the empty placeholder
399
399
  expect(el.shadowRoot?.querySelector('empty-placeholder')).to.exist;
@@ -652,7 +652,7 @@ describe('Collection Browser', () => {
652
652
  el.sortParam = { field: 'foo', direction: 'asc' };
653
653
  await el.updateComplete;
654
654
 
655
- await el.fetchPage(2);
655
+ await el.fetchPage(3);
656
656
 
657
657
  // If there is no change to the query or sort param during the fetch, the results
658
658
  // should be read.
@@ -119,16 +119,8 @@ describe('Collection Facets', () => {
119
119
  expect(facetGroups?.length).to.equal(1);
120
120
 
121
121
  const titleFacetGroup = facetGroups?.[0];
122
- const facetGroupHeader = titleFacetGroup?.querySelector('h3');
123
- // Every facet group header has an invisible " filters" suffix for screen-readers
124
- expect(
125
- facetGroupHeader?.querySelector('span.sr-only')?.textContent?.trim()
126
- ).to.equal('filters');
127
- // Ignoring the screen-reader suffix, we should be left with only the readable, capitalized title
128
- expect(
129
- facetGroupHeader?.textContent?.trim().replace(/\s*filters$/, '')
130
- ).to.equal('Subject');
131
-
122
+ const facetGroupHeader = titleFacetGroup?.querySelector('h1');
123
+ expect(facetGroupHeader?.textContent?.trim()).to.equal('Subject');
132
124
  const titleFacetRow = titleFacetGroup
133
125
  ?.querySelector('facets-template')
134
126
  ?.shadowRoot?.querySelector('.facet-row');
@@ -14,34 +14,30 @@ describe('Alphabetical Filter Bar', () => {
14
14
  expect(letters?.length).to.equal(26);
15
15
  });
16
16
 
17
- it('renders letters with items as buttons', async () => {
17
+ it('renders letters with items as links', async () => {
18
18
  const el = await fixture<AlphaBar>(html`<alpha-bar></alpha-bar>`);
19
19
 
20
20
  el.letterCounts = { U: 10, X: 10 };
21
21
  await el.updateComplete;
22
22
 
23
- // Should have exactly two letter buttons
24
- const letterButtons = el.shadowRoot?.querySelectorAll(
25
- 'li > button:not(:disabled)'
26
- );
27
- expect(letterButtons?.length).to.equal(2);
28
- expect(letterButtons?.item(0).textContent?.trim()).to.equal('U');
29
- expect(letterButtons?.item(1).textContent?.trim()).to.equal('X');
23
+ // Should have exactly two letter links
24
+ const letterLinks = el.shadowRoot?.querySelectorAll('li > a[href]');
25
+ expect(letterLinks?.length).to.equal(2);
26
+ expect(letterLinks?.item(0).textContent?.trim()).to.equal('U');
27
+ expect(letterLinks?.item(1).textContent?.trim()).to.equal('X');
30
28
  });
31
29
 
32
- it('renders letters without items as disabled buttons', async () => {
30
+ it('renders letters without items as uninteractive text', async () => {
33
31
  const el = await fixture<AlphaBar>(html`<alpha-bar></alpha-bar>`);
34
32
 
35
33
  el.letterCounts = { U: 10, X: 10 };
36
34
  await el.updateComplete;
37
35
 
38
- // All but the two letters above should be disabled
39
- const letterButtons = el.shadowRoot?.querySelectorAll(
40
- 'li > button:disabled'
41
- );
42
- expect(letterButtons?.length).to.equal(24);
43
- expect(letterButtons?.item(0).textContent?.trim()).to.equal('A');
44
- expect(letterButtons?.item(23).textContent?.trim()).to.equal('Z');
36
+ // All but the two letters above should just be inert spans, not links
37
+ const letterNonLinks = el.shadowRoot?.querySelectorAll('li > span');
38
+ expect(letterNonLinks?.length).to.equal(24);
39
+ expect(letterNonLinks?.item(0).textContent?.trim()).to.equal('A');
40
+ expect(letterNonLinks?.item(23).textContent?.trim()).to.equal('Z');
45
41
  });
46
42
 
47
43
  it('renders the selected letter with the "selected" class', async () => {
@@ -456,7 +456,7 @@ describe('Sort/filter bar letter behavior', () => {
456
456
 
457
457
  const alphaBar = el.shadowRoot?.querySelector('alpha-bar');
458
458
  const letterLink = alphaBar?.shadowRoot?.querySelector(
459
- 'li > button:not(:disabled)'
459
+ 'li > a[href]'
460
460
  ) as HTMLAnchorElement;
461
461
  expect(letterLink?.textContent?.trim()).to.equal('T');
462
462
 
@@ -477,7 +477,7 @@ describe('Sort/filter bar letter behavior', () => {
477
477
 
478
478
  const alphaBar = el.shadowRoot?.querySelector('alpha-bar');
479
479
  const letterLink = alphaBar?.shadowRoot?.querySelector(
480
- 'li > button:not(:disabled)'
480
+ 'li > a[href]'
481
481
  ) as HTMLAnchorElement;
482
482
  expect(letterLink?.textContent?.trim()).to.equal('C');
483
483
 
@@ -1 +0,0 @@
1
- export declare const srOnlyStyle: import("lit").CSSResult;
@@ -1,18 +0,0 @@
1
- import { css } from 'lit';
2
- export const srOnlyStyle = css `
3
- .sr-only {
4
- position: absolute !important;
5
- width: 1px !important;
6
- height: 1px !important;
7
- margin: -1px !important;
8
- padding: 0 !important;
9
- border: 0 !important;
10
- overflow: hidden !important;
11
- white-space: nowrap !important;
12
- clip: rect(1px, 1px, 1px, 1px) !important;
13
- -webkit-clip-path: inset(50%) !important;
14
- clip-path: inset(50%) !important;
15
- user-select: none !important;
16
- }
17
- `;
18
- //# sourceMappingURL=sr-only.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sr-only.js","sourceRoot":"","sources":["../../../src/styles/sr-only.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;CAe7B,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const srOnlyStyle = css`\n .sr-only {\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n margin: -1px !important;\n padding: 0 !important;\n border: 0 !important;\n overflow: hidden !important;\n white-space: nowrap !important;\n clip: rect(1px, 1px, 1px, 1px) !important;\n -webkit-clip-path: inset(50%) !important;\n clip-path: inset(50%) !important;\n user-select: none !important;\n }\n`;\n"]}
@@ -1,18 +0,0 @@
1
- import { css } from 'lit';
2
-
3
- export const srOnlyStyle = css`
4
- .sr-only {
5
- position: absolute !important;
6
- width: 1px !important;
7
- height: 1px !important;
8
- margin: -1px !important;
9
- padding: 0 !important;
10
- border: 0 !important;
11
- overflow: hidden !important;
12
- white-space: nowrap !important;
13
- clip: rect(1px, 1px, 1px, 1px) !important;
14
- -webkit-clip-path: inset(50%) !important;
15
- clip-path: inset(50%) !important;
16
- user-select: none !important;
17
- }
18
- `;