@internetarchive/collection-browser 0.4.18-alpha.6 → 0.4.18
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 +1 -8
- package/dist/src/collection-browser.js +291 -318
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facets-template.js +0 -2
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.js +70 -63
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +55 -49
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.js +56 -46
- 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 +84 -94
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +1 -2
- package/dist/src/sort-filter-bar/alpha-bar.js +25 -33
- 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 +186 -198
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- 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 +15 -5
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +65 -58
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +2 -3
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-facets.test.js +5 -8
- 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 +5 -5
- package/src/collection-browser.ts +293 -321
- package/src/collection-facets/facets-template.ts +0 -2
- package/src/collection-facets/more-facets-content.ts +70 -63
- package/src/collection-facets/more-facets-pagination.ts +55 -49
- package/src/collection-facets/toggle-switch.ts +61 -51
- package/src/collection-facets.ts +85 -96
- package/src/sort-filter-bar/alpha-bar.ts +18 -26
- package/src/sort-filter-bar/sort-filter-bar.ts +186 -200
- 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 +15 -5
- package/src/tiles/grid/tile-stats.ts +73 -66
- package/src/tiles/tile-dispatcher.ts +0 -1
- package/test/collection-facets.test.ts +2 -10
- package/test/sort-filter-bar/alpha-bar.test.ts +12 -16
- package/test/sort-filter-bar/sort-filter-bar.test.ts +2 -2
- package/dist/src/styles/sr-only.d.ts +0 -1
- package/dist/src/styles/sr-only.js +0 -18
- package/dist/src/styles/sr-only.js.map +0 -1
- 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
|
-
|
|
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
|
-
|
|
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)}
|
|
@@ -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('
|
|
123
|
-
|
|
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
|
|
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
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
);
|
|
27
|
-
expect(
|
|
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
|
|
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
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
);
|
|
42
|
-
expect(
|
|
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 >
|
|
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 >
|
|
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"]}
|
package/src/styles/sr-only.ts
DELETED
|
@@ -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
|
-
`;
|