@internetarchive/collection-browser 0.4.19 → 0.4.20
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.
- package/dist/src/collection-browser.d.ts +8 -1
- package/dist/src/collection-browser.js +319 -291
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facets-template.js +2 -0
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.js +63 -70
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +49 -55
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.js +46 -56
- package/dist/src/collection-facets/toggle-switch.js.map +1 -1
- package/dist/src/collection-facets.d.ts +1 -1
- package/dist/src/collection-facets.js +94 -84
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +2 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +33 -25
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +198 -186
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/styles/sr-only.d.ts +1 -0
- package/dist/src/styles/sr-only.js +18 -0
- package/dist/src/styles/sr-only.js.map +1 -0
- package/dist/src/tiles/grid/account-tile.js +1 -1
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +2 -2
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +2 -2
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +5 -15
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +58 -65
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +3 -2
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-facets.test.js +8 -5
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +12 -12
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +2 -2
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/package.json +3 -3
- package/src/collection-browser.ts +322 -293
- package/src/collection-facets/facets-template.ts +2 -0
- package/src/collection-facets/more-facets-content.ts +63 -70
- package/src/collection-facets/more-facets-pagination.ts +49 -55
- package/src/collection-facets/toggle-switch.ts +51 -61
- package/src/collection-facets.ts +96 -85
- package/src/sort-filter-bar/alpha-bar.ts +26 -18
- package/src/sort-filter-bar/sort-filter-bar.ts +200 -186
- package/src/styles/sr-only.ts +18 -0
- package/src/tiles/grid/account-tile.ts +1 -1
- package/src/tiles/grid/collection-tile.ts +2 -2
- package/src/tiles/grid/item-tile.ts +2 -2
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +5 -15
- package/src/tiles/grid/tile-stats.ts +66 -73
- package/src/tiles/tile-dispatcher.ts +1 -0
- package/test/collection-facets.test.ts +10 -2
- package/test/sort-filter-bar/alpha-bar.test.ts +16 -12
- package/test/sort-filter-bar/sort-filter-bar.test.ts +2 -2
|
@@ -5,6 +5,7 @@ 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';
|
|
8
9
|
|
|
9
10
|
import { formatCount } from '../../utils/format-count';
|
|
10
11
|
|
|
@@ -78,78 +79,70 @@ export class TileStats extends LitElement {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
static get styles(): CSSResultGroup {
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
height: 15px;
|
|
147
|
-
color: #2c2c2c;
|
|
148
|
-
line-height: 17px;
|
|
149
|
-
margin: auto;
|
|
150
|
-
display: block;
|
|
151
|
-
text-align: center;
|
|
152
|
-
}
|
|
153
|
-
`;
|
|
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
|
+
];
|
|
154
147
|
}
|
|
155
148
|
}
|
|
@@ -123,6 +123,7 @@ export class TileDispatcher
|
|
|
123
123
|
return html`
|
|
124
124
|
<a
|
|
125
125
|
href="${this.linkTileHref}"
|
|
126
|
+
aria-label=${this.model?.title ?? 'Untitled item'}
|
|
126
127
|
title=${this.shouldPrepareHoverPane
|
|
127
128
|
? nothing // Don't show title tooltips when we have the tile info popups
|
|
128
129
|
: ifDefined(this.model?.title)}
|
|
@@ -119,8 +119,16 @@ describe('Collection Facets', () => {
|
|
|
119
119
|
expect(facetGroups?.length).to.equal(1);
|
|
120
120
|
|
|
121
121
|
const titleFacetGroup = facetGroups?.[0];
|
|
122
|
-
const facetGroupHeader = titleFacetGroup?.querySelector('
|
|
123
|
-
|
|
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
|
+
|
|
124
132
|
const titleFacetRow = titleFacetGroup
|
|
125
133
|
?.querySelector('facets-template')
|
|
126
134
|
?.shadowRoot?.querySelector('.facet-row');
|
|
@@ -14,30 +14,34 @@ describe('Alphabetical Filter Bar', () => {
|
|
|
14
14
|
expect(letters?.length).to.equal(26);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
it('renders letters with items as
|
|
17
|
+
it('renders letters with items as buttons', 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
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
expect(
|
|
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');
|
|
28
30
|
});
|
|
29
31
|
|
|
30
|
-
it('renders letters without items as
|
|
32
|
+
it('renders letters without items as disabled buttons', async () => {
|
|
31
33
|
const el = await fixture<AlphaBar>(html`<alpha-bar></alpha-bar>`);
|
|
32
34
|
|
|
33
35
|
el.letterCounts = { U: 10, X: 10 };
|
|
34
36
|
await el.updateComplete;
|
|
35
37
|
|
|
36
|
-
// All but the two letters above should
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
expect(
|
|
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');
|
|
41
45
|
});
|
|
42
46
|
|
|
43
47
|
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 >
|
|
459
|
+
'li > button:not(:disabled)'
|
|
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 >
|
|
480
|
+
'li > button:not(:disabled)'
|
|
481
481
|
) as HTMLAnchorElement;
|
|
482
482
|
expect(letterLink?.textContent?.trim()).to.equal('C');
|
|
483
483
|
|