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