@internetarchive/collection-browser 0.4.9 → 0.4.10-alpha.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 (243) 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 +280 -281
  68. package/dist/src/collection-browser.js +1173 -1202
  69. package/dist/src/collection-browser.js.map +1 -1
  70. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  71. package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
  72. package/dist/src/collection-facets/facets-template.d.ts +16 -16
  73. package/dist/src/collection-facets/facets-template.js +125 -125
  74. package/dist/src/collection-facets/more-facets-content.d.ts +75 -77
  75. package/dist/src/collection-facets/more-facets-content.js +340 -357
  76. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  77. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  78. package/dist/src/collection-facets/more-facets-pagination.js +192 -192
  79. package/dist/src/collection-facets.d.ts +81 -83
  80. package/dist/src/collection-facets.js +375 -393
  81. package/dist/src/collection-facets.js.map +1 -1
  82. package/dist/src/empty-placeholder.d.ts +11 -11
  83. package/dist/src/empty-placeholder.js +42 -42
  84. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  85. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  86. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  87. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  88. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  89. package/dist/src/mediatype/mediatype-config.js +85 -85
  90. package/dist/src/models.d.ts +115 -115
  91. package/dist/src/models.js +125 -125
  92. package/dist/src/models.js.map +1 -1
  93. package/dist/src/restoration-state-handler.d.ts +45 -45
  94. package/dist/src/restoration-state-handler.js +230 -230
  95. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
  96. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
  97. package/dist/src/sort-filter-bar/alpha-bar.d.ts +20 -20
  98. package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
  99. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  100. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  101. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  102. package/dist/src/sort-filter-bar/img/list.js +2 -2
  103. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  104. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  105. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  106. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  107. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +113 -108
  108. package/dist/src/sort-filter-bar/sort-filter-bar.js +614 -548
  109. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  110. package/dist/src/styles/item-image-styles.d.ts +8 -8
  111. package/dist/src/styles/item-image-styles.js +9 -9
  112. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  113. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  114. package/dist/src/tiles/grid/account-tile.d.ts +20 -20
  115. package/dist/src/tiles/grid/account-tile.js +64 -64
  116. package/dist/src/tiles/grid/collection-tile.d.ts +17 -17
  117. package/dist/src/tiles/grid/collection-tile.js +71 -71
  118. package/dist/src/tiles/grid/item-tile.d.ts +32 -32
  119. package/dist/src/tiles/grid/item-tile.js +129 -126
  120. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  121. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
  122. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +7 -7
  123. package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
  124. package/dist/src/tiles/grid/tile-stats.js +40 -40
  125. package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
  126. package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
  127. package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
  128. package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
  129. package/dist/src/tiles/image-block.d.ts +17 -17
  130. package/dist/src/tiles/image-block.js +72 -72
  131. package/dist/src/tiles/item-image.d.ts +35 -35
  132. package/dist/src/tiles/item-image.js +117 -117
  133. package/dist/src/tiles/list/account-label.d.ts +1 -1
  134. package/dist/src/tiles/list/account-label.js +6 -6
  135. package/dist/src/tiles/list/date-label.d.ts +1 -1
  136. package/dist/src/tiles/list/date-label.js +12 -12
  137. package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
  138. package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
  139. package/dist/src/tiles/list/tile-list-compact.d.ts +21 -21
  140. package/dist/src/tiles/list/tile-list-compact.js +99 -99
  141. package/dist/src/tiles/list/tile-list.d.ts +55 -55
  142. package/dist/src/tiles/list/tile-list.js +301 -301
  143. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  144. package/dist/src/tiles/mediatype-icon.js +47 -47
  145. package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
  146. package/dist/src/tiles/overlay/icon-overlay.js +40 -40
  147. package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
  148. package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
  149. package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
  150. package/dist/src/tiles/overlay/text-overlay.js +42 -42
  151. package/dist/src/tiles/text-snippet-block.d.ts +27 -27
  152. package/dist/src/tiles/text-snippet-block.js +73 -73
  153. package/dist/src/tiles/tile-dispatcher.d.ts +58 -58
  154. package/dist/src/tiles/tile-dispatcher.js +194 -194
  155. package/dist/src/utils/analytics-events.d.ts +22 -22
  156. package/dist/src/utils/analytics-events.js +24 -24
  157. package/dist/src/utils/format-count.d.ts +7 -7
  158. package/dist/src/utils/format-count.js +76 -76
  159. package/dist/src/utils/format-date.d.ts +2 -2
  160. package/dist/src/utils/format-date.js +23 -23
  161. package/dist/src/utils/format-unit-size.d.ts +2 -2
  162. package/dist/src/utils/format-unit-size.js +33 -33
  163. package/dist/test/collection-browser.test.d.ts +1 -1
  164. package/dist/test/collection-browser.test.js +584 -584
  165. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  166. package/dist/test/collection-facets/facets-template.test.js +62 -62
  167. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  168. package/dist/test/collection-facets/more-facets-content.test.js +114 -114
  169. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  170. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  171. package/dist/test/collection-facets.test.d.ts +2 -2
  172. package/dist/test/collection-facets.test.js +460 -508
  173. package/dist/test/collection-facets.test.js.map +1 -1
  174. package/dist/test/empty-placeholder.test.d.ts +1 -1
  175. package/dist/test/empty-placeholder.test.js +33 -33
  176. package/dist/test/icon-overlay.test.d.ts +1 -1
  177. package/dist/test/icon-overlay.test.js +24 -24
  178. package/dist/test/image-block.test.d.ts +1 -1
  179. package/dist/test/image-block.test.js +48 -48
  180. package/dist/test/item-image.test.d.ts +1 -1
  181. package/dist/test/item-image.test.js +84 -84
  182. package/dist/test/mediatype-config.test.d.ts +1 -1
  183. package/dist/test/mediatype-config.test.js +16 -16
  184. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  185. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  186. package/dist/test/mocks/mock-collection-name-cache.d.ts +7 -7
  187. package/dist/test/mocks/mock-collection-name-cache.js +13 -13
  188. package/dist/test/mocks/mock-search-responses.d.ts +12 -12
  189. package/dist/test/mocks/mock-search-responses.js +341 -341
  190. package/dist/test/mocks/mock-search-service.d.ts +13 -13
  191. package/dist/test/mocks/mock-search-service.js +40 -40
  192. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  193. package/dist/test/restoration-state-handler.test.js +125 -125
  194. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
  195. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
  196. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
  197. package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
  198. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  199. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +208 -197
  200. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  201. package/dist/test/text-overlay.test.d.ts +1 -1
  202. package/dist/test/text-overlay.test.js +48 -48
  203. package/dist/test/text-snippet-block.test.d.ts +1 -1
  204. package/dist/test/text-snippet-block.test.js +57 -57
  205. package/dist/test/tile-stats.test.d.ts +1 -1
  206. package/dist/test/tile-stats.test.js +33 -33
  207. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
  208. package/dist/test/tiles/grid/account-tile.test.js +76 -76
  209. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
  210. package/dist/test/tiles/grid/collection-tile.test.js +73 -73
  211. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  212. package/dist/test/tiles/grid/item-tile.test.js +158 -158
  213. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
  214. package/dist/test/tiles/hover/hover-pane-controller.test.js +257 -257
  215. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
  216. package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
  217. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  218. package/dist/test/tiles/list/tile-list-compact.test.js +92 -92
  219. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  220. package/dist/test/tiles/list/tile-list.test.js +163 -163
  221. package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
  222. package/dist/test/tiles/tile-dispatcher.test.js +67 -67
  223. package/dist/test/utils/format-count.test.d.ts +1 -1
  224. package/dist/test/utils/format-count.test.js +23 -23
  225. package/dist/test/utils/format-date.test.d.ts +1 -1
  226. package/dist/test/utils/format-date.test.js +17 -17
  227. package/dist/test/utils/format-unit-size.test.d.ts +1 -1
  228. package/dist/test/utils/format-unit-size.test.js +17 -17
  229. package/local.archive.org.cert +86 -86
  230. package/local.archive.org.key +27 -27
  231. package/package.json +4 -3
  232. package/renovate.json +6 -6
  233. package/src/collection-browser.ts +1 -34
  234. package/src/collection-facets/more-facets-content.ts +2 -22
  235. package/src/collection-facets.ts +1 -24
  236. package/src/models.ts +6 -6
  237. package/src/sort-filter-bar/sort-filter-bar.ts +283 -197
  238. package/src/tiles/grid/item-tile.ts +5 -1
  239. package/test/collection-facets.test.ts +0 -67
  240. package/test/sort-filter-bar/sort-filter-bar.test.ts +56 -39
  241. package/tsconfig.json +21 -21
  242. package/web-dev-server.config.mjs +30 -30
  243. package/web-test-runner.config.mjs +41 -41
@@ -1,41 +1,38 @@
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() {
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() {
32
33
  return html `
33
34
  <div id="container">
34
35
  <div id="sort-bar">
35
- <div id="sort-direction-container">
36
- ${this.sortDirectionSelectorTemplate}
37
- </div>
38
-
39
36
  <div id="sort-selector-container">
40
37
  ${this.mobileSortSelectorTemplate}
41
38
  ${this.desktopSortSelectorTemplate}
@@ -44,280 +41,340 @@ let SortFilterBar = class SortFilterBar extends LitElement {
44
41
  <div id="display-style-selector">${this.displayOptionTemplate}</div>
45
42
  </div>
46
43
 
47
- ${this.viewSortSelectorVisible && !this.mobileSelectorVisible
48
- ? this.viewSortSelector
44
+ ${this.viewSortSelectorVisible && !this.mobileSelectorVisible
45
+ ? this.dropdownBackdrop
49
46
  : nothing}
50
- ${this.dateSortSelectorVisible && !this.mobileSelectorVisible
51
- ? this.dateSortSelector
47
+ ${this.dateSortSelectorVisible && !this.mobileSelectorVisible
48
+ ? this.dropdownBackdrop
52
49
  : nothing}
53
50
  ${this.alphaBarTemplate}
54
-
55
- <div id="bottom-shadow"></div>
56
51
  </div>
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() {
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() {
146
141
  return html `
147
- <div id="sort-direction-selector">
148
- <button
142
+ <button
143
+ id="sort-direction-selector"
144
+ ?disabled=${this.selectedSort === 'relevance'}
145
+ @click=${this.toggleSortDirection}
146
+ >
147
+ <div
149
148
  id="sort-ascending-btn"
150
149
  class="sort-button ${this.sortDirection === 'asc' ? 'selected' : ''}"
151
- ?disabled=${this.selectedSort === 'relevance'}
152
- @click=${() => {
153
- this.setSortDirections('asc');
154
- }}
155
150
  >
156
151
  ${sortIcon}
157
- </button>
158
- <button
152
+ </div>
153
+ <div
159
154
  id="sort-descending-btn"
160
155
  class="sort-button ${this.sortDirection === 'desc' ? 'selected' : ''}"
161
- ?disabled=${this.selectedSort === 'relevance'}
162
- @click=${() => {
163
- this.setSortDirections('desc');
164
- }}
165
156
  >
166
157
  ${sortIcon}
167
- </button>
168
- </div>
169
- `;
170
- }
171
- get desktopSortSelectorTemplate() {
158
+ </div>
159
+ </button>
160
+ `;
161
+ }
162
+ get desktopSortSelectorTemplate() {
172
163
  return html `
173
- <ul
174
- id="desktop-sort-selector"
164
+ <div
165
+ id="desktop-sort-container"
175
166
  class=${this.mobileSelectorVisible ? 'hidden' : 'visible'}
176
167
  >
177
- <li id="sort-by-text">Sort By</li>
178
- <li>
179
- ${this.showRelevance
180
- ? this.getSortDisplayOption(SortField.relevance)
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)
181
176
  : nothing}
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,
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 : '',
198
203
  })}
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
- },
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
+ },
210
215
  })}
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,
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 : '',
227
244
  })}
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
- },
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
+ },
238
255
  })}
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];
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];
260
278
  return html `
261
279
  <a
262
280
  href="#"
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
- }
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
+ }
277
295
  }}
278
- class=${isSelected() ? 'selected' : ''}
296
+ class=${isSelected() ? 'selected' : nothing}
279
297
  >
280
298
  ${displayName}
281
299
  </a>
282
- `;
283
- }
284
- get mobileSortSelectorTemplate() {
300
+ `;
301
+ }
302
+ getSortDropdown(options) {
303
+ var _a, _b, _c, _d, _e;
285
304
  return html `
286
- <select
287
- id="mobile-sort-selector"
288
- @change=${this.mobileSortChanged}
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() {
337
+ return html `
338
+ <div
339
+ id="mobile-sort-container"
289
340
  class=${this.mobileSelectorVisible ? 'visible' : 'hidden'}
290
341
  >
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() {
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() {
314
371
  return html `
315
372
  <ul>
316
373
  <li>
317
374
  <button
318
375
  id="grid-button"
319
- @click=${() => {
320
- this.displayMode = 'grid';
376
+ @click=${() => {
377
+ this.displayMode = 'grid';
321
378
  }}
322
379
  class=${this.displayMode === 'grid' ? 'active' : ''}
323
380
  title="Tile view"
@@ -328,8 +385,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
328
385
  <li>
329
386
  <button
330
387
  id="list-detail-button"
331
- @click=${() => {
332
- this.displayMode = 'list-detail';
388
+ @click=${() => {
389
+ this.displayMode = 'list-detail';
333
390
  }}
334
391
  class=${this.displayMode === 'list-detail' ? 'active' : ''}
335
392
  title="List view"
@@ -340,8 +397,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
340
397
  <li>
341
398
  <button
342
399
  id="list-compact-button"
343
- @click=${() => {
344
- this.displayMode = 'list-compact';
400
+ @click=${() => {
401
+ this.displayMode = 'list-compact';
345
402
  }}
346
403
  class=${this.displayMode === 'list-compact' ? 'active' : ''}
347
404
  title="Compact list view"
@@ -350,195 +407,161 @@ let SortFilterBar = class SortFilterBar extends LitElement {
350
407
  </button>
351
408
  </li>
352
409
  </ul>
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() {
410
+ `;
411
+ }
412
+ get dropdownBackdrop() {
377
413
  return html `
378
414
  <div
379
- id="view-sort-selector-backdrop"
380
- @keyup=${() => {
381
- this.viewSortSelectorVisible = false;
382
- }}
383
- @click=${() => {
384
- this.viewSortSelectorVisible = false;
385
- }}
415
+ id="sort-selector-backdrop"
416
+ @keyup=${this.closeDropdowns}
417
+ @click=${this.closeDropdowns}
386
418
  ></div>
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;
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;
490
513
  return html ` <alpha-bar
491
514
  .selectedLetter=${this.selectedTitleFilter}
492
515
  .letterCounts=${(_a = this.prefixFilterCountMap) === null || _a === void 0 ? void 0 : _a.title}
493
516
  @letterChanged=${this.titleLetterChanged}
494
- ></alpha-bar>`;
495
- }
496
- get creatorSelectorBar() {
497
- var _a;
517
+ ></alpha-bar>`;
518
+ }
519
+ get creatorSelectorBar() {
520
+ var _a;
498
521
  return html ` <alpha-bar
499
522
  .selectedLetter=${this.selectedCreatorFilter}
500
523
  .letterCounts=${(_a = this.prefixFilterCountMap) === null || _a === void 0 ? void 0 : _a.creator}
501
524
  @letterChanged=${this.creatorLetterChanged}
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
- };
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
+ };
542
565
  SortFilterBar.styles = css `
543
566
  #container {
544
567
  position: relative;
@@ -547,9 +570,8 @@ SortFilterBar.styles = css `
547
570
  #sort-bar {
548
571
  display: flex;
549
572
  justify-content: space-between;
550
- border: 1px solid rgb(232, 232, 232);
573
+ border-bottom: 1px solid #2c2c2c;
551
574
  align-items: center;
552
- padding: 0.5rem 1.5rem;
553
575
  }
554
576
 
555
577
  #sort-direction-container {
@@ -557,14 +579,10 @@ SortFilterBar.styles = css `
557
579
  }
558
580
 
559
581
  #sort-by-text {
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;
582
+ margin-right: 10px;
583
+ font-size: 1.4rem;
584
+ font-weight: bold;
585
+ white-space: nowrap;
568
586
  }
569
587
 
570
588
  ul {
@@ -579,12 +597,28 @@ SortFilterBar.styles = css `
579
597
  padding: 0;
580
598
  }
581
599
 
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
+
582
615
  .sort-button {
616
+ display: flex;
617
+ align-items: center;
583
618
  background: none;
584
619
  color: inherit;
585
620
  border: none;
586
621
  padding: 0;
587
- cursor: pointer;
588
622
  outline: inherit;
589
623
  width: 12px;
590
624
  height: 12px;
@@ -595,9 +629,8 @@ SortFilterBar.styles = css `
595
629
  opacity: 1;
596
630
  }
597
631
 
598
- .sort-button:disabled {
632
+ #sort-direction-selector:disabled .sort-button {
599
633
  opacity: 0.25;
600
- cursor: default;
601
634
  }
602
635
 
603
636
  #date-sort-selector,
@@ -648,42 +681,45 @@ SortFilterBar.styles = css `
648
681
  transform: rotate(180deg);
649
682
  }
650
683
 
651
- #sort-direction-selector {
684
+ #sort-selector-container {
685
+ flex: 1;
652
686
  display: flex;
653
- flex-direction: column;
654
- gap: 3px;
655
- margin-right: 1rem;
687
+ justify-content: flex-start;
688
+ align-items: center;
656
689
  }
657
690
 
658
- #sort-selector-container {
659
- flex: 1;
691
+ #desktop-sort-container,
692
+ #mobile-sort-container {
693
+ display: flex;
694
+ justify-content: flex-start;
695
+ align-items: center;
660
696
  }
661
697
 
662
698
  /*
663
699
  we move the desktop sort selector offscreen instead of display: none
664
700
  because we need to observe the width of it vs its container to determine
665
- if it's wide enough to display the desktop version and if you displY: none,
701
+ if it's wide enough to display the desktop version and if you display: none,
666
702
  the width becomes 0
667
703
  */
668
- #desktop-sort-selector.hidden {
704
+ #desktop-sort-container.hidden {
669
705
  position: absolute;
670
706
  top: -9999px;
671
707
  left: -9999px;
708
+ visibility: hidden;
672
709
  }
673
710
 
674
- #mobile-sort-selector.hidden {
711
+ #mobile-sort-container.hidden {
675
712
  display: none;
676
713
  }
677
714
 
678
- #date-sort-selector-backdrop,
679
- #view-sort-selector-backdrop {
715
+ #sort-selector-backdrop {
680
716
  position: fixed;
681
717
  top: 0;
682
718
  left: 0;
683
- width: 100%;
684
- height: 100%;
719
+ width: 100vw;
720
+ height: 100vh;
685
721
  z-index: 1;
686
- background-color: rgba(255, 255, 255, 0.5);
722
+ background-color: transparent;
687
723
  }
688
724
 
689
725
  #desktop-sort-selector {
@@ -693,30 +729,22 @@ SortFilterBar.styles = css `
693
729
  #desktop-sort-selector li {
694
730
  display: flex;
695
731
  align-items: center;
732
+ padding-left: 5px;
733
+ padding-right: 5px;
696
734
  }
697
735
 
698
736
  #desktop-sort-selector li a {
737
+ padding: 0 5px;
699
738
  text-decoration: none;
700
- text-transform: uppercase;
701
739
  font-size: 1.4rem;
702
740
  color: #333;
703
- line-height: 2.5;
741
+ line-height: 2;
704
742
  }
705
743
 
706
744
  #desktop-sort-selector li a.selected {
707
745
  font-weight: bold;
708
746
  }
709
747
 
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
-
720
748
  #desktop-sort-selector li:last-child::after {
721
749
  content: '';
722
750
  }
@@ -732,7 +760,7 @@ SortFilterBar.styles = css `
732
760
  appearance: none;
733
761
  cursor: pointer;
734
762
  -webkit-appearance: none;
735
- opacity: 0.5;
763
+ opacity: 0.3;
736
764
  }
737
765
 
738
766
  #display-style-selector button.active {
@@ -743,57 +771,95 @@ SortFilterBar.styles = css `
743
771
  width: 24px;
744
772
  height: 24px;
745
773
  }
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 };
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 };
799
865
  //# sourceMappingURL=sort-filter-bar.js.map