@internetarchive/collection-browser 0.4.10-alpha.3 → 0.4.11

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 (237) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +26 -26
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.husky/pre-commit +4 -4
  7. package/LICENSE +661 -661
  8. package/README.md +83 -83
  9. package/dist/index.d.ts +9 -9
  10. package/dist/index.js +9 -9
  11. package/dist/src/app-root.d.ts +50 -50
  12. package/dist/src/app-root.js +278 -278
  13. package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
  14. package/dist/src/assets/img/icons/arrow-left.js +2 -2
  15. package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
  16. package/dist/src/assets/img/icons/arrow-right.js +2 -2
  17. package/dist/src/assets/img/icons/chevron.d.ts +2 -2
  18. package/dist/src/assets/img/icons/chevron.js +2 -2
  19. package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
  20. package/dist/src/assets/img/icons/empty-query.js +2 -2
  21. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
  22. package/dist/src/assets/img/icons/eye-closed.js +2 -2
  23. package/dist/src/assets/img/icons/eye.d.ts +2 -2
  24. package/dist/src/assets/img/icons/eye.js +2 -2
  25. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  26. package/dist/src/assets/img/icons/favorite-filled.js +2 -2
  27. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  28. package/dist/src/assets/img/icons/login-required.js +2 -2
  29. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  30. package/dist/src/assets/img/icons/mediatype/account.js +2 -2
  31. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  32. package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
  33. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  34. package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
  35. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  36. package/dist/src/assets/img/icons/mediatype/data.js +2 -2
  37. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  38. package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
  39. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  40. package/dist/src/assets/img/icons/mediatype/film.js +2 -2
  41. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  42. package/dist/src/assets/img/icons/mediatype/images.js +2 -2
  43. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  44. package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
  45. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  46. package/dist/src/assets/img/icons/mediatype/software.js +2 -2
  47. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  48. package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
  49. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  50. package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
  51. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  52. package/dist/src/assets/img/icons/mediatype/video.js +2 -2
  53. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  54. package/dist/src/assets/img/icons/mediatype/web.js +2 -2
  55. package/dist/src/assets/img/icons/null-result.d.ts +2 -2
  56. package/dist/src/assets/img/icons/null-result.js +2 -2
  57. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  58. package/dist/src/assets/img/icons/restricted.js +2 -2
  59. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  60. package/dist/src/assets/img/icons/reviews.js +2 -2
  61. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  62. package/dist/src/assets/img/icons/upload.js +2 -2
  63. package/dist/src/assets/img/icons/views.d.ts +1 -1
  64. package/dist/src/assets/img/icons/views.js +2 -2
  65. package/dist/src/circular-activity-indicator.d.ts +5 -5
  66. package/dist/src/circular-activity-indicator.js +17 -17
  67. package/dist/src/collection-browser.d.ts +279 -279
  68. package/dist/src/collection-browser.js +1156 -1156
  69. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  70. package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
  71. package/dist/src/collection-facets/facets-template.d.ts +16 -16
  72. package/dist/src/collection-facets/facets-template.js +125 -125
  73. package/dist/src/collection-facets/more-facets-content.d.ts +75 -75
  74. package/dist/src/collection-facets/more-facets-content.js +340 -340
  75. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  76. package/dist/src/collection-facets/more-facets-pagination.js +192 -192
  77. package/dist/src/collection-facets.d.ts +81 -81
  78. package/dist/src/collection-facets.js +375 -375
  79. package/dist/src/empty-placeholder.d.ts +11 -11
  80. package/dist/src/empty-placeholder.js +42 -42
  81. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  82. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  83. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  84. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  85. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  86. package/dist/src/mediatype/mediatype-config.js +85 -85
  87. package/dist/src/models.d.ts +115 -115
  88. package/dist/src/models.js +125 -125
  89. package/dist/src/models.js.map +1 -1
  90. package/dist/src/restoration-state-handler.d.ts +45 -45
  91. package/dist/src/restoration-state-handler.js +230 -230
  92. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
  93. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
  94. package/dist/src/sort-filter-bar/alpha-bar.d.ts +20 -20
  95. package/dist/src/sort-filter-bar/alpha-bar.js +136 -128
  96. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  97. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  98. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  99. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  100. package/dist/src/sort-filter-bar/img/list.js +2 -2
  101. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  102. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  103. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  104. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  105. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +108 -113
  106. package/dist/src/sort-filter-bar/sort-filter-bar.js +548 -614
  107. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  108. package/dist/src/styles/item-image-styles.d.ts +8 -8
  109. package/dist/src/styles/item-image-styles.js +9 -9
  110. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  111. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  112. package/dist/src/tiles/grid/account-tile.d.ts +20 -20
  113. package/dist/src/tiles/grid/account-tile.js +64 -64
  114. package/dist/src/tiles/grid/collection-tile.d.ts +17 -17
  115. package/dist/src/tiles/grid/collection-tile.js +71 -71
  116. package/dist/src/tiles/grid/item-tile.d.ts +32 -32
  117. package/dist/src/tiles/grid/item-tile.js +126 -129
  118. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  119. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
  120. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +7 -7
  121. package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
  122. package/dist/src/tiles/grid/tile-stats.js +40 -40
  123. package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
  124. package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
  125. package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
  126. package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
  127. package/dist/src/tiles/image-block.d.ts +17 -17
  128. package/dist/src/tiles/image-block.js +72 -72
  129. package/dist/src/tiles/item-image.d.ts +35 -35
  130. package/dist/src/tiles/item-image.js +117 -117
  131. package/dist/src/tiles/list/account-label.d.ts +1 -1
  132. package/dist/src/tiles/list/account-label.js +6 -6
  133. package/dist/src/tiles/list/date-label.d.ts +1 -1
  134. package/dist/src/tiles/list/date-label.js +12 -12
  135. package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
  136. package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
  137. package/dist/src/tiles/list/tile-list-compact.d.ts +21 -21
  138. package/dist/src/tiles/list/tile-list-compact.js +99 -99
  139. package/dist/src/tiles/list/tile-list.d.ts +55 -55
  140. package/dist/src/tiles/list/tile-list.js +301 -301
  141. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  142. package/dist/src/tiles/mediatype-icon.js +47 -47
  143. package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
  144. package/dist/src/tiles/overlay/icon-overlay.js +40 -40
  145. package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
  146. package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
  147. package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
  148. package/dist/src/tiles/overlay/text-overlay.js +42 -42
  149. package/dist/src/tiles/text-snippet-block.d.ts +27 -27
  150. package/dist/src/tiles/text-snippet-block.js +73 -73
  151. package/dist/src/tiles/tile-dispatcher.d.ts +58 -58
  152. package/dist/src/tiles/tile-dispatcher.js +194 -194
  153. package/dist/src/utils/analytics-events.d.ts +22 -22
  154. package/dist/src/utils/analytics-events.js +24 -24
  155. package/dist/src/utils/format-count.d.ts +7 -7
  156. package/dist/src/utils/format-count.js +76 -76
  157. package/dist/src/utils/format-date.d.ts +2 -2
  158. package/dist/src/utils/format-date.js +23 -23
  159. package/dist/src/utils/format-unit-size.d.ts +2 -2
  160. package/dist/src/utils/format-unit-size.js +33 -33
  161. package/dist/test/collection-browser.test.d.ts +1 -1
  162. package/dist/test/collection-browser.test.js +584 -584
  163. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  164. package/dist/test/collection-facets/facets-template.test.js +62 -62
  165. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  166. package/dist/test/collection-facets/more-facets-content.test.js +114 -114
  167. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  168. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  169. package/dist/test/collection-facets.test.d.ts +2 -2
  170. package/dist/test/collection-facets.test.js +460 -460
  171. package/dist/test/empty-placeholder.test.d.ts +1 -1
  172. package/dist/test/empty-placeholder.test.js +33 -33
  173. package/dist/test/icon-overlay.test.d.ts +1 -1
  174. package/dist/test/icon-overlay.test.js +24 -24
  175. package/dist/test/image-block.test.d.ts +1 -1
  176. package/dist/test/image-block.test.js +48 -48
  177. package/dist/test/item-image.test.d.ts +1 -1
  178. package/dist/test/item-image.test.js +84 -84
  179. package/dist/test/mediatype-config.test.d.ts +1 -1
  180. package/dist/test/mediatype-config.test.js +16 -16
  181. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  182. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  183. package/dist/test/mocks/mock-collection-name-cache.d.ts +7 -7
  184. package/dist/test/mocks/mock-collection-name-cache.js +13 -13
  185. package/dist/test/mocks/mock-search-responses.d.ts +12 -12
  186. package/dist/test/mocks/mock-search-responses.js +341 -341
  187. package/dist/test/mocks/mock-search-service.d.ts +13 -13
  188. package/dist/test/mocks/mock-search-service.js +40 -40
  189. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  190. package/dist/test/restoration-state-handler.test.js +125 -125
  191. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
  192. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
  193. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
  194. package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
  195. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  196. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +197 -208
  197. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  198. package/dist/test/text-overlay.test.d.ts +1 -1
  199. package/dist/test/text-overlay.test.js +48 -48
  200. package/dist/test/text-snippet-block.test.d.ts +1 -1
  201. package/dist/test/text-snippet-block.test.js +57 -57
  202. package/dist/test/tile-stats.test.d.ts +1 -1
  203. package/dist/test/tile-stats.test.js +33 -33
  204. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
  205. package/dist/test/tiles/grid/account-tile.test.js +76 -76
  206. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
  207. package/dist/test/tiles/grid/collection-tile.test.js +73 -73
  208. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  209. package/dist/test/tiles/grid/item-tile.test.js +158 -158
  210. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
  211. package/dist/test/tiles/hover/hover-pane-controller.test.js +257 -257
  212. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
  213. package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
  214. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  215. package/dist/test/tiles/list/tile-list-compact.test.js +92 -92
  216. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  217. package/dist/test/tiles/list/tile-list.test.js +163 -163
  218. package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
  219. package/dist/test/tiles/tile-dispatcher.test.js +67 -67
  220. package/dist/test/utils/format-count.test.d.ts +1 -1
  221. package/dist/test/utils/format-count.test.js +23 -23
  222. package/dist/test/utils/format-date.test.d.ts +1 -1
  223. package/dist/test/utils/format-date.test.js +17 -17
  224. package/dist/test/utils/format-unit-size.test.d.ts +1 -1
  225. package/dist/test/utils/format-unit-size.test.js +17 -17
  226. package/local.archive.org.cert +86 -86
  227. package/local.archive.org.key +27 -27
  228. package/package.json +3 -4
  229. package/renovate.json +6 -6
  230. package/src/models.ts +6 -6
  231. package/src/sort-filter-bar/alpha-bar.ts +8 -0
  232. package/src/sort-filter-bar/sort-filter-bar.ts +197 -283
  233. package/src/tiles/grid/item-tile.ts +1 -5
  234. package/test/sort-filter-bar/sort-filter-bar.test.ts +39 -56
  235. package/tsconfig.json +21 -21
  236. package/web-dev-server.config.mjs +30 -30
  237. package/web-test-runner.config.mjs +41 -41
@@ -1,38 +1,41 @@
1
- import { __decorate } from "tslib";
2
- import { LitElement, html, css, nothing, } from 'lit';
3
- import { customElement, property, query, state } from 'lit/decorators.js';
4
- import '@internetarchive/ia-dropdown';
5
- import { SortField, SortFieldDisplayName, } from '../models';
6
- import './alpha-bar';
7
- import { sortIcon } from './img/sort-triangle';
8
- import { tileIcon } from './img/tile';
9
- import { listIcon } from './img/list';
10
- import { compactIcon } from './img/compact';
11
- let SortFilterBar = class SortFilterBar extends LitElement {
12
- constructor() {
13
- super(...arguments);
14
- this.sortDirection = null;
15
- this.selectedSort = SortField.relevance;
16
- this.selectedTitleFilter = null;
17
- this.selectedCreatorFilter = null;
18
- this.showRelevance = true;
19
- this.alphaSelectorVisible = null;
20
- this.dateSortSelectorVisible = false;
21
- this.viewSortSelectorVisible = false;
22
- this.desktopSortContainerWidth = 0;
23
- this.selectorBarContainerWidth = 0;
24
- this.hoveringOverDateSortOptions = false;
25
- this.boundSortBarSelectorEscapeListener = (e) => {
26
- if (e.key === 'Escape') {
27
- this.viewSortSelectorVisible = false;
28
- this.dateSortSelectorVisible = false;
29
- }
30
- };
31
- }
32
- render() {
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html, css, nothing, } from 'lit';
3
+ import { customElement, property, query, state } from 'lit/decorators.js';
4
+ import { SortField, SortFieldDisplayName, } from '../models';
5
+ import './alpha-bar';
6
+ import { sortIcon } from './img/sort-triangle';
7
+ import { tileIcon } from './img/tile';
8
+ import { listIcon } from './img/list';
9
+ import { compactIcon } from './img/compact';
10
+ let SortFilterBar = class SortFilterBar extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.sortDirection = null;
14
+ this.selectedSort = SortField.relevance;
15
+ this.selectedTitleFilter = null;
16
+ this.selectedCreatorFilter = null;
17
+ this.showRelevance = true;
18
+ this.alphaSelectorVisible = null;
19
+ this.dateSortSelectorVisible = false;
20
+ this.viewSortSelectorVisible = false;
21
+ this.desktopSelectorBarWidth = 0;
22
+ this.selectorBarContainerWidth = 0;
23
+ this.hoveringOverDateSortOptions = false;
24
+ this.boundSortBarSelectorEscapeListener = (e) => {
25
+ if (e.key === 'Escape') {
26
+ this.viewSortSelectorVisible = false;
27
+ this.dateSortSelectorVisible = false;
28
+ }
29
+ };
30
+ }
31
+ render() {
33
32
  return html `
34
33
  <div id="container">
35
34
  <div id="sort-bar">
35
+ <div id="sort-direction-container">
36
+ ${this.sortDirectionSelectorTemplate}
37
+ </div>
38
+
36
39
  <div id="sort-selector-container">
37
40
  ${this.mobileSortSelectorTemplate}
38
41
  ${this.desktopSortSelectorTemplate}
@@ -41,340 +44,280 @@ let SortFilterBar = class SortFilterBar extends LitElement {
41
44
  <div id="display-style-selector">${this.displayOptionTemplate}</div>
42
45
  </div>
43
46
 
44
- ${this.viewSortSelectorVisible && !this.mobileSelectorVisible
45
- ? this.dropdownBackdrop
47
+ ${this.viewSortSelectorVisible && !this.mobileSelectorVisible
48
+ ? this.viewSortSelector
46
49
  : nothing}
47
- ${this.dateSortSelectorVisible && !this.mobileSelectorVisible
48
- ? this.dropdownBackdrop
50
+ ${this.dateSortSelectorVisible && !this.mobileSelectorVisible
51
+ ? this.dateSortSelector
49
52
  : nothing}
50
53
  ${this.alphaBarTemplate}
54
+
55
+ <div id="bottom-shadow"></div>
51
56
  </div>
52
- `;
53
- }
54
- updated(changed) {
55
- if (changed.has('displayMode')) {
56
- this.displayModeChanged();
57
- }
58
- if (changed.has('selectedSort') && this.sortDirection === null) {
59
- this.sortDirection = 'desc';
60
- }
61
- if (changed.has('selectedTitleFilter') && this.selectedTitleFilter) {
62
- this.alphaSelectorVisible = 'title';
63
- }
64
- if (changed.has('selectedCreatorFilter') && this.selectedCreatorFilter) {
65
- this.alphaSelectorVisible = 'creator';
66
- }
67
- if (changed.has('dateSortSelectorVisible') ||
68
- changed.has('viewSortSelectorVisible')) {
69
- this.setupEscapeListeners();
70
- }
71
- if (changed.has('resizeObserver')) {
72
- const oldObserver = changed.get('resizeObserver');
73
- if (oldObserver)
74
- this.disconnectResizeObserver(oldObserver);
75
- this.setupResizeObserver();
76
- }
77
- }
78
- setupEscapeListeners() {
79
- if (this.dateSortSelectorVisible || this.viewSortSelectorVisible) {
80
- document.addEventListener('keydown', this.boundSortBarSelectorEscapeListener);
81
- }
82
- else {
83
- document.removeEventListener('keydown', this.boundSortBarSelectorEscapeListener);
84
- }
85
- }
86
- disconnectedCallback() {
87
- if (this.resizeObserver) {
88
- this.disconnectResizeObserver(this.resizeObserver);
89
- }
90
- }
91
- disconnectResizeObserver(resizeObserver) {
92
- resizeObserver.removeObserver({
93
- target: this.sortSelectorContainer,
94
- handler: this,
95
- });
96
- resizeObserver.removeObserver({
97
- target: this.desktopSortContainer,
98
- handler: this,
99
- });
100
- }
101
- setupResizeObserver() {
102
- if (!this.resizeObserver)
103
- return;
104
- this.resizeObserver.addObserver({
105
- target: this.sortSelectorContainer,
106
- handler: this,
107
- });
108
- this.resizeObserver.addObserver({
109
- target: this.desktopSortContainer,
110
- handler: this,
111
- });
112
- }
113
- get mobileSelectorVisible() {
114
- return this.selectorBarContainerWidth - 10 < this.desktopSortContainerWidth;
115
- }
116
- get alphaBarTemplate() {
117
- if (!['title', 'creator'].includes(this.selectedSort))
118
- return nothing;
119
- if (this.alphaSelectorVisible === null) {
120
- if (this.selectedSort === 'creator')
121
- return this.creatorSelectorBar;
122
- if (this.selectedSort === 'title')
123
- return this.titleSelectorBar;
124
- }
125
- else {
126
- return this.alphaSelectorVisible === 'creator'
127
- ? this.creatorSelectorBar
128
- : this.titleSelectorBar;
129
- }
130
- return nothing;
131
- }
132
- handleResize(entry) {
133
- if (entry.target === this.desktopSortContainer) {
134
- this.desktopSortContainerWidth = entry.contentRect.width;
135
- }
136
- else if (entry.target === this.sortSelectorContainer) {
137
- this.selectorBarContainerWidth = entry.contentRect.width;
138
- }
139
- }
140
- get sortDirectionSelectorTemplate() {
57
+ `;
58
+ }
59
+ updated(changed) {
60
+ if (changed.has('displayMode')) {
61
+ this.displayModeChanged();
62
+ }
63
+ if (changed.has('selectedSort') && this.sortDirection === null) {
64
+ this.sortDirection = 'desc';
65
+ }
66
+ if (changed.has('selectedTitleFilter') && this.selectedTitleFilter) {
67
+ this.alphaSelectorVisible = 'title';
68
+ }
69
+ if (changed.has('selectedCreatorFilter') && this.selectedCreatorFilter) {
70
+ this.alphaSelectorVisible = 'creator';
71
+ }
72
+ if (changed.has('dateSortSelectorVisible') ||
73
+ changed.has('viewSortSelectorVisible')) {
74
+ this.setupEscapeListeners();
75
+ }
76
+ if (changed.has('resizeObserver')) {
77
+ const oldObserver = changed.get('resizeObserver');
78
+ if (oldObserver)
79
+ this.disconnectResizeObserver(oldObserver);
80
+ this.setupResizeObserver();
81
+ }
82
+ }
83
+ setupEscapeListeners() {
84
+ if (this.dateSortSelectorVisible || this.viewSortSelectorVisible) {
85
+ document.addEventListener('keydown', this.boundSortBarSelectorEscapeListener);
86
+ }
87
+ else {
88
+ document.removeEventListener('keydown', this.boundSortBarSelectorEscapeListener);
89
+ }
90
+ }
91
+ disconnectedCallback() {
92
+ if (this.resizeObserver) {
93
+ this.disconnectResizeObserver(this.resizeObserver);
94
+ }
95
+ }
96
+ disconnectResizeObserver(resizeObserver) {
97
+ resizeObserver.removeObserver({
98
+ target: this.sortSelectorContainer,
99
+ handler: this,
100
+ });
101
+ resizeObserver.removeObserver({
102
+ target: this.desktopSortSelector,
103
+ handler: this,
104
+ });
105
+ }
106
+ setupResizeObserver() {
107
+ if (!this.resizeObserver)
108
+ return;
109
+ this.resizeObserver.addObserver({
110
+ target: this.sortSelectorContainer,
111
+ handler: this,
112
+ });
113
+ this.resizeObserver.addObserver({
114
+ target: this.desktopSortSelector,
115
+ handler: this,
116
+ });
117
+ }
118
+ get mobileSelectorVisible() {
119
+ return this.selectorBarContainerWidth - 10 < this.desktopSelectorBarWidth;
120
+ }
121
+ get alphaBarTemplate() {
122
+ if (!['title', 'creator'].includes(this.selectedSort))
123
+ return nothing;
124
+ if (this.alphaSelectorVisible === null) {
125
+ if (this.selectedSort === 'creator')
126
+ return this.creatorSelectorBar;
127
+ if (this.selectedSort === 'title')
128
+ return this.titleSelectorBar;
129
+ }
130
+ else {
131
+ return this.alphaSelectorVisible === 'creator'
132
+ ? this.creatorSelectorBar
133
+ : this.titleSelectorBar;
134
+ }
135
+ return nothing;
136
+ }
137
+ handleResize(entry) {
138
+ if (entry.target === this.desktopSortSelector) {
139
+ this.desktopSelectorBarWidth = entry.contentRect.width;
140
+ }
141
+ else if (entry.target === this.sortSelectorContainer) {
142
+ this.selectorBarContainerWidth = entry.contentRect.width;
143
+ }
144
+ }
145
+ get sortDirectionSelectorTemplate() {
141
146
  return html `
142
- <button
143
- id="sort-direction-selector"
144
- ?disabled=${this.selectedSort === 'relevance'}
145
- @click=${this.toggleSortDirection}
146
- >
147
- <div
147
+ <div id="sort-direction-selector">
148
+ <button
148
149
  id="sort-ascending-btn"
149
150
  class="sort-button ${this.sortDirection === 'asc' ? 'selected' : ''}"
151
+ ?disabled=${this.selectedSort === 'relevance'}
152
+ @click=${() => {
153
+ this.setSortDirections('asc');
154
+ }}
150
155
  >
151
156
  ${sortIcon}
152
- </div>
153
- <div
157
+ </button>
158
+ <button
154
159
  id="sort-descending-btn"
155
160
  class="sort-button ${this.sortDirection === 'desc' ? 'selected' : ''}"
161
+ ?disabled=${this.selectedSort === 'relevance'}
162
+ @click=${() => {
163
+ this.setSortDirections('desc');
164
+ }}
156
165
  >
157
166
  ${sortIcon}
158
- </div>
159
- </button>
160
- `;
161
- }
162
- get desktopSortSelectorTemplate() {
167
+ </button>
168
+ </div>
169
+ `;
170
+ }
171
+ get desktopSortSelectorTemplate() {
163
172
  return html `
164
- <div
165
- id="desktop-sort-container"
173
+ <ul
174
+ id="desktop-sort-selector"
166
175
  class=${this.mobileSelectorVisible ? 'hidden' : 'visible'}
167
176
  >
168
- <span id="sort-by-text">Sort by</span>
169
- <div id="sort-direction-container">
170
- ${this.sortDirectionSelectorTemplate}
171
- </div>
172
- <ul id="desktop-sort-selector">
173
- <li>
174
- ${this.showRelevance
175
- ? this.getSortDisplayOption(SortField.relevance)
177
+ <li id="sort-by-text">Sort By</li>
178
+ <li>
179
+ ${this.showRelevance
180
+ ? this.getSortDisplayOption(SortField.relevance)
176
181
  : nothing}
177
- </li>
178
- <li>
179
- ${this.getSortDropdown({
180
- optionSelectedHandler: () => {
181
- this.dateSortSelectorVisible = false;
182
- this.alphaSelectorVisible = null;
183
- this.selectedTitleFilter = null;
184
- this.selectedCreatorFilter = null;
185
- this.emitTitleLetterChangedEvent();
186
- this.emitCreatorLetterChangedEvent();
187
- },
188
- clickHandler: () => {
189
- if (!this.viewsDropdown.open && !this.viewOptionSelected)
190
- this.setSelectedSort(SortField.weeklyview);
191
- this.dateDropdown.open = false;
192
- this.viewSortSelectorVisible = this.viewsDropdown.open;
193
- this.viewsDropdown.classList.toggle('open', this.viewsDropdown.open);
194
- },
195
- displayName: html `${this.viewSortField}`,
196
- id: 'views-dropdown',
197
- isSelected: () => this.viewOptionSelected,
198
- dropdownOptions: [
199
- this.getDropdownOption(SortField.weeklyview),
200
- this.getDropdownOption(SortField.alltimeview),
201
- ],
202
- selectedOption: this.viewOptionSelected ? this.selectedSort : '',
182
+ </li>
183
+ <li>
184
+ ${this.getSortDisplayOption(SortField.weeklyview, {
185
+ clickEvent: () => {
186
+ if (!this.viewOptionSelected)
187
+ this.setSelectedSort(SortField.weeklyview);
188
+ this.viewSortSelectorVisible = !this.viewSortSelectorVisible;
189
+ this.dateSortSelectorVisible = false;
190
+ this.alphaSelectorVisible = null;
191
+ this.selectedTitleFilter = null;
192
+ this.selectedCreatorFilter = null;
193
+ this.emitTitleLetterChangedEvent();
194
+ this.emitCreatorLetterChangedEvent();
195
+ },
196
+ displayName: html `${this.viewSortField}`,
197
+ isSelected: () => this.viewOptionSelected,
203
198
  })}
204
- </li>
205
- <li>
206
- ${this.getSortDisplayOption(SortField.title, {
207
- clickEvent: () => {
208
- this.alphaSelectorVisible = 'title';
209
- this.selectedCreatorFilter = null;
210
- this.dateSortSelectorVisible = false;
211
- this.viewSortSelectorVisible = false;
212
- this.setSelectedSort(SortField.title);
213
- this.emitCreatorLetterChangedEvent();
214
- },
199
+ </li>
200
+ <li>
201
+ ${this.getSortDisplayOption(SortField.title, {
202
+ clickEvent: () => {
203
+ this.alphaSelectorVisible = 'title';
204
+ this.selectedCreatorFilter = null;
205
+ this.dateSortSelectorVisible = false;
206
+ this.viewSortSelectorVisible = false;
207
+ this.setSelectedSort(SortField.title);
208
+ this.emitCreatorLetterChangedEvent();
209
+ },
215
210
  })}
216
- </li>
217
- <li>
218
- ${this.getSortDropdown({
219
- optionSelectedHandler: () => {
220
- this.viewSortSelectorVisible = false;
221
- this.alphaSelectorVisible = null;
222
- this.selectedTitleFilter = null;
223
- this.selectedCreatorFilter = null;
224
- this.emitTitleLetterChangedEvent();
225
- this.emitCreatorLetterChangedEvent();
226
- },
227
- clickHandler: () => {
228
- if (!this.dateDropdown.open && !this.dateOptionSelected)
229
- this.setSelectedSort(SortField.date);
230
- this.viewsDropdown.open = false;
231
- this.dateSortSelectorVisible = this.dateDropdown.open;
232
- this.dateDropdown.classList.toggle('open', this.dateDropdown.open);
233
- },
234
- displayName: html `${this.dateSortField}`,
235
- id: 'date-dropdown',
236
- isSelected: () => this.dateOptionSelected,
237
- dropdownOptions: [
238
- this.getDropdownOption(SortField.date),
239
- this.getDropdownOption(SortField.datearchived),
240
- this.getDropdownOption(SortField.datereviewed),
241
- this.getDropdownOption(SortField.dateadded),
242
- ],
243
- selectedOption: this.dateOptionSelected ? this.selectedSort : '',
211
+ </li>
212
+ <li>
213
+ ${this.getSortDisplayOption(SortField.date, {
214
+ clickEvent: () => {
215
+ if (!this.dateOptionSelected)
216
+ this.setSelectedSort(SortField.date);
217
+ this.dateSortSelectorVisible = !this.dateSortSelectorVisible;
218
+ this.viewSortSelectorVisible = false;
219
+ this.alphaSelectorVisible = null;
220
+ this.selectedTitleFilter = null;
221
+ this.selectedCreatorFilter = null;
222
+ this.emitTitleLetterChangedEvent();
223
+ this.emitCreatorLetterChangedEvent();
224
+ },
225
+ displayName: html `${this.dateSortField}`,
226
+ isSelected: () => this.dateOptionSelected,
244
227
  })}
245
- </li>
246
- <li>
247
- ${this.getSortDisplayOption(SortField.creator, {
248
- clickEvent: () => {
249
- this.alphaSelectorVisible = 'creator';
250
- this.selectedTitleFilter = null;
251
- this.dateSortSelectorVisible = false;
252
- this.setSelectedSort(SortField.creator);
253
- this.emitTitleLetterChangedEvent();
254
- },
228
+ </li>
229
+ <li>
230
+ ${this.getSortDisplayOption(SortField.creator, {
231
+ clickEvent: () => {
232
+ this.alphaSelectorVisible = 'creator';
233
+ this.selectedTitleFilter = null;
234
+ this.dateSortSelectorVisible = false;
235
+ this.setSelectedSort(SortField.creator);
236
+ this.emitTitleLetterChangedEvent();
237
+ },
255
238
  })}
256
- </li>
257
- </ul>
258
- </div>
259
- `;
260
- }
261
- /**
262
- * This generates each of the sort option links.
263
- *
264
- * It manages the display value and the selected state of the option.
265
- *
266
- * @param sortField
267
- * @param options {
268
- * additionalClickEvent?: () => void; If this is provided, it will also be called when the option is clicked.
269
- * displayName?: TemplateResult; The name to display for the option. Defaults to the sortField display name.
270
- * isSelected?: () => boolean; A function that returns true if the option is selected. Defaults to the selectedSort === sortField.
271
- * }
272
- * @returns
273
- */
274
- getSortDisplayOption(sortField, options) {
275
- var _a, _b;
276
- const isSelected = (_a = options === null || options === void 0 ? void 0 : options.isSelected) !== null && _a !== void 0 ? _a : (() => this.selectedSort === sortField);
277
- const displayName = (_b = options === null || options === void 0 ? void 0 : options.displayName) !== null && _b !== void 0 ? _b : SortFieldDisplayName[sortField];
239
+ </li>
240
+ </ul>
241
+ `;
242
+ }
243
+ /**
244
+ * This generates each of the sort option links.
245
+ *
246
+ * It manages the display value and the selected state of the option.
247
+ *
248
+ * @param sortField
249
+ * @param options {
250
+ * additionalClickEvent?: () => void; If this is provided, it will also be called when the option is clicked.
251
+ * displayName?: TemplateResult; The name to display for the option. Defaults to the sortField display name.
252
+ * isSelected?: () => boolean; A function that returns true if the option is selected. Defaults to the selectedSort === sortField.
253
+ * }
254
+ * @returns
255
+ */
256
+ getSortDisplayOption(sortField, options) {
257
+ var _a, _b;
258
+ const isSelected = (_a = options === null || options === void 0 ? void 0 : options.isSelected) !== null && _a !== void 0 ? _a : (() => this.selectedSort === sortField);
259
+ const displayName = (_b = options === null || options === void 0 ? void 0 : options.displayName) !== null && _b !== void 0 ? _b : SortFieldDisplayName[sortField];
278
260
  return html `
279
261
  <a
280
262
  href="#"
281
- @click=${(e) => {
282
- e.preventDefault();
283
- if (options === null || options === void 0 ? void 0 : options.clickEvent) {
284
- options.clickEvent(e);
285
- }
286
- else {
287
- this.alphaSelectorVisible = null;
288
- this.dateSortSelectorVisible = false;
289
- this.selectedTitleFilter = null;
290
- this.selectedCreatorFilter = null;
291
- this.setSelectedSort(sortField);
292
- this.emitTitleLetterChangedEvent();
293
- this.emitCreatorLetterChangedEvent();
294
- }
263
+ @click=${(e) => {
264
+ e.preventDefault();
265
+ if (options === null || options === void 0 ? void 0 : options.clickEvent) {
266
+ options.clickEvent(e);
267
+ }
268
+ else {
269
+ this.alphaSelectorVisible = null;
270
+ this.dateSortSelectorVisible = false;
271
+ this.selectedTitleFilter = null;
272
+ this.selectedCreatorFilter = null;
273
+ this.setSelectedSort(sortField);
274
+ this.emitTitleLetterChangedEvent();
275
+ this.emitCreatorLetterChangedEvent();
276
+ }
295
277
  }}
296
- class=${isSelected() ? 'selected' : nothing}
278
+ class=${isSelected() ? 'selected' : ''}
297
279
  >
298
280
  ${displayName}
299
281
  </a>
300
- `;
301
- }
302
- getSortDropdown(options) {
303
- var _a, _b, _c, _d, _e;
304
- return html `
305
- <ia-dropdown
306
- id=${(_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : nothing}
307
- class=${((_b = options === null || options === void 0 ? void 0 : options.isSelected) === null || _b === void 0 ? void 0 : _b.call(options)) ? 'selected' : nothing}
308
- displayCaret
309
- closeOnSelect
310
- includeSelectedOption
311
- .openViaButton=${false}
312
- .options=${options === null || options === void 0 ? void 0 : options.dropdownOptions}
313
- .selectedOption=${options === null || options === void 0 ? void 0 : options.selectedOption}
314
- @optionSelected=${(_c = options === null || options === void 0 ? void 0 : options.optionSelectedHandler) !== null && _c !== void 0 ? _c : nothing}
315
- @click=${(_d = options === null || options === void 0 ? void 0 : options.clickHandler) !== null && _d !== void 0 ? _d : nothing}
316
- >
317
- <span class="dropdown-label" slot="dropdown-label">
318
- ${(_e = options === null || options === void 0 ? void 0 : options.displayName) !== null && _e !== void 0 ? _e : ''}
319
- </span>
320
- </ia-dropdown>
321
- `;
322
- }
323
- getDropdownOption(sortField) {
324
- return {
325
- id: sortField,
326
- selectedHandler: () => {
327
- this.selectDropdownSortField(sortField);
328
- },
329
- label: html `
330
- <span class="dropdown-option-label">
331
- ${SortFieldDisplayName[sortField]}
332
- </span>
333
- `,
334
- };
335
- }
336
- get mobileSortSelectorTemplate() {
282
+ `;
283
+ }
284
+ get mobileSortSelectorTemplate() {
337
285
  return html `
338
- <div
339
- id="mobile-sort-container"
286
+ <select
287
+ id="mobile-sort-selector"
288
+ @change=${this.mobileSortChanged}
340
289
  class=${this.mobileSelectorVisible ? 'visible' : 'hidden'}
341
290
  >
342
- <span id="sort-by-text">Sort by</span>
343
- <div id="sort-direction-container">
344
- ${this.sortDirectionSelectorTemplate}
345
- </div>
346
- <select id="mobile-sort-selector" @change=${this.mobileSortChanged}>
347
- ${Object.keys(SortField).map(field => html `
348
- <option value="${field}" ?selected=${this.selectedSort === field}>
349
- ${SortFieldDisplayName[field]}
350
- </option>
351
- `)}
352
- </select>
353
- </div>
354
- `;
355
- }
356
- mobileSortChanged(e) {
357
- const target = e.target;
358
- const sortField = target.value;
359
- this.setSelectedSort(sortField);
360
- this.alphaSelectorVisible = null;
361
- if (sortField !== 'title' && this.selectedTitleFilter) {
362
- this.selectedTitleFilter = null;
363
- this.emitTitleLetterChangedEvent();
364
- }
365
- if (sortField !== 'creator' && this.selectedCreatorFilter) {
366
- this.selectedCreatorFilter = null;
367
- this.emitCreatorLetterChangedEvent();
368
- }
369
- }
370
- get displayOptionTemplate() {
291
+ ${Object.keys(SortField).map(field => html `
292
+ <option value="${field}" ?selected=${this.selectedSort === field}>
293
+ ${SortFieldDisplayName[field]}
294
+ </option>
295
+ `)}
296
+ </select>
297
+ `;
298
+ }
299
+ mobileSortChanged(e) {
300
+ const target = e.target;
301
+ const sortField = target.value;
302
+ this.setSelectedSort(sortField);
303
+ this.alphaSelectorVisible = null;
304
+ if (sortField !== 'title' && this.selectedTitleFilter) {
305
+ this.selectedTitleFilter = null;
306
+ this.emitTitleLetterChangedEvent();
307
+ }
308
+ if (sortField !== 'creator' && this.selectedCreatorFilter) {
309
+ this.selectedCreatorFilter = null;
310
+ this.emitCreatorLetterChangedEvent();
311
+ }
312
+ }
313
+ get displayOptionTemplate() {
371
314
  return html `
372
315
  <ul>
373
316
  <li>
374
317
  <button
375
318
  id="grid-button"
376
- @click=${() => {
377
- this.displayMode = 'grid';
319
+ @click=${() => {
320
+ this.displayMode = 'grid';
378
321
  }}
379
322
  class=${this.displayMode === 'grid' ? 'active' : ''}
380
323
  title="Tile view"
@@ -385,8 +328,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
385
328
  <li>
386
329
  <button
387
330
  id="list-detail-button"
388
- @click=${() => {
389
- this.displayMode = 'list-detail';
331
+ @click=${() => {
332
+ this.displayMode = 'list-detail';
390
333
  }}
391
334
  class=${this.displayMode === 'list-detail' ? 'active' : ''}
392
335
  title="List view"
@@ -397,8 +340,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
397
340
  <li>
398
341
  <button
399
342
  id="list-compact-button"
400
- @click=${() => {
401
- this.displayMode = 'list-compact';
343
+ @click=${() => {
344
+ this.displayMode = 'list-compact';
402
345
  }}
403
346
  class=${this.displayMode === 'list-compact' ? 'active' : ''}
404
347
  title="Compact list view"
@@ -407,161 +350,195 @@ let SortFilterBar = class SortFilterBar extends LitElement {
407
350
  </button>
408
351
  </li>
409
352
  </ul>
410
- `;
411
- }
412
- get dropdownBackdrop() {
353
+ `;
354
+ }
355
+ get dateSortSelector() {
356
+ return html `
357
+ <div
358
+ id="date-sort-selector-backdrop"
359
+ @keyup=${() => {
360
+ this.dateSortSelectorVisible = false;
361
+ }}
362
+ @click=${() => {
363
+ this.dateSortSelectorVisible = false;
364
+ }}
365
+ ></div>
366
+ <div id="date-sort-selector">
367
+ <ul>
368
+ <li>${this.getDateSortButton(SortField.datearchived)}</li>
369
+ <li>${this.getDateSortButton(SortField.date)}</li>
370
+ <li>${this.getDateSortButton(SortField.datereviewed)}</li>
371
+ <li>${this.getDateSortButton(SortField.dateadded)}</li>
372
+ </ul>
373
+ </div>
374
+ `;
375
+ }
376
+ get viewSortSelector() {
413
377
  return html `
414
378
  <div
415
- id="sort-selector-backdrop"
416
- @keyup=${this.closeDropdowns}
417
- @click=${this.closeDropdowns}
379
+ id="view-sort-selector-backdrop"
380
+ @keyup=${() => {
381
+ this.viewSortSelectorVisible = false;
382
+ }}
383
+ @click=${() => {
384
+ this.viewSortSelectorVisible = false;
385
+ }}
418
386
  ></div>
419
- `;
420
- }
421
- closeDropdowns() {
422
- this.viewsDropdown.open = false;
423
- this.dateDropdown.open = false;
424
- this.viewSortSelectorVisible = false;
425
- this.dateSortSelectorVisible = false;
426
- }
427
- selectDropdownSortField(sortField) {
428
- this.dateSortSelectorVisible = false;
429
- this.viewSortSelectorVisible = false;
430
- this.setSelectedSort(sortField);
431
- }
432
- setSortDirection(sortDirection) {
433
- this.sortDirection = sortDirection;
434
- this.emitSortChangedEvent();
435
- }
436
- toggleSortDirection() {
437
- this.setSortDirection(this.sortDirection === 'desc' ? 'asc' : 'desc');
438
- }
439
- setSelectedSort(sort) {
440
- this.selectedSort = sort;
441
- this.emitSortChangedEvent();
442
- }
443
- /**
444
- * There are four date sort options.
445
- *
446
- * This checks to see if the current sort is one of them.
447
- *
448
- * @readonly
449
- * @private
450
- * @type {boolean}
451
- * @memberof SortFilterBar
452
- */
453
- get dateOptionSelected() {
454
- const dateSortFields = [
455
- SortField.datearchived,
456
- SortField.date,
457
- SortField.datereviewed,
458
- SortField.dateadded,
459
- ];
460
- return dateSortFields.includes(this.selectedSort);
461
- }
462
- /**
463
- * There are two view sort options.
464
- *
465
- * This checks to see if the current sort is one of them.
466
- *
467
- * @readonly
468
- * @private
469
- * @type {boolean}
470
- * @memberof SortFilterBar
471
- */
472
- get viewOptionSelected() {
473
- const viewSortFields = [
474
- SortField.alltimeview,
475
- SortField.weeklyview,
476
- ];
477
- return viewSortFields.includes(this.selectedSort);
478
- }
479
- /**
480
- * The display name of the current date field
481
- *
482
- * @readonly
483
- * @private
484
- * @type {string}
485
- * @memberof SortFilterBar
486
- */
487
- get dateSortField() {
488
- var _a;
489
- const defaultSort = SortFieldDisplayName[SortField.date];
490
- const name = this.dateOptionSelected
491
- ? (_a = SortFieldDisplayName[this.selectedSort]) !== null && _a !== void 0 ? _a : defaultSort
492
- : defaultSort;
493
- return name;
494
- }
495
- /**
496
- * The display name of the current view field
497
- *
498
- * @readonly
499
- * @private
500
- * @type {string}
501
- * @memberof SortFilterBar
502
- */
503
- get viewSortField() {
504
- var _a;
505
- const defaultSort = SortFieldDisplayName[SortField.weeklyview];
506
- const name = this.viewOptionSelected
507
- ? (_a = SortFieldDisplayName[this.selectedSort]) !== null && _a !== void 0 ? _a : defaultSort
508
- : defaultSort;
509
- return name;
510
- }
511
- get titleSelectorBar() {
512
- var _a;
387
+ <div id="view-sort-selector">
388
+ <ul>
389
+ <li>${this.getDateSortButton(SortField.alltimeview)}</li>
390
+ <li>${this.getDateSortButton(SortField.weeklyview)}</li>
391
+ </ul>
392
+ </div>
393
+ `;
394
+ }
395
+ getDateSortButton(sortField) {
396
+ return html `
397
+ <button
398
+ @click=${() => {
399
+ this.selectDateSort(sortField);
400
+ }}
401
+ class=${this.selectedSort === sortField ? 'selected' : ''}
402
+ >
403
+ ${SortFieldDisplayName[sortField]}
404
+ </button>
405
+ `;
406
+ }
407
+ selectDateSort(sortField) {
408
+ this.dateSortSelectorVisible = false;
409
+ this.viewSortSelectorVisible = false;
410
+ this.setSelectedSort(sortField);
411
+ }
412
+ setSortDirections(sortDirection) {
413
+ this.sortDirection = sortDirection;
414
+ this.emitSortChangedEvent();
415
+ }
416
+ setSelectedSort(sort) {
417
+ this.selectedSort = sort;
418
+ this.emitSortChangedEvent();
419
+ }
420
+ /**
421
+ * There are four date sort options.
422
+ *
423
+ * This checks to see if the current sort is one of them.
424
+ *
425
+ * @readonly
426
+ * @private
427
+ * @type {boolean}
428
+ * @memberof SortFilterBar
429
+ */
430
+ get dateOptionSelected() {
431
+ const dateSortFields = [
432
+ SortField.datearchived,
433
+ SortField.date,
434
+ SortField.datereviewed,
435
+ SortField.dateadded,
436
+ ];
437
+ return dateSortFields.includes(this.selectedSort);
438
+ }
439
+ /**
440
+ * There are two view sort options.
441
+ *
442
+ * This checks to see if the current sort is one of them.
443
+ *
444
+ * @readonly
445
+ * @private
446
+ * @type {boolean}
447
+ * @memberof SortFilterBar
448
+ */
449
+ get viewOptionSelected() {
450
+ const viewSortFields = [
451
+ SortField.alltimeview,
452
+ SortField.weeklyview,
453
+ ];
454
+ return viewSortFields.includes(this.selectedSort);
455
+ }
456
+ /**
457
+ * The display name of the current date field
458
+ *
459
+ * @readonly
460
+ * @private
461
+ * @type {string}
462
+ * @memberof SortFilterBar
463
+ */
464
+ get dateSortField() {
465
+ var _a;
466
+ const defaultSort = SortFieldDisplayName[SortField.date];
467
+ const name = this.dateOptionSelected
468
+ ? (_a = SortFieldDisplayName[this.selectedSort]) !== null && _a !== void 0 ? _a : defaultSort
469
+ : defaultSort;
470
+ return name;
471
+ }
472
+ /**
473
+ * The display name of the current view field
474
+ *
475
+ * @readonly
476
+ * @private
477
+ * @type {string}
478
+ * @memberof SortFilterBar
479
+ */
480
+ get viewSortField() {
481
+ var _a;
482
+ const defaultSort = SortFieldDisplayName[SortField.weeklyview];
483
+ const name = this.viewOptionSelected
484
+ ? (_a = SortFieldDisplayName[this.selectedSort]) !== null && _a !== void 0 ? _a : defaultSort
485
+ : defaultSort;
486
+ return name;
487
+ }
488
+ get titleSelectorBar() {
489
+ var _a;
513
490
  return html ` <alpha-bar
514
491
  .selectedLetter=${this.selectedTitleFilter}
515
492
  .letterCounts=${(_a = this.prefixFilterCountMap) === null || _a === void 0 ? void 0 : _a.title}
516
493
  @letterChanged=${this.titleLetterChanged}
517
- ></alpha-bar>`;
518
- }
519
- get creatorSelectorBar() {
520
- var _a;
494
+ ></alpha-bar>`;
495
+ }
496
+ get creatorSelectorBar() {
497
+ var _a;
521
498
  return html ` <alpha-bar
522
499
  .selectedLetter=${this.selectedCreatorFilter}
523
500
  .letterCounts=${(_a = this.prefixFilterCountMap) === null || _a === void 0 ? void 0 : _a.creator}
524
501
  @letterChanged=${this.creatorLetterChanged}
525
- ></alpha-bar>`;
526
- }
527
- titleLetterChanged(e) {
528
- var _a;
529
- this.selectedTitleFilter = (_a = e.detail.selectedLetter) !== null && _a !== void 0 ? _a : null;
530
- this.emitTitleLetterChangedEvent();
531
- }
532
- creatorLetterChanged(e) {
533
- var _a;
534
- this.selectedCreatorFilter = (_a = e.detail.selectedLetter) !== null && _a !== void 0 ? _a : null;
535
- this.emitCreatorLetterChangedEvent();
536
- }
537
- emitTitleLetterChangedEvent() {
538
- const event = new CustomEvent('titleLetterChanged', {
539
- detail: { selectedLetter: this.selectedTitleFilter },
540
- });
541
- this.dispatchEvent(event);
542
- }
543
- emitCreatorLetterChangedEvent() {
544
- const event = new CustomEvent('creatorLetterChanged', {
545
- detail: { selectedLetter: this.selectedCreatorFilter },
546
- });
547
- this.dispatchEvent(event);
548
- }
549
- displayModeChanged() {
550
- const event = new CustomEvent('displayModeChanged', {
551
- detail: { displayMode: this.displayMode },
552
- });
553
- this.dispatchEvent(event);
554
- }
555
- emitSortChangedEvent() {
556
- const event = new CustomEvent('sortChanged', {
557
- detail: {
558
- selectedSort: this.selectedSort,
559
- sortDirection: this.sortDirection,
560
- },
561
- });
562
- this.dispatchEvent(event);
563
- }
564
- };
502
+ ></alpha-bar>`;
503
+ }
504
+ titleLetterChanged(e) {
505
+ var _a;
506
+ this.selectedTitleFilter = (_a = e.detail.selectedLetter) !== null && _a !== void 0 ? _a : null;
507
+ this.emitTitleLetterChangedEvent();
508
+ }
509
+ creatorLetterChanged(e) {
510
+ var _a;
511
+ this.selectedCreatorFilter = (_a = e.detail.selectedLetter) !== null && _a !== void 0 ? _a : null;
512
+ this.emitCreatorLetterChangedEvent();
513
+ }
514
+ emitTitleLetterChangedEvent() {
515
+ const event = new CustomEvent('titleLetterChanged', {
516
+ detail: { selectedLetter: this.selectedTitleFilter },
517
+ });
518
+ this.dispatchEvent(event);
519
+ }
520
+ emitCreatorLetterChangedEvent() {
521
+ const event = new CustomEvent('creatorLetterChanged', {
522
+ detail: { selectedLetter: this.selectedCreatorFilter },
523
+ });
524
+ this.dispatchEvent(event);
525
+ }
526
+ displayModeChanged() {
527
+ const event = new CustomEvent('displayModeChanged', {
528
+ detail: { displayMode: this.displayMode },
529
+ });
530
+ this.dispatchEvent(event);
531
+ }
532
+ emitSortChangedEvent() {
533
+ const event = new CustomEvent('sortChanged', {
534
+ detail: {
535
+ selectedSort: this.selectedSort,
536
+ sortDirection: this.sortDirection,
537
+ },
538
+ });
539
+ this.dispatchEvent(event);
540
+ }
541
+ };
565
542
  SortFilterBar.styles = css `
566
543
  #container {
567
544
  position: relative;
@@ -570,8 +547,9 @@ SortFilterBar.styles = css `
570
547
  #sort-bar {
571
548
  display: flex;
572
549
  justify-content: space-between;
573
- border-bottom: 1px solid #2c2c2c;
550
+ border: 1px solid rgb(232, 232, 232);
574
551
  align-items: center;
552
+ padding: 0.5rem 1.5rem;
575
553
  }
576
554
 
577
555
  #sort-direction-container {
@@ -579,10 +557,14 @@ SortFilterBar.styles = css `
579
557
  }
580
558
 
581
559
  #sort-by-text {
582
- margin-right: 10px;
583
- font-size: 1.4rem;
584
- font-weight: bold;
585
- white-space: nowrap;
560
+ text-transform: uppercase;
561
+ }
562
+
563
+ #bottom-shadow {
564
+ height: 1px;
565
+ width: 100%;
566
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
567
+ background-color: #bbb;
586
568
  }
587
569
 
588
570
  ul {
@@ -597,28 +579,12 @@ SortFilterBar.styles = css `
597
579
  padding: 0;
598
580
  }
599
581
 
600
- #sort-direction-selector {
601
- display: flex;
602
- flex-direction: column;
603
- margin-right: 5px;
604
- padding: 0;
605
- border: none;
606
- appearance: none;
607
- background: transparent;
608
- cursor: pointer;
609
- }
610
-
611
- #sort-direction-selector:disabled {
612
- cursor: default;
613
- }
614
-
615
582
  .sort-button {
616
- display: flex;
617
- align-items: center;
618
583
  background: none;
619
584
  color: inherit;
620
585
  border: none;
621
586
  padding: 0;
587
+ cursor: pointer;
622
588
  outline: inherit;
623
589
  width: 12px;
624
590
  height: 12px;
@@ -629,8 +595,9 @@ SortFilterBar.styles = css `
629
595
  opacity: 1;
630
596
  }
631
597
 
632
- #sort-direction-selector:disabled .sort-button {
598
+ .sort-button:disabled {
633
599
  opacity: 0.25;
600
+ cursor: default;
634
601
  }
635
602
 
636
603
  #date-sort-selector,
@@ -681,45 +648,42 @@ SortFilterBar.styles = css `
681
648
  transform: rotate(180deg);
682
649
  }
683
650
 
684
- #sort-selector-container {
685
- flex: 1;
651
+ #sort-direction-selector {
686
652
  display: flex;
687
- justify-content: flex-start;
688
- align-items: center;
653
+ flex-direction: column;
654
+ gap: 3px;
655
+ margin-right: 1rem;
689
656
  }
690
657
 
691
- #desktop-sort-container,
692
- #mobile-sort-container {
693
- display: flex;
694
- justify-content: flex-start;
695
- align-items: center;
658
+ #sort-selector-container {
659
+ flex: 1;
696
660
  }
697
661
 
698
662
  /*
699
663
  we move the desktop sort selector offscreen instead of display: none
700
664
  because we need to observe the width of it vs its container to determine
701
- if it's wide enough to display the desktop version and if you display: none,
665
+ if it's wide enough to display the desktop version and if you displY: none,
702
666
  the width becomes 0
703
667
  */
704
- #desktop-sort-container.hidden {
668
+ #desktop-sort-selector.hidden {
705
669
  position: absolute;
706
670
  top: -9999px;
707
671
  left: -9999px;
708
- visibility: hidden;
709
672
  }
710
673
 
711
- #mobile-sort-container.hidden {
674
+ #mobile-sort-selector.hidden {
712
675
  display: none;
713
676
  }
714
677
 
715
- #sort-selector-backdrop {
678
+ #date-sort-selector-backdrop,
679
+ #view-sort-selector-backdrop {
716
680
  position: fixed;
717
681
  top: 0;
718
682
  left: 0;
719
- width: 100vw;
720
- height: 100vh;
683
+ width: 100%;
684
+ height: 100%;
721
685
  z-index: 1;
722
- background-color: transparent;
686
+ background-color: rgba(255, 255, 255, 0.5);
723
687
  }
724
688
 
725
689
  #desktop-sort-selector {
@@ -729,22 +693,30 @@ SortFilterBar.styles = css `
729
693
  #desktop-sort-selector li {
730
694
  display: flex;
731
695
  align-items: center;
732
- padding-left: 5px;
733
- padding-right: 5px;
734
696
  }
735
697
 
736
698
  #desktop-sort-selector li a {
737
- padding: 0 5px;
738
699
  text-decoration: none;
700
+ text-transform: uppercase;
739
701
  font-size: 1.4rem;
740
702
  color: #333;
741
- line-height: 2;
703
+ line-height: 2.5;
742
704
  }
743
705
 
744
706
  #desktop-sort-selector li a.selected {
745
707
  font-weight: bold;
746
708
  }
747
709
 
710
+ #desktop-sort-selector li::after {
711
+ content: '•';
712
+ padding-left: 1rem;
713
+ padding-right: 1rem;
714
+ }
715
+
716
+ #desktop-sort-selector li:first-child::after {
717
+ content: '';
718
+ }
719
+
748
720
  #desktop-sort-selector li:last-child::after {
749
721
  content: '';
750
722
  }
@@ -760,7 +732,7 @@ SortFilterBar.styles = css `
760
732
  appearance: none;
761
733
  cursor: pointer;
762
734
  -webkit-appearance: none;
763
- opacity: 0.3;
735
+ opacity: 0.5;
764
736
  }
765
737
 
766
738
  #display-style-selector button.active {
@@ -771,95 +743,57 @@ SortFilterBar.styles = css `
771
743
  width: 24px;
772
744
  height: 24px;
773
745
  }
774
-
775
- ia-dropdown {
776
- --dropdownTextColor: white;
777
- --dropdownFontSize: 1.4rem;
778
- --dropdownOffsetTop: 0;
779
- --dropdownBorderTopWidth: 0;
780
- --dropdownBorderTopLeftRadius: 0;
781
- --dropdownBorderTopRightRadius: 0;
782
- --dropdownWhiteSpace: nowrap;
783
- --dropdownListZIndex: 2;
784
- --dropdownCaretColor: #2c2c2c;
785
- --dropdownSelectedTextColor: white;
786
- --dropdownSelectedBgColor: #2c2c2c;
787
- --caretHeight: 9px;
788
- --caretWidth: 14px;
789
- }
790
- ia-dropdown.selected .dropdown-label {
791
- font-weight: bold;
792
- }
793
- ia-dropdown.open {
794
- z-index: 2;
795
- }
796
-
797
- .dropdown-label {
798
- display: inline-block;
799
- height: 100%;
800
- padding-left: 5px;
801
- font-size: 1.4rem;
802
- line-height: 2;
803
- color: #2c2c2c;
804
- white-space: nowrap;
805
- }
806
- `;
807
- __decorate([
808
- property({ type: String })
809
- ], SortFilterBar.prototype, "displayMode", void 0);
810
- __decorate([
811
- property({ type: String })
812
- ], SortFilterBar.prototype, "sortDirection", void 0);
813
- __decorate([
814
- property({ type: String })
815
- ], SortFilterBar.prototype, "selectedSort", void 0);
816
- __decorate([
817
- property({ type: String })
818
- ], SortFilterBar.prototype, "selectedTitleFilter", void 0);
819
- __decorate([
820
- property({ type: String })
821
- ], SortFilterBar.prototype, "selectedCreatorFilter", void 0);
822
- __decorate([
823
- property({ type: Boolean })
824
- ], SortFilterBar.prototype, "showRelevance", void 0);
825
- __decorate([
826
- property({ type: Object })
827
- ], SortFilterBar.prototype, "prefixFilterCountMap", void 0);
828
- __decorate([
829
- property({ type: Object })
830
- ], SortFilterBar.prototype, "resizeObserver", void 0);
831
- __decorate([
832
- state()
833
- ], SortFilterBar.prototype, "alphaSelectorVisible", void 0);
834
- __decorate([
835
- state()
836
- ], SortFilterBar.prototype, "dateSortSelectorVisible", void 0);
837
- __decorate([
838
- state()
839
- ], SortFilterBar.prototype, "viewSortSelectorVisible", void 0);
840
- __decorate([
841
- state()
842
- ], SortFilterBar.prototype, "desktopSortContainerWidth", void 0);
843
- __decorate([
844
- state()
845
- ], SortFilterBar.prototype, "selectorBarContainerWidth", void 0);
846
- __decorate([
847
- state()
848
- ], SortFilterBar.prototype, "hoveringOverDateSortOptions", void 0);
849
- __decorate([
850
- query('#desktop-sort-container')
851
- ], SortFilterBar.prototype, "desktopSortContainer", void 0);
852
- __decorate([
853
- query('#sort-selector-container')
854
- ], SortFilterBar.prototype, "sortSelectorContainer", void 0);
855
- __decorate([
856
- query('#views-dropdown')
857
- ], SortFilterBar.prototype, "viewsDropdown", void 0);
858
- __decorate([
859
- query('#date-dropdown')
860
- ], SortFilterBar.prototype, "dateDropdown", void 0);
861
- SortFilterBar = __decorate([
862
- customElement('sort-filter-bar')
863
- ], SortFilterBar);
864
- export { SortFilterBar };
746
+ `;
747
+ __decorate([
748
+ property({ type: String })
749
+ ], SortFilterBar.prototype, "displayMode", void 0);
750
+ __decorate([
751
+ property({ type: String })
752
+ ], SortFilterBar.prototype, "sortDirection", void 0);
753
+ __decorate([
754
+ property({ type: String })
755
+ ], SortFilterBar.prototype, "selectedSort", void 0);
756
+ __decorate([
757
+ property({ type: String })
758
+ ], SortFilterBar.prototype, "selectedTitleFilter", void 0);
759
+ __decorate([
760
+ property({ type: String })
761
+ ], SortFilterBar.prototype, "selectedCreatorFilter", void 0);
762
+ __decorate([
763
+ property({ type: Boolean })
764
+ ], SortFilterBar.prototype, "showRelevance", void 0);
765
+ __decorate([
766
+ property({ type: Object })
767
+ ], SortFilterBar.prototype, "prefixFilterCountMap", void 0);
768
+ __decorate([
769
+ property({ type: Object })
770
+ ], SortFilterBar.prototype, "resizeObserver", void 0);
771
+ __decorate([
772
+ state()
773
+ ], SortFilterBar.prototype, "alphaSelectorVisible", void 0);
774
+ __decorate([
775
+ state()
776
+ ], SortFilterBar.prototype, "dateSortSelectorVisible", void 0);
777
+ __decorate([
778
+ state()
779
+ ], SortFilterBar.prototype, "viewSortSelectorVisible", void 0);
780
+ __decorate([
781
+ state()
782
+ ], SortFilterBar.prototype, "desktopSelectorBarWidth", void 0);
783
+ __decorate([
784
+ state()
785
+ ], SortFilterBar.prototype, "selectorBarContainerWidth", void 0);
786
+ __decorate([
787
+ state()
788
+ ], SortFilterBar.prototype, "hoveringOverDateSortOptions", void 0);
789
+ __decorate([
790
+ query('#desktop-sort-selector')
791
+ ], SortFilterBar.prototype, "desktopSortSelector", void 0);
792
+ __decorate([
793
+ query('#sort-selector-container')
794
+ ], SortFilterBar.prototype, "sortSelectorContainer", void 0);
795
+ SortFilterBar = __decorate([
796
+ customElement('sort-filter-bar')
797
+ ], SortFilterBar);
798
+ export { SortFilterBar };
865
799
  //# sourceMappingURL=sort-filter-bar.js.map