@internetarchive/collection-browser 3.3.3 → 3.3.4-alpha-webdev7761.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.
- package/dist/src/collection-browser.d.ts +10 -2
- package/dist/src/collection-browser.js +112 -10
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +141 -140
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/models.js.map +1 -1
- package/dist/src/collection-facets.js +12 -0
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +10 -1
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +19 -1
- package/dist/src/data-source/collection-browser-data-source.js +36 -18
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +1 -2
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/data-source/models.d.ts +11 -0
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/manage/manage-bar.js +77 -77
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/models.d.ts +2 -6
- package/dist/src/models.js +8 -12
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +1 -2
- package/dist/src/restoration-state-handler.js +3 -9
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +42 -42
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/test/collection-browser.test.js +19 -9
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +23 -23
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +20 -20
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +5 -37
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +132 -7
- package/src/collection-facets/facet-row.ts +299 -296
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets.ts +11 -0
- package/src/data-source/collection-browser-data-source-interface.ts +345 -333
- package/src/data-source/collection-browser-data-source.ts +59 -19
- package/src/data-source/collection-browser-query-state.ts +1 -7
- package/src/data-source/models.ts +13 -0
- package/src/manage/manage-bar.ts +247 -247
- package/src/models.ts +866 -870
- package/src/restoration-state-handler.ts +542 -544
- package/src/tiles/grid/search-tile.ts +90 -90
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
- package/test/collection-browser.test.ts +21 -11
- package/test/collection-facets/facet-row.test.ts +375 -375
- package/test/collection-facets.test.ts +928 -928
- package/test/restoration-state-handler.test.ts +480 -510
|
@@ -33,9 +33,10 @@ let FacetRow = FacetRow_1 = class FacetRow extends LitElement {
|
|
|
33
33
|
// For other facet types, we just have a static value to use.
|
|
34
34
|
const bucketTextDisplay = facetType !== 'collection'
|
|
35
35
|
? html `${(_a = bucket.displayText) !== null && _a !== void 0 ? _a : bucket.key} ${extraNoteSpan}`
|
|
36
|
-
: html `<a href="/details/${bucket.key}">
|
|
37
|
-
${(_c = (_b = this.collectionTitles) === null || _b === void 0 ? void 0 : _b.get(bucket.key)) !== null && _c !== void 0 ? _c : bucket.key}
|
|
36
|
+
: html `<a href="/details/${bucket.key}">
|
|
37
|
+
${(_c = (_b = this.collectionTitles) === null || _b === void 0 ? void 0 : _b.get(bucket.key)) !== null && _c !== void 0 ? _c : bucket.key}
|
|
38
38
|
</a> `;
|
|
39
|
+
const bucketCountText = bucket.count > 0 ? bucket.count.toLocaleString() : '';
|
|
39
40
|
const facetHidden = bucket.state === 'hidden';
|
|
40
41
|
const facetSelected = bucket.state === 'selected';
|
|
41
42
|
const titleText = `${facetType}: ${(_d = bucket.displayText) !== null && _d !== void 0 ? _d : bucket.key}`;
|
|
@@ -47,56 +48,56 @@ let FacetRow = FacetRow_1 = class FacetRow extends LitElement {
|
|
|
47
48
|
const showHideText = facetHidden ? unhideText : hideText;
|
|
48
49
|
const ariaLabel = `${titleText}, ${bucket.count} results`;
|
|
49
50
|
// Added data-testid for Playwright testing
|
|
50
|
-
return html `
|
|
51
|
-
<div class="facet-row-container">
|
|
52
|
-
<div class="facet-checkboxes">
|
|
53
|
-
<input
|
|
54
|
-
type="checkbox"
|
|
55
|
-
.name=${facetType}
|
|
56
|
-
.value=${bucket.key}
|
|
51
|
+
return html `
|
|
52
|
+
<div class="facet-row-container">
|
|
53
|
+
<div class="facet-checkboxes">
|
|
54
|
+
<input
|
|
55
|
+
type="checkbox"
|
|
56
|
+
.name=${facetType}
|
|
57
|
+
.value=${bucket.key}
|
|
57
58
|
@click=${(e) => {
|
|
58
59
|
this.facetClicked(e, false);
|
|
59
|
-
}}
|
|
60
|
-
.checked=${facetSelected}
|
|
61
|
-
class="select-facet-checkbox"
|
|
62
|
-
title=${onlyShowText}
|
|
63
|
-
id=${showOnlyCheckboxId}
|
|
64
|
-
data-testid=${showOnlyCheckboxId}
|
|
65
|
-
/>
|
|
66
|
-
<div class="hide-facet-container">
|
|
67
|
-
<input
|
|
68
|
-
type="checkbox"
|
|
69
|
-
id=${negativeCheckboxId}
|
|
70
|
-
.name=${facetType}
|
|
71
|
-
.value=${bucket.key}
|
|
60
|
+
}}
|
|
61
|
+
.checked=${facetSelected}
|
|
62
|
+
class="select-facet-checkbox"
|
|
63
|
+
title=${onlyShowText}
|
|
64
|
+
id=${showOnlyCheckboxId}
|
|
65
|
+
data-testid=${showOnlyCheckboxId}
|
|
66
|
+
/>
|
|
67
|
+
<div class="hide-facet-container">
|
|
68
|
+
<input
|
|
69
|
+
type="checkbox"
|
|
70
|
+
id=${negativeCheckboxId}
|
|
71
|
+
.name=${facetType}
|
|
72
|
+
.value=${bucket.key}
|
|
72
73
|
@click=${(e) => {
|
|
73
74
|
this.facetClicked(e, true);
|
|
74
|
-
}}
|
|
75
|
-
.checked=${facetHidden}
|
|
76
|
-
class="hide-facet-checkbox"
|
|
77
|
-
/>
|
|
78
|
-
<label
|
|
79
|
-
for=${negativeCheckboxId}
|
|
80
|
-
class="hide-facet-icon${facetHidden ? ' active' : ''}"
|
|
81
|
-
title=${showHideText}
|
|
82
|
-
data-testid=${negativeCheckboxId}
|
|
83
|
-
>
|
|
84
|
-
<span class="sr-only">${showHideText}</span>
|
|
85
|
-
<span class="eye eye-open">${eyeIcon}</span>
|
|
86
|
-
<span class="eye eye-closed">${eyeClosedIcon}</span>
|
|
87
|
-
</label>
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
<label
|
|
91
|
-
for=${showOnlyCheckboxId}
|
|
92
|
-
class="facet-info-display"
|
|
93
|
-
title=${onlyShowText}
|
|
94
|
-
aria-label=${ariaLabel}
|
|
95
|
-
>
|
|
96
|
-
<div class="facet-title">${bucketTextDisplay}</div>
|
|
97
|
-
<div class="facet-count">${
|
|
98
|
-
</label>
|
|
99
|
-
</div>
|
|
75
|
+
}}
|
|
76
|
+
.checked=${facetHidden}
|
|
77
|
+
class="hide-facet-checkbox"
|
|
78
|
+
/>
|
|
79
|
+
<label
|
|
80
|
+
for=${negativeCheckboxId}
|
|
81
|
+
class="hide-facet-icon${facetHidden ? ' active' : ''}"
|
|
82
|
+
title=${showHideText}
|
|
83
|
+
data-testid=${negativeCheckboxId}
|
|
84
|
+
>
|
|
85
|
+
<span class="sr-only">${showHideText}</span>
|
|
86
|
+
<span class="eye eye-open">${eyeIcon}</span>
|
|
87
|
+
<span class="eye eye-closed">${eyeClosedIcon}</span>
|
|
88
|
+
</label>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<label
|
|
92
|
+
for=${showOnlyCheckboxId}
|
|
93
|
+
class="facet-info-display"
|
|
94
|
+
title=${onlyShowText}
|
|
95
|
+
aria-label=${ariaLabel}
|
|
96
|
+
>
|
|
97
|
+
<div class="facet-title">${bucketTextDisplay}</div>
|
|
98
|
+
<div class="facet-count">${bucketCountText}</div>
|
|
99
|
+
</label>
|
|
100
|
+
</div>
|
|
100
101
|
`;
|
|
101
102
|
}
|
|
102
103
|
//
|
|
@@ -153,98 +154,98 @@ let FacetRow = FacetRow_1 = class FacetRow extends LitElement {
|
|
|
153
154
|
const facetRowBorderTop = css `var(--facet-row-border-top, 1px solid transparent)`;
|
|
154
155
|
const facetRowBorderBottom = css `var(--facet-row-border-bottom, 1px solid transparent)`;
|
|
155
156
|
const checkboxHeight = css `15px`;
|
|
156
|
-
const ownCss = css `
|
|
157
|
-
.facet-checkboxes {
|
|
158
|
-
margin: 0 5px 0 0;
|
|
159
|
-
display: flex;
|
|
160
|
-
height: ${checkboxHeight};
|
|
161
|
-
}
|
|
162
|
-
.facet-checkboxes input:first-child {
|
|
163
|
-
margin-right: 5px;
|
|
164
|
-
}
|
|
165
|
-
.facet-checkboxes input {
|
|
166
|
-
height: ${checkboxHeight};
|
|
167
|
-
width: ${checkboxHeight};
|
|
168
|
-
margin: 0;
|
|
169
|
-
}
|
|
170
|
-
.facet-row-container {
|
|
171
|
-
display: flex;
|
|
172
|
-
font-weight: 500;
|
|
173
|
-
font-size: 1.2rem;
|
|
174
|
-
margin: 0 auto;
|
|
175
|
-
padding: 0.25rem 0;
|
|
176
|
-
height: auto;
|
|
177
|
-
border-top: ${facetRowBorderTop};
|
|
178
|
-
border-bottom: ${facetRowBorderBottom};
|
|
179
|
-
}
|
|
180
|
-
.facet-info-display {
|
|
181
|
-
display: flex;
|
|
182
|
-
flex: 1 1 0%;
|
|
183
|
-
cursor: pointer;
|
|
184
|
-
flex-wrap: wrap;
|
|
185
|
-
}
|
|
186
|
-
.facet-title {
|
|
187
|
-
word-break: break-word;
|
|
188
|
-
display: inline-block;
|
|
189
|
-
flex: 1 1 0%;
|
|
190
|
-
}
|
|
191
|
-
.facet-note {
|
|
192
|
-
color: #bbb;
|
|
193
|
-
}
|
|
194
|
-
.facet-count {
|
|
195
|
-
text-align: right;
|
|
196
|
-
}
|
|
197
|
-
.select-facet-checkbox {
|
|
198
|
-
cursor: pointer;
|
|
199
|
-
display: inline-block;
|
|
200
|
-
}
|
|
201
|
-
.hide-facet-checkbox {
|
|
202
|
-
position: absolute;
|
|
203
|
-
clip: rect(0, 0, 0, 0);
|
|
204
|
-
pointer-events: none;
|
|
205
|
-
}
|
|
206
|
-
.hide-facet-checkbox:focus-visible + .hide-facet-icon {
|
|
207
|
-
outline-style: auto;
|
|
208
|
-
outline-offset: 2px;
|
|
209
|
-
}
|
|
210
|
-
.hide-facet-icon {
|
|
211
|
-
width: ${checkboxHeight};
|
|
212
|
-
height: ${checkboxHeight};
|
|
213
|
-
cursor: pointer;
|
|
214
|
-
display: flex;
|
|
215
|
-
}
|
|
216
|
-
.eye {
|
|
217
|
-
width: ${checkboxHeight};
|
|
218
|
-
height: ${checkboxHeight};
|
|
219
|
-
opacity: 0.3;
|
|
220
|
-
}
|
|
221
|
-
.hide-facet-icon:hover .eye,
|
|
222
|
-
.active .eye {
|
|
223
|
-
opacity: 1;
|
|
224
|
-
}
|
|
225
|
-
.hide-facet-icon:hover .eye-open,
|
|
226
|
-
.hide-facet-icon .eye-closed {
|
|
227
|
-
display: none;
|
|
228
|
-
}
|
|
229
|
-
.hide-facet-icon:hover .eye-closed,
|
|
230
|
-
.hide-facet-icon.active .eye-closed {
|
|
231
|
-
display: inline;
|
|
232
|
-
}
|
|
233
|
-
.hide-facet-icon.active .eye-open {
|
|
234
|
-
display: none;
|
|
235
|
-
}
|
|
236
|
-
.sorting-icon {
|
|
237
|
-
cursor: pointer;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
a:link,
|
|
241
|
-
a:visited {
|
|
242
|
-
text-decoration: none;
|
|
243
|
-
color: var(--ia-theme-link-color, #4b64ff);
|
|
244
|
-
}
|
|
245
|
-
a:hover {
|
|
246
|
-
text-decoration: underline;
|
|
247
|
-
}
|
|
157
|
+
const ownCss = css `
|
|
158
|
+
.facet-checkboxes {
|
|
159
|
+
margin: 0 5px 0 0;
|
|
160
|
+
display: flex;
|
|
161
|
+
height: ${checkboxHeight};
|
|
162
|
+
}
|
|
163
|
+
.facet-checkboxes input:first-child {
|
|
164
|
+
margin-right: 5px;
|
|
165
|
+
}
|
|
166
|
+
.facet-checkboxes input {
|
|
167
|
+
height: ${checkboxHeight};
|
|
168
|
+
width: ${checkboxHeight};
|
|
169
|
+
margin: 0;
|
|
170
|
+
}
|
|
171
|
+
.facet-row-container {
|
|
172
|
+
display: flex;
|
|
173
|
+
font-weight: 500;
|
|
174
|
+
font-size: 1.2rem;
|
|
175
|
+
margin: 0 auto;
|
|
176
|
+
padding: 0.25rem 0;
|
|
177
|
+
height: auto;
|
|
178
|
+
border-top: ${facetRowBorderTop};
|
|
179
|
+
border-bottom: ${facetRowBorderBottom};
|
|
180
|
+
}
|
|
181
|
+
.facet-info-display {
|
|
182
|
+
display: flex;
|
|
183
|
+
flex: 1 1 0%;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
flex-wrap: wrap;
|
|
186
|
+
}
|
|
187
|
+
.facet-title {
|
|
188
|
+
word-break: break-word;
|
|
189
|
+
display: inline-block;
|
|
190
|
+
flex: 1 1 0%;
|
|
191
|
+
}
|
|
192
|
+
.facet-note {
|
|
193
|
+
color: #bbb;
|
|
194
|
+
}
|
|
195
|
+
.facet-count {
|
|
196
|
+
text-align: right;
|
|
197
|
+
}
|
|
198
|
+
.select-facet-checkbox {
|
|
199
|
+
cursor: pointer;
|
|
200
|
+
display: inline-block;
|
|
201
|
+
}
|
|
202
|
+
.hide-facet-checkbox {
|
|
203
|
+
position: absolute;
|
|
204
|
+
clip: rect(0, 0, 0, 0);
|
|
205
|
+
pointer-events: none;
|
|
206
|
+
}
|
|
207
|
+
.hide-facet-checkbox:focus-visible + .hide-facet-icon {
|
|
208
|
+
outline-style: auto;
|
|
209
|
+
outline-offset: 2px;
|
|
210
|
+
}
|
|
211
|
+
.hide-facet-icon {
|
|
212
|
+
width: ${checkboxHeight};
|
|
213
|
+
height: ${checkboxHeight};
|
|
214
|
+
cursor: pointer;
|
|
215
|
+
display: flex;
|
|
216
|
+
}
|
|
217
|
+
.eye {
|
|
218
|
+
width: ${checkboxHeight};
|
|
219
|
+
height: ${checkboxHeight};
|
|
220
|
+
opacity: 0.3;
|
|
221
|
+
}
|
|
222
|
+
.hide-facet-icon:hover .eye,
|
|
223
|
+
.active .eye {
|
|
224
|
+
opacity: 1;
|
|
225
|
+
}
|
|
226
|
+
.hide-facet-icon:hover .eye-open,
|
|
227
|
+
.hide-facet-icon .eye-closed {
|
|
228
|
+
display: none;
|
|
229
|
+
}
|
|
230
|
+
.hide-facet-icon:hover .eye-closed,
|
|
231
|
+
.hide-facet-icon.active .eye-closed {
|
|
232
|
+
display: inline;
|
|
233
|
+
}
|
|
234
|
+
.hide-facet-icon.active .eye-open {
|
|
235
|
+
display: none;
|
|
236
|
+
}
|
|
237
|
+
.sorting-icon {
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
a:link,
|
|
242
|
+
a:visited {
|
|
243
|
+
text-decoration: none;
|
|
244
|
+
color: var(--ia-theme-link-color, #4b64ff);
|
|
245
|
+
}
|
|
246
|
+
a:hover {
|
|
247
|
+
text-decoration: underline;
|
|
248
|
+
}
|
|
248
249
|
`;
|
|
249
250
|
return [srOnlyStyle, ownCss];
|
|
250
251
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet-row.js","sourceRoot":"","sources":["../../../src/collection-facets/facet-row.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EAGV,OAAO,GACR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,aAAa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AG,GAAG,CAAA;;;;kBAIJ,cAAc;;;;;;kBAMd,cAAc;iBACf,cAAc;;;;;;;;;;sBAUT,iBAAiB;yBACd,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC5B,cAAc;kBACb,cAAc;;;;;iBAKf,cAAc;kBACb,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8B3B,CAAC;QAEF,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF,CAAA;AA5Q6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAyB;AAGxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAsB;AAIjD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACS;AAbzB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkRpB","sourcesContent":["import {\n css,\n html,\n LitElement,\n TemplateResult,\n CSSResultGroup,\n nothing,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport eyeIcon from '../assets/img/icons/eye';\nimport eyeClosedIcon from '../assets/img/icons/eye-closed';\nimport type {\n FacetOption,\n FacetBucket,\n FacetEventDetails,\n FacetState,\n} from '../models';\nimport type { CollectionTitles } from '../data-source/models';\nimport { srOnlyStyle } from '../styles/sr-only';\n\n@customElement('facet-row')\nexport class FacetRow extends LitElement {\n //\n // UI STATE\n //\n\n /** The name of the facet group to which this facet belongs (e.g., \"mediatype\") */\n @property({ type: String }) facetType?: FacetOption;\n\n /** The facet bucket containing details about the state, count, and key for this row */\n @property({ type: Object }) bucket?: FacetBucket;\n\n /** The collection name cache for converting collection identifiers to titles */\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n //\n // COMPONENT LIFECYCLE METHODS\n //\n\n render() {\n return html`${this.facetRowTemplate}`;\n }\n\n //\n // TEMPLATE GETTERS\n //\n\n /**\n * Template for the full facet row, including the positive/negative checks,\n * the display name, and the count.\n */\n private get facetRowTemplate(): TemplateResult | typeof nothing {\n const { bucket, facetType } = this;\n if (!bucket || !facetType) return nothing;\n\n const showOnlyCheckboxId = `${facetType}:${bucket.key}-show-only`;\n const negativeCheckboxId = `${facetType}:${bucket.key}-negative`;\n\n const extraNoteSpan = bucket.extraNote\n ? html`<span class=\"facet-note\">${bucket.extraNote}</span>`\n : nothing;\n\n // For collections, we render the collection title as a link.\n // For other facet types, we just have a static value to use.\n const bucketTextDisplay =\n facetType !== 'collection'\n ? html`${bucket.displayText ?? bucket.key} ${extraNoteSpan}`\n : html`<a href=\"/details/${bucket.key}\">\n ${this.collectionTitles?.get(bucket.key) ?? bucket.key}\n </a> `;\n\n const facetHidden = bucket.state === 'hidden';\n const facetSelected = bucket.state === 'selected';\n\n const titleText = `${facetType}: ${bucket.displayText ?? bucket.key}`;\n const onlyShowText = facetSelected\n ? `Show all ${facetType}s`\n : `Only show ${titleText}`;\n const hideText = `Hide ${titleText}`;\n const unhideText = `Unhide ${titleText}`;\n const showHideText = facetHidden ? unhideText : hideText;\n const ariaLabel = `${titleText}, ${bucket.count} results`;\n\n // Added data-testid for Playwright testing\n return html`\n <div class=\"facet-row-container\">\n <div class=\"facet-checkboxes\">\n <input\n type=\"checkbox\"\n .name=${facetType}\n .value=${bucket.key}\n @click=${(e: Event) => {\n this.facetClicked(e, false);\n }}\n .checked=${facetSelected}\n class=\"select-facet-checkbox\"\n title=${onlyShowText}\n id=${showOnlyCheckboxId}\n data-testid=${showOnlyCheckboxId}\n />\n <div class=\"hide-facet-container\">\n <input\n type=\"checkbox\"\n id=${negativeCheckboxId}\n .name=${facetType}\n .value=${bucket.key}\n @click=${(e: Event) => {\n this.facetClicked(e, true);\n }}\n .checked=${facetHidden}\n class=\"hide-facet-checkbox\"\n />\n <label\n for=${negativeCheckboxId}\n class=\"hide-facet-icon${facetHidden ? ' active' : ''}\"\n title=${showHideText}\n data-testid=${negativeCheckboxId}\n >\n <span class=\"sr-only\">${showHideText}</span>\n <span class=\"eye eye-open\">${eyeIcon}</span>\n <span class=\"eye eye-closed\">${eyeClosedIcon}</span>\n </label>\n </div>\n </div>\n <label\n for=${showOnlyCheckboxId}\n class=\"facet-info-display\"\n title=${onlyShowText}\n aria-label=${ariaLabel}\n >\n <div class=\"facet-title\">${bucketTextDisplay}</div>\n <div class=\"facet-count\">${bucket.count.toLocaleString()}</div>\n </label>\n </div>\n `;\n }\n\n //\n // EVENT HANDLERS & DISPATCHERS\n //\n\n /**\n * Handler for whenever this facet is clicked & its state changes\n */\n private facetClicked(e: Event, negative: boolean) {\n const { bucket, facetType } = this;\n if (!bucket || !facetType) return;\n\n const target = e.target as HTMLInputElement;\n const { checked } = target;\n this.bucket = {\n ...bucket,\n state: FacetRow.getFacetState(checked, negative),\n };\n\n this.dispatchFacetClickEvent({\n facetType,\n bucket: this.bucket,\n negative,\n });\n }\n\n /**\n * Emits a `facetClick` event with details about this facet & its current state\n */\n private dispatchFacetClickEvent(detail: FacetEventDetails) {\n const event = new CustomEvent<FacetEventDetails>('facetClick', {\n detail,\n });\n this.dispatchEvent(event);\n }\n\n //\n // OTHER METHODS\n //\n\n /**\n * Returns the composed facet state corresponding to a positive or negative facet's checked state\n */\n static getFacetState(checked: boolean, negative: boolean): FacetState {\n let state: FacetState;\n if (checked) {\n state = negative ? 'hidden' : 'selected';\n } else {\n state = 'none';\n }\n return state;\n }\n\n //\n // STYLES\n //\n\n static get styles(): CSSResultGroup {\n const facetRowBorderTop = css`var(--facet-row-border-top, 1px solid transparent)`;\n const facetRowBorderBottom = css`var(--facet-row-border-bottom, 1px solid transparent)`;\n const checkboxHeight = css`15px`;\n\n const ownCss = css`\n .facet-checkboxes {\n margin: 0 5px 0 0;\n display: flex;\n height: ${checkboxHeight};\n }\n .facet-checkboxes input:first-child {\n margin-right: 5px;\n }\n .facet-checkboxes input {\n height: ${checkboxHeight};\n width: ${checkboxHeight};\n margin: 0;\n }\n .facet-row-container {\n display: flex;\n font-weight: 500;\n font-size: 1.2rem;\n margin: 0 auto;\n padding: 0.25rem 0;\n height: auto;\n border-top: ${facetRowBorderTop};\n border-bottom: ${facetRowBorderBottom};\n }\n .facet-info-display {\n display: flex;\n flex: 1 1 0%;\n cursor: pointer;\n flex-wrap: wrap;\n }\n .facet-title {\n word-break: break-word;\n display: inline-block;\n flex: 1 1 0%;\n }\n .facet-note {\n color: #bbb;\n }\n .facet-count {\n text-align: right;\n }\n .select-facet-checkbox {\n cursor: pointer;\n display: inline-block;\n }\n .hide-facet-checkbox {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n pointer-events: none;\n }\n .hide-facet-checkbox:focus-visible + .hide-facet-icon {\n outline-style: auto;\n outline-offset: 2px;\n }\n .hide-facet-icon {\n width: ${checkboxHeight};\n height: ${checkboxHeight};\n cursor: pointer;\n display: flex;\n }\n .eye {\n width: ${checkboxHeight};\n height: ${checkboxHeight};\n opacity: 0.3;\n }\n .hide-facet-icon:hover .eye,\n .active .eye {\n opacity: 1;\n }\n .hide-facet-icon:hover .eye-open,\n .hide-facet-icon .eye-closed {\n display: none;\n }\n .hide-facet-icon:hover .eye-closed,\n .hide-facet-icon.active .eye-closed {\n display: inline;\n }\n .hide-facet-icon.active .eye-open {\n display: none;\n }\n .sorting-icon {\n cursor: pointer;\n }\n\n a:link,\n a:visited {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n a:hover {\n text-decoration: underline;\n }\n `;\n\n return [srOnlyStyle, ownCss];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"facet-row.js","sourceRoot":"","sources":["../../../src/collection-facets/facet-row.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EAGV,OAAO,GACR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,OAAO,MAAM,yBAAyB,CAAC;AA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;QAClF,MAAM,oBAAoB,GAAG,GAAG,CAAA,uDAAuD,CAAC;QACxF,MAAM,cAAc,GAAG,GAAG,CAAA,MAAM,CAAC;QAEjC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;kBAIJ,cAAc;;;;;;kBAMd,cAAc;iBACf,cAAc;;;;;;;;;;sBAUT,iBAAiB;yBACd,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC5B,cAAc;kBACb,cAAc;;;;;iBAKf,cAAc;kBACb,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8B3B,CAAC;QAEF,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF,CAAA;AA/Q6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAyB;AAGxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAsB;AAIjD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACS;AAbzB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAqRpB","sourcesContent":["import {\r\n css,\r\n html,\r\n LitElement,\r\n TemplateResult,\r\n CSSResultGroup,\r\n nothing,\r\n} from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\nimport eyeIcon from '../assets/img/icons/eye';\r\nimport eyeClosedIcon from '../assets/img/icons/eye-closed';\r\nimport type {\r\n FacetOption,\r\n FacetBucket,\r\n FacetEventDetails,\r\n FacetState,\r\n} from '../models';\r\nimport type { CollectionTitles } from '../data-source/models';\r\nimport { srOnlyStyle } from '../styles/sr-only';\r\n\r\n@customElement('facet-row')\r\nexport class FacetRow extends LitElement {\r\n //\r\n // UI STATE\r\n //\r\n\r\n /** The name of the facet group to which this facet belongs (e.g., \"mediatype\") */\r\n @property({ type: String }) facetType?: FacetOption;\r\n\r\n /** The facet bucket containing details about the state, count, and key for this row */\r\n @property({ type: Object }) bucket?: FacetBucket;\r\n\r\n /** The collection name cache for converting collection identifiers to titles */\r\n @property({ type: Object })\r\n collectionTitles?: CollectionTitles;\r\n\r\n //\r\n // COMPONENT LIFECYCLE METHODS\r\n //\r\n\r\n render() {\r\n return html`${this.facetRowTemplate}`;\r\n }\r\n\r\n //\r\n // TEMPLATE GETTERS\r\n //\r\n\r\n /**\r\n * Template for the full facet row, including the positive/negative checks,\r\n * the display name, and the count.\r\n */\r\n private get facetRowTemplate(): TemplateResult | typeof nothing {\r\n const { bucket, facetType } = this;\r\n if (!bucket || !facetType) return nothing;\r\n\r\n const showOnlyCheckboxId = `${facetType}:${bucket.key}-show-only`;\r\n const negativeCheckboxId = `${facetType}:${bucket.key}-negative`;\r\n\r\n const extraNoteSpan = bucket.extraNote\r\n ? html`<span class=\"facet-note\">${bucket.extraNote}</span>`\r\n : nothing;\r\n\r\n // For collections, we render the collection title as a link.\r\n // For other facet types, we just have a static value to use.\r\n const bucketTextDisplay =\r\n facetType !== 'collection'\r\n ? html`${bucket.displayText ?? bucket.key} ${extraNoteSpan}`\r\n : html`<a href=\"/details/${bucket.key}\">\r\n ${this.collectionTitles?.get(bucket.key) ?? bucket.key}\r\n </a> `;\r\n\r\n const bucketCountText =\r\n bucket.count > 0 ? bucket.count.toLocaleString() : '';\r\n\r\n const facetHidden = bucket.state === 'hidden';\r\n const facetSelected = bucket.state === 'selected';\r\n\r\n const titleText = `${facetType}: ${bucket.displayText ?? bucket.key}`;\r\n const onlyShowText = facetSelected\r\n ? `Show all ${facetType}s`\r\n : `Only show ${titleText}`;\r\n const hideText = `Hide ${titleText}`;\r\n const unhideText = `Unhide ${titleText}`;\r\n const showHideText = facetHidden ? unhideText : hideText;\r\n const ariaLabel = `${titleText}, ${bucket.count} results`;\r\n\r\n // Added data-testid for Playwright testing\r\n return html`\r\n <div class=\"facet-row-container\">\r\n <div class=\"facet-checkboxes\">\r\n <input\r\n type=\"checkbox\"\r\n .name=${facetType}\r\n .value=${bucket.key}\r\n @click=${(e: Event) => {\r\n this.facetClicked(e, false);\r\n }}\r\n .checked=${facetSelected}\r\n class=\"select-facet-checkbox\"\r\n title=${onlyShowText}\r\n id=${showOnlyCheckboxId}\r\n data-testid=${showOnlyCheckboxId}\r\n />\r\n <div class=\"hide-facet-container\">\r\n <input\r\n type=\"checkbox\"\r\n id=${negativeCheckboxId}\r\n .name=${facetType}\r\n .value=${bucket.key}\r\n @click=${(e: Event) => {\r\n this.facetClicked(e, true);\r\n }}\r\n .checked=${facetHidden}\r\n class=\"hide-facet-checkbox\"\r\n />\r\n <label\r\n for=${negativeCheckboxId}\r\n class=\"hide-facet-icon${facetHidden ? ' active' : ''}\"\r\n title=${showHideText}\r\n data-testid=${negativeCheckboxId}\r\n >\r\n <span class=\"sr-only\">${showHideText}</span>\r\n <span class=\"eye eye-open\">${eyeIcon}</span>\r\n <span class=\"eye eye-closed\">${eyeClosedIcon}</span>\r\n </label>\r\n </div>\r\n </div>\r\n <label\r\n for=${showOnlyCheckboxId}\r\n class=\"facet-info-display\"\r\n title=${onlyShowText}\r\n aria-label=${ariaLabel}\r\n >\r\n <div class=\"facet-title\">${bucketTextDisplay}</div>\r\n <div class=\"facet-count\">${bucketCountText}</div>\r\n </label>\r\n </div>\r\n `;\r\n }\r\n\r\n //\r\n // EVENT HANDLERS & DISPATCHERS\r\n //\r\n\r\n /**\r\n * Handler for whenever this facet is clicked & its state changes\r\n */\r\n private facetClicked(e: Event, negative: boolean) {\r\n const { bucket, facetType } = this;\r\n if (!bucket || !facetType) return;\r\n\r\n const target = e.target as HTMLInputElement;\r\n const { checked } = target;\r\n this.bucket = {\r\n ...bucket,\r\n state: FacetRow.getFacetState(checked, negative),\r\n };\r\n\r\n this.dispatchFacetClickEvent({\r\n facetType,\r\n bucket: this.bucket,\r\n negative,\r\n });\r\n }\r\n\r\n /**\r\n * Emits a `facetClick` event with details about this facet & its current state\r\n */\r\n private dispatchFacetClickEvent(detail: FacetEventDetails) {\r\n const event = new CustomEvent<FacetEventDetails>('facetClick', {\r\n detail,\r\n });\r\n this.dispatchEvent(event);\r\n }\r\n\r\n //\r\n // OTHER METHODS\r\n //\r\n\r\n /**\r\n * Returns the composed facet state corresponding to a positive or negative facet's checked state\r\n */\r\n static getFacetState(checked: boolean, negative: boolean): FacetState {\r\n let state: FacetState;\r\n if (checked) {\r\n state = negative ? 'hidden' : 'selected';\r\n } else {\r\n state = 'none';\r\n }\r\n return state;\r\n }\r\n\r\n //\r\n // STYLES\r\n //\r\n\r\n static get styles(): CSSResultGroup {\r\n const facetRowBorderTop = css`var(--facet-row-border-top, 1px solid transparent)`;\r\n const facetRowBorderBottom = css`var(--facet-row-border-bottom, 1px solid transparent)`;\r\n const checkboxHeight = css`15px`;\r\n\r\n const ownCss = css`\r\n .facet-checkboxes {\r\n margin: 0 5px 0 0;\r\n display: flex;\r\n height: ${checkboxHeight};\r\n }\r\n .facet-checkboxes input:first-child {\r\n margin-right: 5px;\r\n }\r\n .facet-checkboxes input {\r\n height: ${checkboxHeight};\r\n width: ${checkboxHeight};\r\n margin: 0;\r\n }\r\n .facet-row-container {\r\n display: flex;\r\n font-weight: 500;\r\n font-size: 1.2rem;\r\n margin: 0 auto;\r\n padding: 0.25rem 0;\r\n height: auto;\r\n border-top: ${facetRowBorderTop};\r\n border-bottom: ${facetRowBorderBottom};\r\n }\r\n .facet-info-display {\r\n display: flex;\r\n flex: 1 1 0%;\r\n cursor: pointer;\r\n flex-wrap: wrap;\r\n }\r\n .facet-title {\r\n word-break: break-word;\r\n display: inline-block;\r\n flex: 1 1 0%;\r\n }\r\n .facet-note {\r\n color: #bbb;\r\n }\r\n .facet-count {\r\n text-align: right;\r\n }\r\n .select-facet-checkbox {\r\n cursor: pointer;\r\n display: inline-block;\r\n }\r\n .hide-facet-checkbox {\r\n position: absolute;\r\n clip: rect(0, 0, 0, 0);\r\n pointer-events: none;\r\n }\r\n .hide-facet-checkbox:focus-visible + .hide-facet-icon {\r\n outline-style: auto;\r\n outline-offset: 2px;\r\n }\r\n .hide-facet-icon {\r\n width: ${checkboxHeight};\r\n height: ${checkboxHeight};\r\n cursor: pointer;\r\n display: flex;\r\n }\r\n .eye {\r\n width: ${checkboxHeight};\r\n height: ${checkboxHeight};\r\n opacity: 0.3;\r\n }\r\n .hide-facet-icon:hover .eye,\r\n .active .eye {\r\n opacity: 1;\r\n }\r\n .hide-facet-icon:hover .eye-open,\r\n .hide-facet-icon .eye-closed {\r\n display: none;\r\n }\r\n .hide-facet-icon:hover .eye-closed,\r\n .hide-facet-icon.active .eye-closed {\r\n display: inline;\r\n }\r\n .hide-facet-icon.active .eye-open {\r\n display: none;\r\n }\r\n .sorting-icon {\r\n cursor: pointer;\r\n }\r\n\r\n a:link,\r\n a:visited {\r\n text-decoration: none;\r\n color: var(--ia-theme-link-color, #4b64ff);\r\n }\r\n a:hover {\r\n text-decoration: underline;\r\n }\r\n `;\r\n\r\n return [srOnlyStyle, ownCss];\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/collection-facets/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC","sourcesContent":["/**\n * Maximum number of aggregations to include in the More... facet dialogs.\n */\nexport const MORE_FACETS__MAX_AGGREGATIONS = 10000;\n\n/**\n * Default number of facets to show per page of the More... facet dialogs.\n * Can be overridden via component property.\n */\nexport const MORE_FACETS__DEFAULT_PAGE_SIZE = 35;\n"]}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/collection-facets/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC","sourcesContent":["/**\r\n * Maximum number of aggregations to include in the More... facet dialogs.\r\n */\r\nexport const MORE_FACETS__MAX_AGGREGATIONS = 10000;\r\n\r\n/**\r\n * Default number of facets to show per page of the More... facet dialogs.\r\n * Can be overridden via component property.\r\n */\r\nexport const MORE_FACETS__DEFAULT_PAGE_SIZE = 35;\r\n"]}
|
|
@@ -43,6 +43,7 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
43
43
|
creator: false,
|
|
44
44
|
collection: false,
|
|
45
45
|
year: false,
|
|
46
|
+
clip_type: false,
|
|
46
47
|
program: false,
|
|
47
48
|
person: false,
|
|
48
49
|
sponsor: false,
|
|
@@ -96,6 +97,7 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
96
97
|
`
|
|
97
98
|
: nothing}
|
|
98
99
|
${this.collectionPartOfTemplate}
|
|
100
|
+
<slot name="facets-top"></slot>
|
|
99
101
|
${this.mergedFacets.map(facetGroup => this.getFacetGroupTemplate(facetGroup))}
|
|
100
102
|
</div>
|
|
101
103
|
`;
|
|
@@ -388,6 +390,16 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
388
390
|
}
|
|
389
391
|
});
|
|
390
392
|
}
|
|
393
|
+
// For TV clip_type facets, capitalize the display text
|
|
394
|
+
if (facetKey === 'clip_type') {
|
|
395
|
+
bucketsWithCount.forEach(b => {
|
|
396
|
+
var _a;
|
|
397
|
+
(_a = b.displayText) !== null && _a !== void 0 ? _a : (b.displayText = b.key);
|
|
398
|
+
b.displayText =
|
|
399
|
+
b.displayText.charAt(0).toLocaleUpperCase() +
|
|
400
|
+
b.displayText.slice(1);
|
|
401
|
+
});
|
|
402
|
+
}
|
|
391
403
|
// slice off how many items we want to show in page facet area
|
|
392
404
|
facetGroup.buckets = bucketsWithCount.slice(0, allowedFacetCount);
|
|
393
405
|
facetGroups.push(facetGroup);
|