@internetarchive/collection-browser 4.1.0-alpha-webdev8186.0 → 4.1.0-alpha-webdev8186.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.
|
@@ -428,6 +428,7 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
428
428
|
this.dispatchEvent(event);
|
|
429
429
|
}
|
|
430
430
|
static get styles() {
|
|
431
|
+
const disabledIconColor = css `#bbbbbb`;
|
|
431
432
|
return [
|
|
432
433
|
srOnlyStyle,
|
|
433
434
|
css `
|
|
@@ -472,14 +473,14 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
472
473
|
display: flex;
|
|
473
474
|
align-self: stretch;
|
|
474
475
|
flex: 0;
|
|
475
|
-
margin: 0
|
|
476
|
+
margin: 0 3px;
|
|
476
477
|
}
|
|
477
478
|
|
|
478
479
|
.sort-direction-selector {
|
|
479
480
|
display: flex;
|
|
480
481
|
justify-content: center;
|
|
481
482
|
width: 30px;
|
|
482
|
-
margin: 0 5px 0
|
|
483
|
+
margin: 0 5px 0 0;
|
|
483
484
|
padding: 7px 8px;
|
|
484
485
|
max-height: fit-content;
|
|
485
486
|
border-radius: 5px;
|
|
@@ -490,7 +491,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
490
491
|
}
|
|
491
492
|
|
|
492
493
|
.sort-direction-selector:disabled {
|
|
493
|
-
cursor:
|
|
494
|
+
cursor: not-allowed;
|
|
495
|
+
border-color: ${disabledIconColor};
|
|
494
496
|
}
|
|
495
497
|
|
|
496
498
|
.sort-direction-icon {
|
|
@@ -543,7 +545,7 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
543
545
|
appearance: none;
|
|
544
546
|
cursor: pointer;
|
|
545
547
|
-webkit-appearance: none;
|
|
546
|
-
fill:
|
|
548
|
+
fill: ${disabledIconColor};
|
|
547
549
|
}
|
|
548
550
|
|
|
549
551
|
#display-style-selector button.active {
|
|
@@ -1 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+JF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA5qB6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAqC;AAGpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAmD;AAGlD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAGH;AAGI;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAA4C;AAG3C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAA6C;AAG5C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAA2C;AAG1C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAA6C;AAe5C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAiD;AAGhC;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4DACnC;AAIR;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2DACL;AAGV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAGzB;AAMO;IAAR,KAAK,EAAE;2DAAmD;AAMlD;IAAR,KAAK,EAAE;8DAAiC;AAIjC;IADP,KAAK,CAAC,gBAAgB,CAAC;0DACiB;AApE9B,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA8qBzB","sourcesContent":["import {\n LitElement,\n html,\n css,\n nothing,\n PropertyValues,\n TemplateResult,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { msg } from '@lit/localize';\nimport type { IaDropdown, optionInterface } from '@internetarchive/ia-dropdown';\nimport type { SortDirection } from '@internetarchive/search-service';\nimport {\n CollectionDisplayMode,\n defaultSortAvailability,\n PrefixFilterCounts,\n PrefixFilterType,\n SORT_OPTIONS,\n SortField,\n} from '../models';\n\nimport { sortUpIcon } from './img/sort-toggle-up';\nimport { sortDownIcon } from './img/sort-toggle-down';\nimport { sortDisabledIcon } from './img/sort-toggle-disabled';\nimport { tileIcon } from './img/tile';\nimport { listIcon } from './img/list';\nimport { compactIcon } from './img/compact';\nimport { srOnlyStyle } from '../styles/sr-only';\n\nimport '@internetarchive/ia-dropdown';\nimport './alpha-bar';\n\ntype AlphaSelector = 'creator' | 'title';\n\n@customElement('sort-filter-bar')\nexport class SortFilterBar extends LitElement {\n /** Which display mode the tiles are being rendered with (grid/list-detail/list-compact) */\n @property({ type: String }) displayMode?: CollectionDisplayMode;\n\n /** The default sort direction to use if none is set */\n @property({ type: String }) defaultSortDirection: SortDirection | null = null;\n\n /** The default sort field to use if none is set */\n @property({ type: String }) defaultSortField: Exclude<\n SortField,\n SortField.default\n > = SortField.relevance;\n\n /** The current sort direction (asc/desc), or null if none is set */\n @property({ type: String }) sortDirection: SortDirection | null = null;\n\n /** The field currently being sorted on (e.g., 'title'). Defaults to relevance. */\n @property({ type: String }) selectedSort: SortField = SortField.default;\n\n /** The currently selected title letter filter, or null if none is set */\n @property({ type: String }) selectedTitleFilter: string | null = null;\n\n /** The currently selected creator letter filter, or null if none is set */\n @property({ type: String }) selectedCreatorFilter: string | null = null;\n\n /**\n * Map defining which sortable fields should be included on the sort bar.\n *\n * E.g.,\n * ```\n * {\n * [SortField.relevance]: true,\n * [SortField.date]: false,\n * [SortField.title]: true,\n * ...\n * }\n * ```\n */\n @property({ type: Object }) sortFieldAvailability = defaultSortAvailability;\n\n /** Whether to replace the default sort options with a slot for customization (default `false`) */\n @property({ type: Boolean, reflect: true }) enableSortOptionsSlot: boolean =\n false;\n\n /** Whether to suppress showing the three display mode options on the right of the bar (default `false`) */\n @property({ type: Boolean, reflect: true })\n suppressDisplayModes: boolean = false;\n\n /** Maps of result counts for letters on the alphabet bar, for each letter filter type */\n @property({ type: Object }) prefixFilterCountMap?: Record<\n PrefixFilterType,\n PrefixFilterCounts\n >;\n\n /**\n * Which of the alphabet bars (title/creator) should be shown, or null if one\n * should not currently be rendered.\n */\n @state() alphaSelectorVisible: AlphaSelector | null = null;\n\n /**\n * Whether the transparent backdrop to catch clicks outside the dropdown menu\n * should be rendered.\n */\n @state() dropdownBackdropVisible = false;\n\n /** The single, consolidated dropdown component containing all available options */\n @query('#sort-dropdown')\n private sortOptionsDropdown!: IaDropdown;\n\n render() {\n return html`\n <div id=\"container\">\n <section id=\"sort-bar\" aria-label=\"Sorting options\">\n <slot name=\"sort-options-left\"></slot>\n <div id=\"sort-options\">\n ${!this.enableSortOptionsSlot\n ? html`\n <div class=\"sort-direction-container\">\n ${this.sortDirectionSelectorTemplate}\n </div>\n <span class=\"sort-by-text\">${msg('Sort by:')}</span>\n <div id=\"sort-selector-container\">\n ${this.sortSelectorTemplate}\n </div>\n `\n : html`<slot name=\"sort-options\"></slot>`}\n </div>\n <slot name=\"sort-options-right\"></slot>\n\n ${this.suppressDisplayModes\n ? nothing\n : html`<div id=\"display-style-selector\">\n ${this.displayOptionTemplate}\n </div>`}\n </section>\n\n ${this.dropdownBackdropVisible ? this.dropdownBackdrop : nothing}\n ${this.alphaBarTemplate}\n </div>\n `;\n }\n\n willUpdate(changed: PropertyValues) {\n if (changed.has('selectedSort') || changed.has('defaultSortField')) {\n // If the sort is changed from its default without a direction set,\n // we adopt the default sort direction for that sort type.\n if (\n this.selectedSort &&\n this.selectedSort !== SortField.default &&\n this.sortDirection === null\n ) {\n const sortOption = SORT_OPTIONS[this.finalizedSortField];\n this.sortDirection = sortOption.defaultSortDirection;\n }\n }\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('displayMode')) {\n this.displayModeChanged();\n }\n\n if (changed.has('selectedTitleFilter') && this.selectedTitleFilter) {\n this.alphaSelectorVisible = 'title';\n }\n\n if (changed.has('selectedCreatorFilter') && this.selectedCreatorFilter) {\n this.alphaSelectorVisible = 'creator';\n }\n\n if (changed.has('dropdownBackdropVisible')) {\n this.setupEscapeListeners();\n }\n }\n\n private setupEscapeListeners() {\n if (this.dropdownBackdropVisible) {\n document.addEventListener(\n 'keydown',\n this.boundSortBarSelectorEscapeListener,\n );\n } else {\n document.removeEventListener(\n 'keydown',\n this.boundSortBarSelectorEscapeListener,\n );\n }\n }\n\n private boundSortBarSelectorEscapeListener = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n this.closeDropdown();\n }\n };\n\n /**\n * Template to render the alphabet bar, or `nothing` if it should not be rendered\n * for the current sort\n */\n private get alphaBarTemplate(): TemplateResult | typeof nothing {\n if (!['title', 'creator'].includes(this.selectedSort)) return nothing;\n\n if (this.alphaSelectorVisible === null) {\n if (this.selectedSort === 'creator') return this.creatorSelectorBar;\n if (this.selectedSort === 'title') return this.titleSelectorBar;\n } else {\n return this.alphaSelectorVisible === 'creator'\n ? this.creatorSelectorBar\n : this.titleSelectorBar;\n }\n\n return nothing;\n }\n\n /** Template to render the sort direction toggle button */\n private get sortDirectionSelectorTemplate(): TemplateResult {\n const oppositeSortDirectionReadable =\n this.sortDirection === 'asc' ? 'descending' : 'ascending';\n const srLabel = `Change to ${oppositeSortDirectionReadable} sort`;\n\n return html`\n <button\n class=\"sort-direction-selector\"\n ?disabled=${!this.canChangeSortDirection}\n @click=${this.handleSortDirectionClicked}\n >\n <span class=\"sr-only\">${srLabel}</span>\n ${this.sortDirectionIcon}\n </button>\n `;\n }\n\n /** Template to render the sort direction button's icon in the correct current state */\n private get sortDirectionIcon(): TemplateResult {\n // Show a fully disabled icon for sort options without direction support\n if (!this.canChangeSortDirection) {\n return html`<div class=\"sort-direction-icon\">${sortDisabledIcon}</div>`;\n }\n\n // For all other sorts, show the ascending/descending direction\n return html`\n <div class=\"sort-direction-icon\">\n ${this.finalizedSortDirection === 'asc' ? sortUpIcon : sortDownIcon}\n </div>\n `;\n }\n\n /** The template to render all the sort options in a single dropdown */\n private get sortSelectorTemplate() {\n const displayedOptions = Object.values(SORT_OPTIONS).filter(\n opt => opt.shownInSortBar && this.sortFieldAvailability[opt.field],\n );\n\n return html`\n <div id=\"sort-dropdown-container\">\n ${this.getSortDropdown({\n displayName: SORT_OPTIONS[this.finalizedSortField].displayName,\n id: 'sort-dropdown',\n selected: true,\n dropdownOptions: displayedOptions.map(opt =>\n this.getDropdownOption(opt.field),\n ),\n selectedOption: this.finalizedSortField,\n onOptionSelected: this.sortOptionSelected,\n onDropdownClick: () => {\n this.dropdownBackdropVisible = this.sortOptionsDropdown.open;\n this.sortOptionsDropdown.classList.toggle(\n 'open',\n this.sortOptionsDropdown.open,\n );\n },\n })}\n </div>\n `;\n }\n\n /**\n * Generates a dropdown component containing multiple grouped sort options.\n *\n * @param options.displayName The name to use for the dropdown's visible label\n * @param options.id The id to apply to the dropdown element\n * @param options.dropdownOptions An array of option objects used to populate the dropdown\n * @param options.selectedOption The id of the option that should be initially selected\n * @param options.selected A boolean indicating whether this dropdown should use its\n * selected appearance\n * @param options.onOptionSelected A handler for optionSelected events coming from the dropdown\n * @param options.onDropdownClick A handler for click events on the dropdown\n */\n private getSortDropdown(options: {\n displayName: string;\n id: string;\n dropdownOptions: optionInterface[];\n selectedOption?: string;\n selected: boolean;\n onOptionSelected?: (e: CustomEvent<{ option: optionInterface }>) => void;\n onDropdownClick?: (e: PointerEvent) => void;\n }): TemplateResult {\n return html`\n <ia-dropdown\n id=${options.id}\n class=${options.selected ? 'selected' : ''}\n displayCaret\n closeOnSelect\n includeSelectedOption\n .openViaButton=${options.selected}\n .options=${options.dropdownOptions}\n .selectedOption=${options.selectedOption ?? ''}\n @optionSelected=${options.onOptionSelected ?? nothing}\n @click=${options.onDropdownClick ?? nothing}\n >\n <span\n class=\"dropdown-label\"\n slot=\"dropdown-label\"\n data-title=${options.displayName}\n >\n ${options.displayName}\n </span>\n </ia-dropdown>\n `;\n }\n\n /** Generates a single dropdown option object for the given sort field */\n private getDropdownOption(sortField: SortField): optionInterface {\n return {\n id: sortField,\n selectedHandler: () => {\n this.selectDropdownSortField(sortField);\n },\n label: html`\n <span class=\"dropdown-option-label\">\n ${SORT_OPTIONS[sortField].displayName}\n </span>\n `,\n };\n }\n\n /** Handler for when a new sort dropdown option is selected */\n private sortOptionSelected(e: CustomEvent<{ option: optionInterface }>) {\n this.dropdownBackdropVisible = false;\n\n const sortField = e.detail.option.id as SortField;\n this.setSelectedSort(sortField);\n\n this.alphaSelectorVisible = null;\n if (sortField !== 'title' && this.selectedTitleFilter) {\n this.selectedTitleFilter = null;\n this.emitTitleLetterChangedEvent();\n }\n if (sortField !== 'creator' && this.selectedCreatorFilter) {\n this.selectedCreatorFilter = null;\n this.emitCreatorLetterChangedEvent();\n }\n }\n\n /** Template for rendering the three display mode options */\n /** Added data-testid for Playwright testing * */\n private get displayOptionTemplate() {\n return html`\n <ul>\n <li>\n <button\n id=\"grid-button\"\n @click=${() => {\n this.displayMode = 'grid';\n }}\n class=${this.displayMode === 'grid' ? 'active' : ''}\n title=\"Tile view\"\n data-testid=\"grid-button\"\n >\n ${tileIcon}\n </button>\n </li>\n <li>\n <button\n id=\"list-detail-button\"\n @click=${() => {\n this.displayMode = 'list-detail';\n }}\n class=${this.displayMode === 'list-detail' ? 'active' : ''}\n title=\"List view\"\n data-testid=\"list-detail-button\"\n >\n ${listIcon}\n </button>\n </li>\n <li>\n <button\n id=\"list-compact-button\"\n @click=${() => {\n this.displayMode = 'list-compact';\n }}\n class=${this.displayMode === 'list-compact' ? 'active' : ''}\n title=\"Compact list view\"\n data-testid=\"list-compact-button\"\n >\n ${compactIcon}\n </button>\n </li>\n </ul>\n `;\n }\n\n /**\n * Template for rendering the transparent backdrop to capture clicks outside the\n * dropdown menu while it is open.\n */\n private get dropdownBackdrop() {\n return html`\n <div\n id=\"sort-selector-backdrop\"\n @keyup=${this.closeDropdown}\n @click=${this.closeDropdown}\n ></div>\n `;\n }\n\n /** Closes the sorting dropdown component's menus */\n private closeDropdown() {\n this.dropdownBackdropVisible = false;\n\n if (!this.sortOptionsDropdown) return;\n this.sortOptionsDropdown.open = false;\n this.sortOptionsDropdown.classList.remove('open');\n }\n\n private selectDropdownSortField(sortField: SortField) {\n // When a dropdown sort option is selected, we additionally need to clear the backdrop\n this.dropdownBackdropVisible = false;\n this.setSelectedSort(sortField);\n }\n\n setSortDirection(sortDirection: SortDirection) {\n this.sortDirection = sortDirection;\n this.emitSortChangedEvent();\n }\n\n /** Toggles the current sort direction between 'asc' and 'desc' */\n private toggleSortDirection() {\n this.setSortDirection(\n this.finalizedSortDirection === 'desc' ? 'asc' : 'desc',\n );\n }\n\n private handleSortDirectionClicked(): void {\n if (\n !this.sortDirection &&\n this.defaultSortField &&\n this.defaultSortDirection\n ) {\n // When the sort direction is merely defaulted (not set by the user), clicking\n // the toggled button should \"promote\" the default sort to an explicitly-set one\n // and then toggle it as usual.\n this.selectedSort = this.defaultSortField;\n this.sortDirection = this.defaultSortDirection;\n }\n\n this.toggleSortDirection();\n }\n\n setSelectedSort(sort: SortField) {\n this.selectedSort = sort;\n // Apply this field's default sort direction\n const sortOption = SORT_OPTIONS[sort];\n this.sortDirection = sortOption.defaultSortDirection;\n this.emitSortChangedEvent();\n }\n\n /** The current sort field, or the default one if no explicit sort is set */\n private get finalizedSortField(): SortField {\n return this.selectedSort === SortField.default\n ? this.defaultSortField\n : this.selectedSort;\n }\n\n /** The current sort direction, or the default one if no explicit direction is set */\n private get finalizedSortDirection(): SortDirection | null {\n return this.sortDirection === null\n ? this.defaultSortDirection\n : this.sortDirection;\n }\n\n /** Whether the sort direction button should be enabled for the current sort */\n private get canChangeSortDirection(): boolean {\n return SORT_OPTIONS[this.finalizedSortField].canSetDirection;\n }\n\n private get titleSelectorBar() {\n return html` <alpha-bar\n .selectedLetter=${this.selectedTitleFilter}\n .letterCounts=${this.prefixFilterCountMap?.title}\n ariaLandmarkLabel=\"Filter by title letter\"\n @letterChanged=${this.titleLetterChanged}\n ></alpha-bar>`;\n }\n\n private get creatorSelectorBar() {\n return html` <alpha-bar\n .selectedLetter=${this.selectedCreatorFilter}\n .letterCounts=${this.prefixFilterCountMap?.creator}\n ariaLandmarkLabel=\"Filter by creator letter\"\n @letterChanged=${this.creatorLetterChanged}\n ></alpha-bar>`;\n }\n\n private titleLetterChanged(\n e: CustomEvent<{ selectedLetter: string | undefined }>,\n ) {\n this.selectedTitleFilter = e.detail.selectedLetter ?? null;\n this.emitTitleLetterChangedEvent();\n }\n\n private creatorLetterChanged(\n e: CustomEvent<{ selectedLetter: string | undefined }>,\n ) {\n this.selectedCreatorFilter = e.detail.selectedLetter ?? null;\n this.emitCreatorLetterChangedEvent();\n }\n\n private emitTitleLetterChangedEvent() {\n const event = new CustomEvent<{ selectedLetter: string | null }>(\n 'titleLetterChanged',\n {\n detail: { selectedLetter: this.selectedTitleFilter },\n },\n );\n this.dispatchEvent(event);\n }\n\n private emitCreatorLetterChangedEvent() {\n const event = new CustomEvent<{ selectedLetter: string | null }>(\n 'creatorLetterChanged',\n {\n detail: { selectedLetter: this.selectedCreatorFilter },\n },\n );\n this.dispatchEvent(event);\n }\n\n private displayModeChanged() {\n const event = new CustomEvent<{\n displayMode?: CollectionDisplayMode;\n }>('displayModeChanged', {\n detail: { displayMode: this.displayMode },\n });\n this.dispatchEvent(event);\n }\n\n private emitSortChangedEvent() {\n const event = new CustomEvent<{\n selectedSort: SortField;\n sortDirection: SortDirection | null;\n }>('sortChanged', {\n detail: {\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection,\n },\n });\n this.dispatchEvent(event);\n }\n\n static get styles() {\n return [\n srOnlyStyle,\n css`\n #container {\n position: relative;\n }\n\n #sort-bar {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-bottom: 1px;\n border-bottom: 1px solid #2c2c2c;\n font-size: 1.4rem;\n }\n\n #sort-options {\n display: flex;\n align-items: center;\n flex-grow: 1;\n }\n\n ul {\n list-style: none;\n display: flex;\n align-items: center;\n margin: 0;\n padding: 0;\n }\n\n li {\n padding: 0;\n }\n\n .sort-by-text {\n margin-right: 5px;\n font-weight: bold;\n white-space: nowrap;\n }\n\n .sort-direction-container {\n display: flex;\n align-self: stretch;\n flex: 0;\n margin: 0 5px;\n }\n\n .sort-direction-selector {\n display: flex;\n justify-content: center;\n width: 30px;\n margin: 0 5px 0 3px;\n padding: 7px 8px;\n max-height: fit-content;\n border-radius: 5px;\n background: white;\n border: 1px solid rgb(25, 72, 128);\n appearance: none;\n cursor: pointer;\n }\n\n .sort-direction-selector:disabled {\n cursor: default;\n }\n\n .sort-direction-icon {\n display: flex;\n align-items: center;\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n outline: inherit;\n width: 12px;\n height: 12px;\n }\n\n .sort-direction-icon > svg {\n flex: 1;\n }\n\n #sort-selector-container {\n flex: 1;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n }\n\n #sort-dropdown-container {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n }\n\n #sort-selector-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n z-index: 1;\n background-color: transparent;\n }\n\n #display-style-selector {\n flex: 0;\n }\n\n #display-style-selector button {\n background: none;\n color: inherit;\n border: none;\n appearance: none;\n cursor: pointer;\n -webkit-appearance: none;\n fill: #bbbbbb;\n }\n\n #display-style-selector button.active {\n fill: var(--ia-theme-primary-text-color, #2c2c2c);\n }\n\n #display-style-selector button svg {\n width: 24px;\n height: 24px;\n }\n\n ia-dropdown {\n --dropdownTextColor: white;\n --dropdownOffsetTop: 0;\n --dropdownBorderTopWidth: 0;\n --dropdownBorderTopLeftRadius: 0;\n --dropdownBorderTopRightRadius: 0;\n --dropdownWhiteSpace: nowrap;\n --dropdownListZIndex: 2;\n --dropdownCaretColor: var(--ia-theme-primary-text-color, #2c2c2c);\n --dropdownSelectedTextColor: white;\n --dropdownSelectedBgColor: rgba(255, 255, 255, 0.3);\n --dropdownHoverBgColor: rgba(255, 255, 255, 0.3);\n --caretHeight: 9px;\n --caretWidth: 12px;\n --caretPadding: 0 5px 0 0;\n }\n ia-dropdown.selected .dropdown-label {\n font-weight: bold;\n }\n ia-dropdown.open {\n z-index: 2;\n }\n\n .dropdown-label {\n display: inline-block;\n height: 100%;\n padding-left: 5px;\n font-size: 1.4rem;\n font-family: var(--ia-theme-base-font-family);\n line-height: 2;\n color: var(--ia-theme-primary-text-color, #2c2c2c);\n white-space: nowrap;\n user-select: none;\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sort-filter-bar.js","sourceRoot":"","sources":["../../../src/sort-filter-bar/sort-filter-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,GAAG,EACH,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,uBAAuB,EAGvB,YAAY,EACZ,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,8BAA8B,CAAC;AACtC,OAAO,aAAa,CAAC;AAKd,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAIL,uDAAuD;QAC3B,y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AE,OAAO,EAAE,IAAI,EAAE,CAAC;2DACL;AAGV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAGzB;AAMO;IAAR,KAAK,EAAE;2DAAmD;AAMlD;IAAR,KAAK,EAAE;8DAAiC;AAIjC;IADP,KAAK,CAAC,gBAAgB,CAAC;0DACiB;AApE9B,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAirBzB","sourcesContent":["import {\n LitElement,\n html,\n css,\n nothing,\n PropertyValues,\n TemplateResult,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { msg } from '@lit/localize';\nimport type { IaDropdown, optionInterface } from '@internetarchive/ia-dropdown';\nimport type { SortDirection } from '@internetarchive/search-service';\nimport {\n CollectionDisplayMode,\n defaultSortAvailability,\n PrefixFilterCounts,\n PrefixFilterType,\n SORT_OPTIONS,\n SortField,\n} from '../models';\n\nimport { sortUpIcon } from './img/sort-toggle-up';\nimport { sortDownIcon } from './img/sort-toggle-down';\nimport { sortDisabledIcon } from './img/sort-toggle-disabled';\nimport { tileIcon } from './img/tile';\nimport { listIcon } from './img/list';\nimport { compactIcon } from './img/compact';\nimport { srOnlyStyle } from '../styles/sr-only';\n\nimport '@internetarchive/ia-dropdown';\nimport './alpha-bar';\n\ntype AlphaSelector = 'creator' | 'title';\n\n@customElement('sort-filter-bar')\nexport class SortFilterBar extends LitElement {\n /** Which display mode the tiles are being rendered with (grid/list-detail/list-compact) */\n @property({ type: String }) displayMode?: CollectionDisplayMode;\n\n /** The default sort direction to use if none is set */\n @property({ type: String }) defaultSortDirection: SortDirection | null = null;\n\n /** The default sort field to use if none is set */\n @property({ type: String }) defaultSortField: Exclude<\n SortField,\n SortField.default\n > = SortField.relevance;\n\n /** The current sort direction (asc/desc), or null if none is set */\n @property({ type: String }) sortDirection: SortDirection | null = null;\n\n /** The field currently being sorted on (e.g., 'title'). Defaults to relevance. */\n @property({ type: String }) selectedSort: SortField = SortField.default;\n\n /** The currently selected title letter filter, or null if none is set */\n @property({ type: String }) selectedTitleFilter: string | null = null;\n\n /** The currently selected creator letter filter, or null if none is set */\n @property({ type: String }) selectedCreatorFilter: string | null = null;\n\n /**\n * Map defining which sortable fields should be included on the sort bar.\n *\n * E.g.,\n * ```\n * {\n * [SortField.relevance]: true,\n * [SortField.date]: false,\n * [SortField.title]: true,\n * ...\n * }\n * ```\n */\n @property({ type: Object }) sortFieldAvailability = defaultSortAvailability;\n\n /** Whether to replace the default sort options with a slot for customization (default `false`) */\n @property({ type: Boolean, reflect: true }) enableSortOptionsSlot: boolean =\n false;\n\n /** Whether to suppress showing the three display mode options on the right of the bar (default `false`) */\n @property({ type: Boolean, reflect: true })\n suppressDisplayModes: boolean = false;\n\n /** Maps of result counts for letters on the alphabet bar, for each letter filter type */\n @property({ type: Object }) prefixFilterCountMap?: Record<\n PrefixFilterType,\n PrefixFilterCounts\n >;\n\n /**\n * Which of the alphabet bars (title/creator) should be shown, or null if one\n * should not currently be rendered.\n */\n @state() alphaSelectorVisible: AlphaSelector | null = null;\n\n /**\n * Whether the transparent backdrop to catch clicks outside the dropdown menu\n * should be rendered.\n */\n @state() dropdownBackdropVisible = false;\n\n /** The single, consolidated dropdown component containing all available options */\n @query('#sort-dropdown')\n private sortOptionsDropdown!: IaDropdown;\n\n render() {\n return html`\n <div id=\"container\">\n <section id=\"sort-bar\" aria-label=\"Sorting options\">\n <slot name=\"sort-options-left\"></slot>\n <div id=\"sort-options\">\n ${!this.enableSortOptionsSlot\n ? html`\n <div class=\"sort-direction-container\">\n ${this.sortDirectionSelectorTemplate}\n </div>\n <span class=\"sort-by-text\">${msg('Sort by:')}</span>\n <div id=\"sort-selector-container\">\n ${this.sortSelectorTemplate}\n </div>\n `\n : html`<slot name=\"sort-options\"></slot>`}\n </div>\n <slot name=\"sort-options-right\"></slot>\n\n ${this.suppressDisplayModes\n ? nothing\n : html`<div id=\"display-style-selector\">\n ${this.displayOptionTemplate}\n </div>`}\n </section>\n\n ${this.dropdownBackdropVisible ? this.dropdownBackdrop : nothing}\n ${this.alphaBarTemplate}\n </div>\n `;\n }\n\n willUpdate(changed: PropertyValues) {\n if (changed.has('selectedSort') || changed.has('defaultSortField')) {\n // If the sort is changed from its default without a direction set,\n // we adopt the default sort direction for that sort type.\n if (\n this.selectedSort &&\n this.selectedSort !== SortField.default &&\n this.sortDirection === null\n ) {\n const sortOption = SORT_OPTIONS[this.finalizedSortField];\n this.sortDirection = sortOption.defaultSortDirection;\n }\n }\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('displayMode')) {\n this.displayModeChanged();\n }\n\n if (changed.has('selectedTitleFilter') && this.selectedTitleFilter) {\n this.alphaSelectorVisible = 'title';\n }\n\n if (changed.has('selectedCreatorFilter') && this.selectedCreatorFilter) {\n this.alphaSelectorVisible = 'creator';\n }\n\n if (changed.has('dropdownBackdropVisible')) {\n this.setupEscapeListeners();\n }\n }\n\n private setupEscapeListeners() {\n if (this.dropdownBackdropVisible) {\n document.addEventListener(\n 'keydown',\n this.boundSortBarSelectorEscapeListener,\n );\n } else {\n document.removeEventListener(\n 'keydown',\n this.boundSortBarSelectorEscapeListener,\n );\n }\n }\n\n private boundSortBarSelectorEscapeListener = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n this.closeDropdown();\n }\n };\n\n /**\n * Template to render the alphabet bar, or `nothing` if it should not be rendered\n * for the current sort\n */\n private get alphaBarTemplate(): TemplateResult | typeof nothing {\n if (!['title', 'creator'].includes(this.selectedSort)) return nothing;\n\n if (this.alphaSelectorVisible === null) {\n if (this.selectedSort === 'creator') return this.creatorSelectorBar;\n if (this.selectedSort === 'title') return this.titleSelectorBar;\n } else {\n return this.alphaSelectorVisible === 'creator'\n ? this.creatorSelectorBar\n : this.titleSelectorBar;\n }\n\n return nothing;\n }\n\n /** Template to render the sort direction toggle button */\n private get sortDirectionSelectorTemplate(): TemplateResult {\n const oppositeSortDirectionReadable =\n this.sortDirection === 'asc' ? 'descending' : 'ascending';\n const srLabel = `Change to ${oppositeSortDirectionReadable} sort`;\n\n return html`\n <button\n class=\"sort-direction-selector\"\n ?disabled=${!this.canChangeSortDirection}\n @click=${this.handleSortDirectionClicked}\n >\n <span class=\"sr-only\">${srLabel}</span>\n ${this.sortDirectionIcon}\n </button>\n `;\n }\n\n /** Template to render the sort direction button's icon in the correct current state */\n private get sortDirectionIcon(): TemplateResult {\n // Show a fully disabled icon for sort options without direction support\n if (!this.canChangeSortDirection) {\n return html`<div class=\"sort-direction-icon\">${sortDisabledIcon}</div>`;\n }\n\n // For all other sorts, show the ascending/descending direction\n return html`\n <div class=\"sort-direction-icon\">\n ${this.finalizedSortDirection === 'asc' ? sortUpIcon : sortDownIcon}\n </div>\n `;\n }\n\n /** The template to render all the sort options in a single dropdown */\n private get sortSelectorTemplate() {\n const displayedOptions = Object.values(SORT_OPTIONS).filter(\n opt => opt.shownInSortBar && this.sortFieldAvailability[opt.field],\n );\n\n return html`\n <div id=\"sort-dropdown-container\">\n ${this.getSortDropdown({\n displayName: SORT_OPTIONS[this.finalizedSortField].displayName,\n id: 'sort-dropdown',\n selected: true,\n dropdownOptions: displayedOptions.map(opt =>\n this.getDropdownOption(opt.field),\n ),\n selectedOption: this.finalizedSortField,\n onOptionSelected: this.sortOptionSelected,\n onDropdownClick: () => {\n this.dropdownBackdropVisible = this.sortOptionsDropdown.open;\n this.sortOptionsDropdown.classList.toggle(\n 'open',\n this.sortOptionsDropdown.open,\n );\n },\n })}\n </div>\n `;\n }\n\n /**\n * Generates a dropdown component containing multiple grouped sort options.\n *\n * @param options.displayName The name to use for the dropdown's visible label\n * @param options.id The id to apply to the dropdown element\n * @param options.dropdownOptions An array of option objects used to populate the dropdown\n * @param options.selectedOption The id of the option that should be initially selected\n * @param options.selected A boolean indicating whether this dropdown should use its\n * selected appearance\n * @param options.onOptionSelected A handler for optionSelected events coming from the dropdown\n * @param options.onDropdownClick A handler for click events on the dropdown\n */\n private getSortDropdown(options: {\n displayName: string;\n id: string;\n dropdownOptions: optionInterface[];\n selectedOption?: string;\n selected: boolean;\n onOptionSelected?: (e: CustomEvent<{ option: optionInterface }>) => void;\n onDropdownClick?: (e: PointerEvent) => void;\n }): TemplateResult {\n return html`\n <ia-dropdown\n id=${options.id}\n class=${options.selected ? 'selected' : ''}\n displayCaret\n closeOnSelect\n includeSelectedOption\n .openViaButton=${options.selected}\n .options=${options.dropdownOptions}\n .selectedOption=${options.selectedOption ?? ''}\n @optionSelected=${options.onOptionSelected ?? nothing}\n @click=${options.onDropdownClick ?? nothing}\n >\n <span\n class=\"dropdown-label\"\n slot=\"dropdown-label\"\n data-title=${options.displayName}\n >\n ${options.displayName}\n </span>\n </ia-dropdown>\n `;\n }\n\n /** Generates a single dropdown option object for the given sort field */\n private getDropdownOption(sortField: SortField): optionInterface {\n return {\n id: sortField,\n selectedHandler: () => {\n this.selectDropdownSortField(sortField);\n },\n label: html`\n <span class=\"dropdown-option-label\">\n ${SORT_OPTIONS[sortField].displayName}\n </span>\n `,\n };\n }\n\n /** Handler for when a new sort dropdown option is selected */\n private sortOptionSelected(e: CustomEvent<{ option: optionInterface }>) {\n this.dropdownBackdropVisible = false;\n\n const sortField = e.detail.option.id as SortField;\n this.setSelectedSort(sortField);\n\n this.alphaSelectorVisible = null;\n if (sortField !== 'title' && this.selectedTitleFilter) {\n this.selectedTitleFilter = null;\n this.emitTitleLetterChangedEvent();\n }\n if (sortField !== 'creator' && this.selectedCreatorFilter) {\n this.selectedCreatorFilter = null;\n this.emitCreatorLetterChangedEvent();\n }\n }\n\n /** Template for rendering the three display mode options */\n /** Added data-testid for Playwright testing * */\n private get displayOptionTemplate() {\n return html`\n <ul>\n <li>\n <button\n id=\"grid-button\"\n @click=${() => {\n this.displayMode = 'grid';\n }}\n class=${this.displayMode === 'grid' ? 'active' : ''}\n title=\"Tile view\"\n data-testid=\"grid-button\"\n >\n ${tileIcon}\n </button>\n </li>\n <li>\n <button\n id=\"list-detail-button\"\n @click=${() => {\n this.displayMode = 'list-detail';\n }}\n class=${this.displayMode === 'list-detail' ? 'active' : ''}\n title=\"List view\"\n data-testid=\"list-detail-button\"\n >\n ${listIcon}\n </button>\n </li>\n <li>\n <button\n id=\"list-compact-button\"\n @click=${() => {\n this.displayMode = 'list-compact';\n }}\n class=${this.displayMode === 'list-compact' ? 'active' : ''}\n title=\"Compact list view\"\n data-testid=\"list-compact-button\"\n >\n ${compactIcon}\n </button>\n </li>\n </ul>\n `;\n }\n\n /**\n * Template for rendering the transparent backdrop to capture clicks outside the\n * dropdown menu while it is open.\n */\n private get dropdownBackdrop() {\n return html`\n <div\n id=\"sort-selector-backdrop\"\n @keyup=${this.closeDropdown}\n @click=${this.closeDropdown}\n ></div>\n `;\n }\n\n /** Closes the sorting dropdown component's menus */\n private closeDropdown() {\n this.dropdownBackdropVisible = false;\n\n if (!this.sortOptionsDropdown) return;\n this.sortOptionsDropdown.open = false;\n this.sortOptionsDropdown.classList.remove('open');\n }\n\n private selectDropdownSortField(sortField: SortField) {\n // When a dropdown sort option is selected, we additionally need to clear the backdrop\n this.dropdownBackdropVisible = false;\n this.setSelectedSort(sortField);\n }\n\n setSortDirection(sortDirection: SortDirection) {\n this.sortDirection = sortDirection;\n this.emitSortChangedEvent();\n }\n\n /** Toggles the current sort direction between 'asc' and 'desc' */\n private toggleSortDirection() {\n this.setSortDirection(\n this.finalizedSortDirection === 'desc' ? 'asc' : 'desc',\n );\n }\n\n private handleSortDirectionClicked(): void {\n if (\n !this.sortDirection &&\n this.defaultSortField &&\n this.defaultSortDirection\n ) {\n // When the sort direction is merely defaulted (not set by the user), clicking\n // the toggled button should \"promote\" the default sort to an explicitly-set one\n // and then toggle it as usual.\n this.selectedSort = this.defaultSortField;\n this.sortDirection = this.defaultSortDirection;\n }\n\n this.toggleSortDirection();\n }\n\n setSelectedSort(sort: SortField) {\n this.selectedSort = sort;\n // Apply this field's default sort direction\n const sortOption = SORT_OPTIONS[sort];\n this.sortDirection = sortOption.defaultSortDirection;\n this.emitSortChangedEvent();\n }\n\n /** The current sort field, or the default one if no explicit sort is set */\n private get finalizedSortField(): SortField {\n return this.selectedSort === SortField.default\n ? this.defaultSortField\n : this.selectedSort;\n }\n\n /** The current sort direction, or the default one if no explicit direction is set */\n private get finalizedSortDirection(): SortDirection | null {\n return this.sortDirection === null\n ? this.defaultSortDirection\n : this.sortDirection;\n }\n\n /** Whether the sort direction button should be enabled for the current sort */\n private get canChangeSortDirection(): boolean {\n return SORT_OPTIONS[this.finalizedSortField].canSetDirection;\n }\n\n private get titleSelectorBar() {\n return html` <alpha-bar\n .selectedLetter=${this.selectedTitleFilter}\n .letterCounts=${this.prefixFilterCountMap?.title}\n ariaLandmarkLabel=\"Filter by title letter\"\n @letterChanged=${this.titleLetterChanged}\n ></alpha-bar>`;\n }\n\n private get creatorSelectorBar() {\n return html` <alpha-bar\n .selectedLetter=${this.selectedCreatorFilter}\n .letterCounts=${this.prefixFilterCountMap?.creator}\n ariaLandmarkLabel=\"Filter by creator letter\"\n @letterChanged=${this.creatorLetterChanged}\n ></alpha-bar>`;\n }\n\n private titleLetterChanged(\n e: CustomEvent<{ selectedLetter: string | undefined }>,\n ) {\n this.selectedTitleFilter = e.detail.selectedLetter ?? null;\n this.emitTitleLetterChangedEvent();\n }\n\n private creatorLetterChanged(\n e: CustomEvent<{ selectedLetter: string | undefined }>,\n ) {\n this.selectedCreatorFilter = e.detail.selectedLetter ?? null;\n this.emitCreatorLetterChangedEvent();\n }\n\n private emitTitleLetterChangedEvent() {\n const event = new CustomEvent<{ selectedLetter: string | null }>(\n 'titleLetterChanged',\n {\n detail: { selectedLetter: this.selectedTitleFilter },\n },\n );\n this.dispatchEvent(event);\n }\n\n private emitCreatorLetterChangedEvent() {\n const event = new CustomEvent<{ selectedLetter: string | null }>(\n 'creatorLetterChanged',\n {\n detail: { selectedLetter: this.selectedCreatorFilter },\n },\n );\n this.dispatchEvent(event);\n }\n\n private displayModeChanged() {\n const event = new CustomEvent<{\n displayMode?: CollectionDisplayMode;\n }>('displayModeChanged', {\n detail: { displayMode: this.displayMode },\n });\n this.dispatchEvent(event);\n }\n\n private emitSortChangedEvent() {\n const event = new CustomEvent<{\n selectedSort: SortField;\n sortDirection: SortDirection | null;\n }>('sortChanged', {\n detail: {\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection,\n },\n });\n this.dispatchEvent(event);\n }\n\n static get styles() {\n const disabledIconColor = css`#bbbbbb`;\n\n return [\n srOnlyStyle,\n css`\n #container {\n position: relative;\n }\n\n #sort-bar {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-bottom: 1px;\n border-bottom: 1px solid #2c2c2c;\n font-size: 1.4rem;\n }\n\n #sort-options {\n display: flex;\n align-items: center;\n flex-grow: 1;\n }\n\n ul {\n list-style: none;\n display: flex;\n align-items: center;\n margin: 0;\n padding: 0;\n }\n\n li {\n padding: 0;\n }\n\n .sort-by-text {\n margin-right: 5px;\n font-weight: bold;\n white-space: nowrap;\n }\n\n .sort-direction-container {\n display: flex;\n align-self: stretch;\n flex: 0;\n margin: 0 3px;\n }\n\n .sort-direction-selector {\n display: flex;\n justify-content: center;\n width: 30px;\n margin: 0 5px 0 0;\n padding: 7px 8px;\n max-height: fit-content;\n border-radius: 5px;\n background: white;\n border: 1px solid rgb(25, 72, 128);\n appearance: none;\n cursor: pointer;\n }\n\n .sort-direction-selector:disabled {\n cursor: not-allowed;\n border-color: ${disabledIconColor};\n }\n\n .sort-direction-icon {\n display: flex;\n align-items: center;\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n outline: inherit;\n width: 12px;\n height: 12px;\n }\n\n .sort-direction-icon > svg {\n flex: 1;\n }\n\n #sort-selector-container {\n flex: 1;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n }\n\n #sort-dropdown-container {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n }\n\n #sort-selector-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n z-index: 1;\n background-color: transparent;\n }\n\n #display-style-selector {\n flex: 0;\n }\n\n #display-style-selector button {\n background: none;\n color: inherit;\n border: none;\n appearance: none;\n cursor: pointer;\n -webkit-appearance: none;\n fill: ${disabledIconColor};\n }\n\n #display-style-selector button.active {\n fill: var(--ia-theme-primary-text-color, #2c2c2c);\n }\n\n #display-style-selector button svg {\n width: 24px;\n height: 24px;\n }\n\n ia-dropdown {\n --dropdownTextColor: white;\n --dropdownOffsetTop: 0;\n --dropdownBorderTopWidth: 0;\n --dropdownBorderTopLeftRadius: 0;\n --dropdownBorderTopRightRadius: 0;\n --dropdownWhiteSpace: nowrap;\n --dropdownListZIndex: 2;\n --dropdownCaretColor: var(--ia-theme-primary-text-color, #2c2c2c);\n --dropdownSelectedTextColor: white;\n --dropdownSelectedBgColor: rgba(255, 255, 255, 0.3);\n --dropdownHoverBgColor: rgba(255, 255, 255, 0.3);\n --caretHeight: 9px;\n --caretWidth: 12px;\n --caretPadding: 0 5px 0 0;\n }\n ia-dropdown.selected .dropdown-label {\n font-weight: bold;\n }\n ia-dropdown.open {\n z-index: 2;\n }\n\n .dropdown-label {\n display: inline-block;\n height: 100%;\n padding-left: 5px;\n font-size: 1.4rem;\n font-family: var(--ia-theme-base-font-family);\n line-height: 2;\n color: var(--ia-theme-primary-text-color, #2c2c2c);\n white-space: nowrap;\n user-select: none;\n }\n `,\n ];\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "The Internet Archive Collection Browser.",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"author": "Internet Archive",
|
|
6
|
-
"version": "4.1.0-alpha-webdev8186.
|
|
6
|
+
"version": "4.1.0-alpha-webdev8186.1",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
9
9
|
"scripts": {
|
|
@@ -555,6 +555,8 @@ export class SortFilterBar extends LitElement {
|
|
|
555
555
|
}
|
|
556
556
|
|
|
557
557
|
static get styles() {
|
|
558
|
+
const disabledIconColor = css`#bbbbbb`;
|
|
559
|
+
|
|
558
560
|
return [
|
|
559
561
|
srOnlyStyle,
|
|
560
562
|
css`
|
|
@@ -599,14 +601,14 @@ export class SortFilterBar extends LitElement {
|
|
|
599
601
|
display: flex;
|
|
600
602
|
align-self: stretch;
|
|
601
603
|
flex: 0;
|
|
602
|
-
margin: 0
|
|
604
|
+
margin: 0 3px;
|
|
603
605
|
}
|
|
604
606
|
|
|
605
607
|
.sort-direction-selector {
|
|
606
608
|
display: flex;
|
|
607
609
|
justify-content: center;
|
|
608
610
|
width: 30px;
|
|
609
|
-
margin: 0 5px 0
|
|
611
|
+
margin: 0 5px 0 0;
|
|
610
612
|
padding: 7px 8px;
|
|
611
613
|
max-height: fit-content;
|
|
612
614
|
border-radius: 5px;
|
|
@@ -617,7 +619,8 @@ export class SortFilterBar extends LitElement {
|
|
|
617
619
|
}
|
|
618
620
|
|
|
619
621
|
.sort-direction-selector:disabled {
|
|
620
|
-
cursor:
|
|
622
|
+
cursor: not-allowed;
|
|
623
|
+
border-color: ${disabledIconColor};
|
|
621
624
|
}
|
|
622
625
|
|
|
623
626
|
.sort-direction-icon {
|
|
@@ -670,7 +673,7 @@ export class SortFilterBar extends LitElement {
|
|
|
670
673
|
appearance: none;
|
|
671
674
|
cursor: pointer;
|
|
672
675
|
-webkit-appearance: none;
|
|
673
|
-
fill:
|
|
676
|
+
fill: ${disabledIconColor};
|
|
674
677
|
}
|
|
675
678
|
|
|
676
679
|
#display-style-selector button.active {
|