@internetarchive/collection-browser 4.5.1-alpha-webdev8221.0 → 4.5.1

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/index.js.map +1 -1
  2. package/dist/src/app-root.js +683 -683
  3. package/dist/src/app-root.js.map +1 -1
  4. package/dist/src/collection-browser.js +766 -766
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/facet-row.js +143 -143
  7. package/dist/src/collection-facets/facet-row.js.map +1 -1
  8. package/dist/src/collection-facets/facets-template.js +24 -24
  9. package/dist/src/collection-facets/facets-template.js.map +1 -1
  10. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  11. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  12. package/dist/src/restoration-state-handler.js.map +1 -1
  13. package/dist/src/styles/tile-action-styles.js +43 -43
  14. package/dist/src/styles/tile-action-styles.js.map +1 -1
  15. package/dist/src/tiles/base-tile-component.js +11 -11
  16. package/dist/src/tiles/base-tile-component.js.map +1 -1
  17. package/dist/src/tiles/grid/item-tile.js +138 -138
  18. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  19. package/dist/src/tiles/list/tile-list-compact-header.js +62 -62
  20. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  21. package/dist/src/tiles/list/tile-list-compact.js +123 -123
  22. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  23. package/dist/src/tiles/list/tile-list.js +310 -310
  24. package/dist/src/tiles/list/tile-list.js.map +1 -1
  25. package/dist/src/tiles/models.js.map +1 -1
  26. package/dist/src/tiles/tile-dispatcher.js +286 -286
  27. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  28. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  29. package/dist/src/utils/date-filter-field.js.map +1 -1
  30. package/dist/test/collection-browser.test.js +203 -203
  31. package/dist/test/collection-browser.test.js.map +1 -1
  32. package/dist/test/collection-facets/facet-row.test.js +31 -31
  33. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  34. package/dist/test/tiles/grid/item-tile.test.js +77 -77
  35. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  36. package/dist/test/tiles/list/tile-list.test.js +134 -134
  37. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  38. package/dist/test/tiles/tile-dispatcher.test.js +92 -92
  39. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  40. package/index.ts +29 -29
  41. package/package.json +1 -1
  42. package/src/app-root.ts +1284 -1284
  43. package/src/collection-browser.ts +3165 -3165
  44. package/src/collection-facets/facet-row.ts +309 -309
  45. package/src/collection-facets/facets-template.ts +85 -85
  46. package/src/data-source/collection-browser-data-source-interface.ts +351 -351
  47. package/src/data-source/collection-browser-data-source.ts +1474 -1474
  48. package/src/restoration-state-handler.ts +550 -550
  49. package/src/styles/tile-action-styles.ts +59 -59
  50. package/src/tiles/base-tile-component.ts +124 -124
  51. package/src/tiles/grid/item-tile.ts +347 -347
  52. package/src/tiles/list/tile-list-compact-header.ts +112 -112
  53. package/src/tiles/list/tile-list-compact.ts +278 -278
  54. package/src/tiles/list/tile-list.ts +718 -718
  55. package/src/tiles/models.ts +21 -21
  56. package/src/tiles/tile-dispatcher.ts +637 -637
  57. package/src/tiles/tile-display-value-provider.ts +133 -133
  58. package/src/utils/date-filter-field.ts +11 -11
  59. package/test/collection-browser.test.ts +2639 -2639
  60. package/test/collection-facets/facet-row.test.ts +421 -421
  61. package/test/tiles/grid/item-tile.test.ts +520 -520
  62. package/test/tiles/list/tile-list.test.ts +576 -576
  63. package/test/tiles/tile-dispatcher.test.ts +320 -320
@@ -1,85 +1,85 @@
1
- import {
2
- css,
3
- html,
4
- LitElement,
5
- TemplateResult,
6
- CSSResultGroup,
7
- nothing,
8
- } from 'lit';
9
- import { customElement, property } from 'lit/decorators.js';
10
- import { repeat } from 'lit/directives/repeat.js';
11
- import type { FacetGroup, FacetBucket, FacetEventDetails } from '../models';
12
- import type { CollectionTitles } from '../data-source/models';
13
- import './facet-row';
14
-
15
- @customElement('facets-template')
16
- export class FacetsTemplate extends LitElement {
17
- @property({ type: Object }) facetGroup?: FacetGroup;
18
-
19
- @property({ type: Object })
20
- collectionTitles?: CollectionTitles;
21
-
22
- private facetClicked(e: CustomEvent<FacetEventDetails>) {
23
- this.dispatchFacetClickEvent(e.detail);
24
- }
25
-
26
- private dispatchFacetClickEvent(detail: FacetEventDetails) {
27
- const event = new CustomEvent<FacetEventDetails>('facetClick', {
28
- detail,
29
- composed: true,
30
- });
31
- this.dispatchEvent(event);
32
- }
33
-
34
- private get facetsTemplate(): TemplateResult | typeof nothing {
35
- const { facetGroup } = this;
36
- if (!facetGroup) return nothing;
37
-
38
- const facetBuckets = facetGroup.buckets as FacetBucket[];
39
- const isLoneBucket = facetBuckets.length === 1;
40
-
41
- // Added data-testid for Playwright testing
42
- // Using className and aria-labels is not ideal for Playwright locator
43
- return html`
44
- <div class="facet-rows" data-testid="facets-on-${facetGroup.key}">
45
- ${repeat(
46
- facetBuckets,
47
- bucket => `${facetGroup.key}:${bucket.key}`,
48
- bucket =>
49
- html`<facet-row
50
- .facetType=${facetGroup.key}
51
- .bucket=${bucket}
52
- .collectionTitles=${this.collectionTitles}
53
- ?omitHideButton=${isLoneBucket}
54
- @facetClick=${this.facetClicked}
55
- ></facet-row>`,
56
- )}
57
- </div>
58
- `;
59
- }
60
-
61
- render() {
62
- return html`${this.facetsTemplate}`;
63
- }
64
-
65
- static get styles(): CSSResultGroup {
66
- const columnCount = css`var(--facetsColumnCount, 1)`;
67
- const columnGap = css`var(--facetsColumnGap, 15px)`;
68
-
69
- return css`
70
- .facet-rows {
71
- column-count: ${columnCount};
72
- column-gap: ${columnGap};
73
- }
74
-
75
- a:link,
76
- a:visited {
77
- text-decoration: none;
78
- color: var(--ia-theme-link-color, #4b64ff);
79
- }
80
- a:hover {
81
- text-decoration: underline;
82
- }
83
- `;
84
- }
85
- }
1
+ import {
2
+ css,
3
+ html,
4
+ LitElement,
5
+ TemplateResult,
6
+ CSSResultGroup,
7
+ nothing,
8
+ } from 'lit';
9
+ import { customElement, property } from 'lit/decorators.js';
10
+ import { repeat } from 'lit/directives/repeat.js';
11
+ import type { FacetGroup, FacetBucket, FacetEventDetails } from '../models';
12
+ import type { CollectionTitles } from '../data-source/models';
13
+ import './facet-row';
14
+
15
+ @customElement('facets-template')
16
+ export class FacetsTemplate extends LitElement {
17
+ @property({ type: Object }) facetGroup?: FacetGroup;
18
+
19
+ @property({ type: Object })
20
+ collectionTitles?: CollectionTitles;
21
+
22
+ private facetClicked(e: CustomEvent<FacetEventDetails>) {
23
+ this.dispatchFacetClickEvent(e.detail);
24
+ }
25
+
26
+ private dispatchFacetClickEvent(detail: FacetEventDetails) {
27
+ const event = new CustomEvent<FacetEventDetails>('facetClick', {
28
+ detail,
29
+ composed: true,
30
+ });
31
+ this.dispatchEvent(event);
32
+ }
33
+
34
+ private get facetsTemplate(): TemplateResult | typeof nothing {
35
+ const { facetGroup } = this;
36
+ if (!facetGroup) return nothing;
37
+
38
+ const facetBuckets = facetGroup.buckets as FacetBucket[];
39
+ const isLoneBucket = facetBuckets.length === 1;
40
+
41
+ // Added data-testid for Playwright testing
42
+ // Using className and aria-labels is not ideal for Playwright locator
43
+ return html`
44
+ <div class="facet-rows" data-testid="facets-on-${facetGroup.key}">
45
+ ${repeat(
46
+ facetBuckets,
47
+ bucket => `${facetGroup.key}:${bucket.key}`,
48
+ bucket =>
49
+ html`<facet-row
50
+ .facetType=${facetGroup.key}
51
+ .bucket=${bucket}
52
+ .collectionTitles=${this.collectionTitles}
53
+ ?omitHideButton=${isLoneBucket}
54
+ @facetClick=${this.facetClicked}
55
+ ></facet-row>`,
56
+ )}
57
+ </div>
58
+ `;
59
+ }
60
+
61
+ render() {
62
+ return html`${this.facetsTemplate}`;
63
+ }
64
+
65
+ static get styles(): CSSResultGroup {
66
+ const columnCount = css`var(--facetsColumnCount, 1)`;
67
+ const columnGap = css`var(--facetsColumnGap, 15px)`;
68
+
69
+ return css`
70
+ .facet-rows {
71
+ column-count: ${columnCount};
72
+ column-gap: ${columnGap};
73
+ }
74
+
75
+ a:link,
76
+ a:visited {
77
+ text-decoration: none;
78
+ color: var(--ia-theme-link-color, #4b64ff);
79
+ }
80
+ a:hover {
81
+ text-decoration: underline;
82
+ }
83
+ `;
84
+ }
85
+ }