@internetarchive/collection-browser 4.4.0 → 4.5.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.
Files changed (68) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/app-root.d.ts +8 -0
  4. package/dist/src/app-root.js +26 -0
  5. package/dist/src/app-root.js.map +1 -1
  6. package/dist/src/collection-browser.d.ts +8 -0
  7. package/dist/src/collection-browser.js +19 -1
  8. package/dist/src/collection-browser.js.map +1 -1
  9. package/dist/src/collection-facets/facet-row.d.ts +6 -0
  10. package/dist/src/collection-facets/facet-row.js +158 -140
  11. package/dist/src/collection-facets/facet-row.js.map +1 -1
  12. package/dist/src/collection-facets/facets-template.js +25 -23
  13. package/dist/src/collection-facets/facets-template.js.map +1 -1
  14. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  15. package/dist/src/styles/tile-action-styles.d.ts +14 -0
  16. package/dist/src/styles/tile-action-styles.js +59 -0
  17. package/dist/src/styles/tile-action-styles.js.map +1 -0
  18. package/dist/src/tiles/base-tile-component.d.ts +17 -1
  19. package/dist/src/tiles/base-tile-component.js +50 -1
  20. package/dist/src/tiles/base-tile-component.js.map +1 -1
  21. package/dist/src/tiles/grid/item-tile.js +139 -138
  22. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  23. package/dist/src/tiles/item-image.js +28 -28
  24. package/dist/src/tiles/item-image.js.map +1 -1
  25. package/dist/src/tiles/list/tile-list-compact-header.js +71 -46
  26. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  27. package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
  28. package/dist/src/tiles/list/tile-list-compact.js +138 -100
  29. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  30. package/dist/src/tiles/list/tile-list.d.ts +1 -1
  31. package/dist/src/tiles/list/tile-list.js +316 -298
  32. package/dist/src/tiles/list/tile-list.js.map +1 -1
  33. package/dist/src/tiles/models.d.ts +11 -0
  34. package/dist/src/tiles/models.js.map +1 -1
  35. package/dist/src/tiles/tile-dispatcher.d.ts +14 -0
  36. package/dist/src/tiles/tile-dispatcher.js +319 -216
  37. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  38. package/dist/src/tiles/tile-display-value-provider.js +2 -1
  39. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  40. package/dist/test/collection-facets/facet-row.test.js +55 -23
  41. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  42. package/dist/test/tiles/grid/item-tile.test.js +79 -79
  43. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  44. package/dist/test/tiles/list/tile-list.test.js +136 -136
  45. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  46. package/dist/test/tiles/tile-dispatcher.test.js +101 -87
  47. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  48. package/index.ts +29 -28
  49. package/package.json +2 -2
  50. package/src/app-root.ts +30 -0
  51. package/src/collection-browser.ts +16 -1
  52. package/src/collection-facets/facet-row.ts +309 -299
  53. package/src/collection-facets/facets-template.ts +85 -83
  54. package/src/data-source/collection-browser-data-source.ts +1465 -1465
  55. package/src/styles/tile-action-styles.ts +59 -0
  56. package/src/tiles/base-tile-component.ts +124 -65
  57. package/src/tiles/grid/item-tile.ts +347 -346
  58. package/src/tiles/item-image.ts +214 -214
  59. package/src/tiles/list/tile-list-compact-header.ts +112 -86
  60. package/src/tiles/list/tile-list-compact.ts +278 -239
  61. package/src/tiles/list/tile-list.ts +718 -700
  62. package/src/tiles/models.ts +21 -8
  63. package/src/tiles/tile-dispatcher.ts +637 -527
  64. package/src/tiles/tile-display-value-provider.ts +133 -134
  65. package/test/collection-facets/facet-row.test.ts +421 -375
  66. package/test/tiles/grid/item-tile.test.ts +520 -520
  67. package/test/tiles/list/tile-list.test.ts +576 -576
  68. package/test/tiles/tile-dispatcher.test.ts +320 -300
package/index.ts CHANGED
@@ -1,28 +1,29 @@
1
- export { CollectionBrowser } from './src/collection-browser';
2
- export { CollectionBrowserDataSource } from './src/data-source/collection-browser-data-source';
3
- export { CollectionBrowserDataSourceInterface } from './src/data-source/collection-browser-data-source-interface';
4
- export { CollectionBrowserQueryState } from './src/data-source/collection-browser-query-state';
5
- export { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';
6
- export {
7
- CollectionDisplayMode,
8
- SortField,
9
- TileModel,
10
- FacetOption,
11
- SelectedFacets,
12
- getDefaultSelectedFacets,
13
- } from './src/models';
14
- export { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';
15
- export { CollectionTile } from './src/tiles/grid/collection-tile';
16
- export { AccountTile } from './src/tiles/grid/account-tile';
17
- export { ItemTile } from './src/tiles/grid/item-tile';
18
- export { TileList } from './src/tiles/list/tile-list';
19
- export { TileListCompact } from './src/tiles/list/tile-list-compact';
20
- export { TileDispatcher } from './src/tiles/tile-dispatcher';
21
- export { LayoutType } from './src/tiles/models';
22
- export {
23
- SmartQueryHeuristic,
24
- KeywordFacetMap,
25
- SmartFacet,
26
- } from './src/collection-facets/smart-facets/models';
27
- export * from './src/collection-facets/smart-facets/heuristics/index';
28
- export { SmartQueryHeuristicGroup } from './src/collection-facets/smart-facets/smart-facet-heuristics';
1
+ export { CollectionBrowser } from './src/collection-browser';
2
+ export { CollectionBrowserDataSource } from './src/data-source/collection-browser-data-source';
3
+ export { CollectionBrowserDataSourceInterface } from './src/data-source/collection-browser-data-source-interface';
4
+ export { CollectionBrowserQueryState } from './src/data-source/collection-browser-query-state';
5
+ export { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';
6
+ export {
7
+ CollectionDisplayMode,
8
+ SortField,
9
+ TileModel,
10
+ FacetOption,
11
+ SelectedFacets,
12
+ getDefaultSelectedFacets,
13
+ } from './src/models';
14
+ export { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';
15
+ export { CollectionTile } from './src/tiles/grid/collection-tile';
16
+ export { AccountTile } from './src/tiles/grid/account-tile';
17
+ export { ItemTile } from './src/tiles/grid/item-tile';
18
+ export { TileList } from './src/tiles/list/tile-list';
19
+ export { TileListCompact } from './src/tiles/list/tile-list-compact';
20
+ export { TileDispatcher } from './src/tiles/tile-dispatcher';
21
+ export { LayoutType } from './src/tiles/models';
22
+ export type { TileAction } from './src/tiles/models';
23
+ export {
24
+ SmartQueryHeuristic,
25
+ KeywordFacetMap,
26
+ SmartFacet,
27
+ } from './src/collection-facets/smart-facets/models';
28
+ export * from './src/collection-facets/smart-facets/heuristics/index';
29
+ export { SmartQueryHeuristicGroup } from './src/collection-facets/smart-facets/smart-facet-heuristics';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "4.4.0",
6
+ "version": "4.5.0",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -33,7 +33,7 @@
33
33
  "@internetarchive/iaux-item-metadata": "^1.0.5",
34
34
  "@internetarchive/infinite-scroller": "^2.0.0",
35
35
  "@internetarchive/modal-manager": "^2.0.5",
36
- "@internetarchive/search-service": "^2.7.1",
36
+ "@internetarchive/search-service": "^2.7.2",
37
37
  "@internetarchive/shared-resize-observer": "^0.2.0",
38
38
  "@lit/localize": "^0.12.2",
39
39
  "dompurify": "^3.2.4",
package/src/app-root.ts CHANGED
@@ -384,6 +384,16 @@ export class AppRoot extends LitElement {
384
384
  />
385
385
  <label for="enable-smart-facet-bar">Enable smart facet bar</label>
386
386
  </div>
387
+ <div class="checkbox-control">
388
+ <input
389
+ type="checkbox"
390
+ id="enable-tile-actions"
391
+ @click=${this.tileActionsCheckboxChanged}
392
+ />
393
+ <label for="enable-tile-actions"
394
+ >Enable tile action buttons</label
395
+ >
396
+ </div>
387
397
  </fieldset>
388
398
 
389
399
  <fieldset class="cb-visual-appearance">
@@ -584,6 +594,7 @@ export class AppRoot extends LitElement {
584
594
  @manageModeChanged=${this.manageModeChanged}
585
595
  @itemRemovalRequested=${this.handleItemRemovalRequest}
586
596
  @itemManagerRequested=${this.handleItemManagerRequest}
597
+ @tileActionClicked=${this.handleTileActionClicked}
587
598
  >
588
599
  ${this.toggleSlots
589
600
  ? html`<div slot="sortbar-left-slot">Sort Slot</div>`
@@ -805,6 +816,25 @@ export class AppRoot extends LitElement {
805
816
  this.collectionBrowser.showSmartFacetBar = target.checked;
806
817
  }
807
818
 
819
+ /**
820
+ * Handler for when the dev panel's "Enable tile action buttons" checkbox is changed.
821
+ */
822
+ private tileActionsCheckboxChanged(e: Event) {
823
+ const target = e.target as HTMLInputElement;
824
+ this.collectionBrowser.tileActions = target.checked
825
+ ? [{ id: 'demo-action', label: 'Return' }]
826
+ : [];
827
+ }
828
+
829
+ /**
830
+ * Handler for tile action button clicks (logs to console for QA).
831
+ */
832
+ private handleTileActionClicked(
833
+ e: CustomEvent<{ actionId: string; model: unknown }>,
834
+ ) {
835
+ console.log('Tile action clicked:', e.detail.actionId, e.detail.model);
836
+ }
837
+
808
838
  /**
809
839
  * Handler for when the dev panel's "Show facet top slot" checkbox is changed.
810
840
  */
@@ -78,6 +78,7 @@ import { sha1 } from './utils/sha1';
78
78
  import type { PlaceholderType } from './empty-placeholder';
79
79
  import type { ManageBar } from './manage/manage-bar';
80
80
  import type { SmartFacetBar } from './collection-facets/smart-facets/smart-facet-bar';
81
+ import type { LayoutType, TileAction } from './tiles/models';
81
82
 
82
83
  import '@internetarchive/elements/ia-combo-box/ia-combo-box';
83
84
  import './empty-placeholder';
@@ -297,6 +298,15 @@ export class CollectionBrowser
297
298
  */
298
299
  @property({ type: Boolean }) isManageView = false;
299
300
 
301
+ /** Action buttons to display on each tile */
302
+ @property({ type: Array }) tileActions: TileAction[] = [];
303
+
304
+ /**
305
+ * The simplified layout to apply to grid-mode tiles, if any. See
306
+ * `LayoutType` for available options. Has no effect on list display modes.
307
+ */
308
+ @property({ type: String }) tileLayoutType: LayoutType = 'default';
309
+
300
310
  @property({ type: String }) manageViewLabel = 'Select items to remove';
301
311
 
302
312
  /** Whether to replace the default sort options with a slot for customization (default: false) */
@@ -1652,6 +1662,7 @@ export class CollectionBrowser
1652
1662
  .mobileBreakpoint=${this.mobileBreakpoint}
1653
1663
  .loggedIn=${this.loggedIn}
1654
1664
  .suppressBlurring=${this.shouldSuppressTileBlurring}
1665
+ .tileActions=${this.tileActions}
1655
1666
  >
1656
1667
  </tile-dispatcher>
1657
1668
  </div>
@@ -1801,7 +1812,9 @@ export class CollectionBrowser
1801
1812
  changed.has('displayMode') ||
1802
1813
  changed.has('baseNavigationUrl') ||
1803
1814
  changed.has('baseImageUrl') ||
1804
- changed.has('loggedIn')
1815
+ changed.has('loggedIn') ||
1816
+ changed.has('tileActions') ||
1817
+ changed.has('tileLayoutType')
1805
1818
  ) {
1806
1819
  this.infiniteScroller?.reload();
1807
1820
  }
@@ -2635,6 +2648,8 @@ export class CollectionBrowser
2635
2648
  .loggedIn=${this.loggedIn}
2636
2649
  .suppressBlurring=${this.shouldSuppressTileBlurring}
2637
2650
  .isManageView=${this.isManageView}
2651
+ .tileActions=${this.tileActions}
2652
+ .layoutType=${this.tileLayoutType}
2638
2653
  ?showTvClips=${isTVSearch || isTVCollection}
2639
2654
  ?enableHoverPane=${true}
2640
2655
  ?useLocalTime=${shouldUseLocalTime}