@internetarchive/collection-browser 4.10.1 → 4.10.2-webdev-9737.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manag
5
5
  import { SelectedFacets, FacetOption } from '../models';
6
6
  import type { CollectionTitles, PageSpecifierParams, TVChannelAliases } from '../data-source/models';
7
7
  import '@internetarchive/elements/ia-status-indicator/ia-status-indicator';
8
- import '@internetarchive/ia-clearable-text-input';
8
+ import '@internetarchive/elements/ia-clearable-text-input/ia-clearable-text-input';
9
9
  import './more-facets-scroller';
10
10
  import './toggle-switch';
11
11
  export declare class MoreFacetsContent extends LitElement {
@@ -8,7 +8,7 @@ import { SearchType, AggregationSortType, } from '@internetarchive/search-servic
8
8
  import { localized, msg, str } from '@lit/localize';
9
9
  import { facetTitles, facetPluralTitles, suppressedCollections, valueFacetSort, defaultFacetSort, getDefaultSelectedFacets, tvMoreFacetSort, } from '../models';
10
10
  import '@internetarchive/elements/ia-status-indicator/ia-status-indicator';
11
- import '@internetarchive/ia-clearable-text-input';
11
+ import '@internetarchive/elements/ia-clearable-text-input/ia-clearable-text-input';
12
12
  import './more-facets-scroller';
13
13
  import { analyticsActions, analyticsCategories, } from '../utils/analytics-events';
14
14
  import './toggle-switch';
@@ -1 +1 @@
1
- {"version":3,"file":"more-facets-content.js","sourceRoot":"","sources":["../../../src/collection-facets/more-facets-content.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EACV,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,IAAI,E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,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2DACA;AAK5B;IAAhB,KAAK,EAAE;uDAAoD;AAK3C;IAAhB,KAAK,EAAE;qDAAiC;AAQxB;IAAhB,KAAK,EAAE;gEACqB;AAKZ;IAAhB,KAAK,EAAE;qDAAyB;AAMhB;IAAhB,KAAK,EAAE;qDAA4B;AA4B5B;IADP,KAAK,CAAC,sBAAsB,CAAC;mDACQ;AAG9B;IADP,KAAK,CAAC,yBAAyB,CAAC;sDACC;AArGvB,iBAAiB;IAF7B,aAAa,CAAC,qBAAqB,CAAC;IACpC,SAAS,EAAE;GACC,iBAAiB,CA+2B7B","sourcesContent":["import {\n css,\n CSSResultGroup,\n html,\n LitElement,\n nothing,\n PropertyValues,\n TemplateResult,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { when } from 'lit/directives/when.js';\nimport {\n Aggregation,\n Bucket,\n SearchServiceInterface,\n SearchParams,\n SearchType,\n AggregationSortType,\n FilterMap,\n PageType,\n} from '@internetarchive/search-service';\nimport type { ModalManagerInterface } from '@internetarchive/modal-manager';\nimport type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';\nimport { localized, msg, str } from '@lit/localize';\nimport {\n SelectedFacets,\n FacetGroup,\n FacetBucket,\n FacetOption,\n facetTitles,\n facetPluralTitles,\n suppressedCollections,\n valueFacetSort,\n defaultFacetSort,\n getDefaultSelectedFacets,\n FacetEventDetails,\n tvMoreFacetSort,\n} from '../models';\nimport type {\n CollectionTitles,\n PageSpecifierParams,\n TVChannelAliases,\n} from '../data-source/models';\nimport '@internetarchive/elements/ia-status-indicator/ia-status-indicator';\nimport '@internetarchive/ia-clearable-text-input';\nimport './more-facets-scroller';\nimport type { MoreFacetsScroller } from './more-facets-scroller';\nimport {\n analyticsActions,\n analyticsCategories,\n} from '../utils/analytics-events';\nimport './toggle-switch';\nimport { srOnlyStyle } from '../styles/sr-only';\nimport checkIcon from '../assets/img/icons/check';\nimport eyeClosedIcon from '../assets/img/icons/eye-closed';\nimport closeCircleDark from '../assets/img/icons/close-circle-dark';\nimport {\n mergeSelectedFacets,\n updateSelectedFacetBucket,\n} from '../utils/facet-utils';\nimport {\n filterTextIncludes,\n normalizeFilterText,\n type NormalizedFilterText,\n} from '../utils/normalize-filter-text';\nimport { log } from '../utils/log';\nimport { MORE_FACETS__MAX_AGGREGATIONS } from './models';\n\n@customElement('more-facets-content')\n@localized()\nexport class MoreFacetsContent extends LitElement {\n @property({ type: String }) facetKey?: FacetOption;\n\n @property({ type: String }) query?: string;\n\n @property({ type: Array }) identifiers?: string[];\n\n @property({ type: Object }) filterMap?: FilterMap;\n\n @property({ type: Number }) searchType?: SearchType;\n\n @property({ type: Object }) pageSpecifierParams?: PageSpecifierParams;\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @property({ type: Object })\n tvChannelAliases?: TVChannelAliases;\n\n /**\n * Whether we are waiting for facet data to load.\n * We begin with this set to true so that we show an initial loading indicator.\n */\n @property({ type: Boolean }) facetsLoading = true;\n\n /**\n * The set of pre-existing facet selections (including both selected & negated facets).\n */\n @property({ type: Object }) selectedFacets?: SelectedFacets;\n\n @property({ type: Number }) sortedBy: AggregationSortType =\n AggregationSortType.COUNT;\n\n @property({ type: Boolean }) isTvSearch = false;\n\n @property({ type: Object }) modalManager?: ModalManagerInterface;\n\n @property({ type: Object }) searchService?: SearchServiceInterface;\n\n @property({ type: Object, attribute: false })\n analyticsHandler?: AnalyticsManagerInterface;\n\n /**\n * The full set of aggregations received from the search service\n */\n @state() private aggregations?: Record<string, Aggregation>;\n\n /**\n * A FacetGroup storing the full set of facet buckets to be shown on the dialog.\n */\n @state() private facetGroup?: FacetGroup;\n\n /**\n * An object holding any changes the patron has made to their facet selections\n * within the modal dialog but which they have not yet applied. These are\n * eventually merged into the existing `selectedFacets` when the patron applies\n * their changes, or discarded if they cancel/close the dialog.\n */\n @state() private unappliedFacetChanges: SelectedFacets =\n getDefaultSelectedFacets();\n\n /**\n * Text the patron has entered to narrow down the facet values shown.\n */\n @state() private filterText = '';\n\n /**\n * Whether the search for this facet's values failed, either with an error\n * result or by throwing.\n */\n @state() private loadFailed = false;\n\n /**\n * The buckets from `facetGroup` that match `filterText`, in display order.\n * Derived in `willUpdate`.\n */\n private filteredBuckets: FacetBucket[] = [];\n\n /**\n * Each bucket's display text in the normalized form that filtering compares\n * against, keyed by bucket key. Filled lazily so that each value is only\n * normalized once, however many times the filter text changes.\n */\n private filterKeys = new Map<string, NormalizedFilterText>();\n\n /**\n * The values currently selected or hidden, in the order they were selected.\n * Shown as chiclets above the list. Derived in `willUpdate`.\n */\n private chosenBuckets: FacetBucket[] = [];\n\n /**\n * Position of a chiclet that was just removed, whose neighbor should get\n * focus once it's gone.\n */\n private chicletFocusIndex?: number;\n\n @query('more-facets-scroller')\n private scroller?: MoreFacetsScroller;\n\n @query('ia-clearable-text-input')\n private filterInput?: HTMLElement;\n\n willUpdate(changed: PropertyValues): void {\n if (changed.has('aggregations')) {\n this.filterKeys.clear();\n }\n\n const facetGroupChanged =\n changed.has('aggregations') ||\n changed.has('sortedBy') ||\n changed.has('selectedFacets') ||\n changed.has('unappliedFacetChanges');\n if (facetGroupChanged) {\n // Convert the merged selected facets & aggregations into a facet group\n this.facetGroup = this.mergedFacets;\n this.chosenBuckets = this.listChosenBuckets();\n }\n\n if (facetGroupChanged || changed.has('filterText')) {\n this.filteredBuckets = this.filterBuckets();\n }\n\n // If any of the search properties change, it triggers a facet fetch\n if (\n changed.has('facetKey') ||\n changed.has('query') ||\n changed.has('searchType') ||\n changed.has('filterMap')\n ) {\n this.facetsLoading = true;\n this.loadFailed = false;\n this.sortedBy =\n this.searchType === SearchType.TV\n ? tvMoreFacetSort[this.facetKey as FacetOption]\n : defaultFacetSort[this.facetKey as FacetOption];\n\n this.updateSpecificFacets();\n }\n }\n\n updated(changed: PropertyValues): void {\n // A new filter or sort order shows different values, so start over from\n // the first page rather than somewhere in the middle of them.\n if (changed.has('filterText') || changed.has('sortedBy')) {\n this.scroller?.scrollToPage(0);\n }\n\n // A removed chiclet took its focused button with it; move focus to the\n // chiclet that took its place, or back to the filter field if none are left.\n if (this.chicletFocusIndex !== undefined) {\n const buttons =\n this.shadowRoot?.querySelectorAll<HTMLElement>('.chiclet-remove') ?? [];\n const index = Math.min(this.chicletFocusIndex, buttons.length - 1);\n this.chicletFocusIndex = undefined;\n (buttons[index] ?? this.filterInput)?.focus();\n }\n }\n\n firstUpdated(): void {\n this.setupEscapeListeners();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('keydown', this.escapeHandler);\n }\n\n /**\n * Close more facets modal on Escape click\n */\n private escapeHandler = (e: KeyboardEvent): void => {\n if (e.key === 'Escape') this.modalManager?.closeModal();\n };\n\n private setupEscapeListeners() {\n if (this.modalManager) {\n document.addEventListener('keydown', this.escapeHandler);\n }\n }\n\n /**\n * Whether facet requests are for the search_results page type (either defaulted or explicitly).\n */\n private get isSearchResultsPage(): boolean {\n // Default page type is search_results when none is specified, so we check\n // for undefined as well.\n const pageType: PageType | undefined = this.pageSpecifierParams?.pageType;\n return pageType === undefined || pageType === 'search_results';\n }\n\n /**\n * Get specific facets data from search-service API based of currently query params\n * - this.aggregations - hold result of search service and being used for further processing.\n */\n async updateSpecificFacets(): Promise<void> {\n if (!this.facetKey) return; // Can't fetch facets if we don't know what type of facets we need!\n\n const trimmedQuery = this.query?.trim();\n if (!trimmedQuery && this.isSearchResultsPage) return; // The search page _requires_ a query\n\n const aggregations = {\n simpleParams: [this.facetKey],\n };\n const aggregationsSize = MORE_FACETS__MAX_AGGREGATIONS; // Only request the 10K highest-count facets\n\n const params: SearchParams = {\n ...this.pageSpecifierParams,\n query: trimmedQuery || '',\n identifiers: this.identifiers,\n filters: this.filterMap,\n aggregations,\n aggregationsSize,\n rows: 0, // todo - do we want server-side pagination with offset/page/limit flag?\n };\n\n try {\n const results = await this.searchService?.search(params, this.searchType);\n const response = results?.success?.response;\n if (!response) {\n log('More facets search failed', results?.error);\n this.loadFailed = true;\n this.aggregations = undefined;\n return;\n }\n\n // Record collection titles before the aggregations, so that they're\n // available for sorting & filtering once the facet group is built.\n const { collectionTitles } = response;\n if (collectionTitles) {\n for (const [id, title] of Object.entries(collectionTitles)) {\n this.collectionTitles?.set(id, title);\n }\n }\n\n this.aggregations = response.aggregations;\n } catch (err) {\n log('More facets search threw', err);\n this.loadFailed = true;\n this.aggregations = undefined;\n } finally {\n this.facetsLoading = false;\n }\n }\n\n /**\n * Combines the selected facets with the aggregations into the single list of\n * values the dialog shows. Selected and hidden values keep their place in the\n * current sort order rather than moving to the front; the chiclets above the\n * list are what call them out.\n */\n private get mergedFacets(): FacetGroup | undefined {\n if (!this.facetKey || !this.selectedFacets) return undefined;\n\n const { aggregationFacetGroup } = this;\n\n // If we don't have any aggregations, then there is nothing to show yet\n if (!aggregationFacetGroup) return undefined;\n\n const selections = this.currentSelections;\n\n // Mark each aggregated value with its selection state, if it has one\n const buckets = aggregationFacetGroup.buckets.map(bucket => {\n const selection = selections[bucket.key];\n return selection ? { ...bucket, state: selection.state } : bucket;\n });\n\n // Values selected before the dialog opened can be missing from the\n // aggregations (a hidden value is excluded from the results it would be\n // counted in). Slot them in where the current sort puts them, so they can\n // still be changed from the list.\n const aggregatedKeys = new Set(buckets.map(b => b.key));\n const preexisting = this.selectedFacets[this.facetKey] ?? {};\n for (const [key, data] of Object.entries(preexisting)) {\n if (aggregatedKeys.has(key)) continue;\n this.insertInSortOrder(buckets, {\n displayText: this.displayTextFor(key),\n key,\n count: data.count,\n state: selections[key]?.state ?? data.state,\n });\n }\n\n // For TV creator facets, uppercase the display text\n if (this.facetKey === 'creator' && this.isTvSearch) {\n buckets.forEach(b => {\n b.displayText = (b.displayText ?? b.key)?.toLocaleUpperCase();\n\n const channelLabel = this.tvChannelAliases?.get(b.displayText);\n if (channelLabel && channelLabel !== b.displayText) {\n b.extraNote = `(${channelLabel})`;\n }\n });\n }\n\n return { ...aggregationFacetGroup, buckets };\n }\n\n /**\n * This facet type's selections: the ones made before the dialog opened,\n * overridden by any unapplied changes made in it. Values stay in the order\n * they were first selected, and cleared ones remain with state `'none'`.\n */\n private get currentSelections(): Record<string, FacetBucket> {\n if (!this.facetKey) return {};\n return {\n ...this.selectedFacets?.[this.facetKey],\n ...this.unappliedFacetChanges[this.facetKey],\n };\n }\n\n /**\n * The values that are currently selected or hidden, in the order they were\n * selected, as they appear in `facetGroup`.\n */\n private listChosenBuckets(): FacetBucket[] {\n const byKey = new Map(this.facetGroup?.buckets.map(b => [b.key, b]));\n // Without a list (e.g. the search failed), fall back on the selections\n // themselves, so they can still be seen and cleared.\n return Object.entries(this.currentSelections)\n .map(\n ([key, selection]) =>\n byKey.get(key) ?? {\n ...selection,\n displayText: this.displayTextFor(key),\n },\n )\n .filter(bucket => bucket.state !== 'none');\n }\n\n /**\n * Inserts `bucket` ahead of the first bucket that the current sort would put\n * after it.\n */\n private insertInSortOrder(buckets: FacetBucket[], bucket: FacetBucket): void {\n const index = buckets.findIndex(b => this.compareForSort(bucket, b) < 0);\n buckets.splice(index === -1 ? buckets.length : index, 0, bucket);\n }\n\n /**\n * Orders two buckets the way the aggregations are ordered for the current\n * sort (see `getSortedBuckets` in search-service).\n */\n private compareForSort(a: FacetBucket, b: FacetBucket): number {\n switch (this.sortedBy) {\n case AggregationSortType.ALPHABETICAL:\n return (a.displayText ?? a.key).localeCompare(b.displayText ?? b.key);\n case AggregationSortType.NUMERIC:\n return Number(b.key) - Number(a.key);\n default:\n return b.count - a.count;\n }\n }\n\n /**\n * The text patrons see for a bucket: the collection title for collections,\n * and the bucket key for everything else.\n */\n private displayTextFor(key: string): string {\n const collectionTitle =\n this.facetKey === 'collection'\n ? this.collectionTitles?.get(key)\n : undefined;\n return collectionTitle ?? key;\n }\n\n /**\n * Converts the raw `aggregations` for the current facet key to a `FacetGroup`,\n * which is easier to work with.\n */\n private get aggregationFacetGroup(): FacetGroup | undefined {\n if (!this.aggregations || !this.facetKey) return undefined;\n\n const currentAggregation = this.aggregations[this.facetKey];\n if (!currentAggregation) return undefined;\n\n const facetGroupTitle = facetTitles[this.facetKey];\n\n // Order the facets according to the current sort option\n let sortedBuckets = currentAggregation.getSortedBuckets(\n this.sortedBy,\n ) as Bucket[];\n\n if (this.facetKey === 'collection') {\n // we are not showing fav- collections or certain deemphasized collections in facets\n sortedBuckets = sortedBuckets?.filter(bucket => {\n const bucketKey = bucket?.key?.toString();\n return (\n !suppressedCollections[bucketKey] && !bucketKey?.startsWith('fav-')\n );\n });\n }\n\n // Construct the array of facet buckets from the aggregation buckets\n const facetBuckets: FacetBucket[] = sortedBuckets.map(bucket => {\n const bucketKeyStr = `${bucket.key}`;\n return {\n displayText: this.displayTextFor(bucketKeyStr),\n key: bucketKeyStr,\n count: bucket.doc_count,\n state: 'none',\n };\n });\n\n // Collections sorted alphabetically should be in order of the titles\n // patrons see, not of the identifiers that getSortedBuckets used.\n if (\n this.facetKey === 'collection' &&\n this.sortedBy === AggregationSortType.ALPHABETICAL\n ) {\n facetBuckets.sort((a, b) =>\n (a.displayText ?? a.key).localeCompare(b.displayText ?? b.key),\n );\n }\n\n return {\n title: facetGroupTitle,\n key: this.facetKey,\n buckets: facetBuckets,\n };\n }\n\n /**\n * The buckets whose visible text contains the filter text, ignoring case,\n * accents and punctuation.\n */\n private filterBuckets(): FacetBucket[] {\n const buckets = this.facetGroup?.buckets ?? [];\n const needle = normalizeFilterText(this.filterText);\n if (!needle.spaced) return buckets;\n return buckets.filter(bucket =>\n filterTextIncludes(this.filterKeyFor(bucket), needle),\n );\n }\n\n private filterKeyFor(bucket: FacetBucket): NormalizedFilterText {\n let filterKey = this.filterKeys.get(bucket.key);\n if (filterKey === undefined) {\n const visibleText = [bucket.displayText ?? bucket.key, bucket.extraNote]\n .filter(Boolean)\n .join(' ');\n filterKey = normalizeFilterText(visibleText);\n this.filterKeys.set(bucket.key, filterKey);\n }\n return filterKey;\n }\n\n /**\n * Whether the patron's filter text has ruled out every value\n */\n private get noValuesMatch(): boolean {\n const isFiltering = normalizeFilterText(this.filterText).spaced !== '';\n return isFiltering && this.filteredBuckets.length === 0;\n }\n\n private get moreFacetsTemplate(): TemplateResult {\n const valuesLabel = this.facetKey\n ? msg(str`${facetTitles[this.facetKey]} values`)\n : undefined;\n return html`\n <more-facets-scroller\n .facetType=${this.facetKey}\n .buckets=${this.filteredBuckets}\n .collectionTitles=${this.collectionTitles}\n ?omitHideButtons=${this.facetGroup?.buckets.length === 1}\n label=${ifDefined(valuesLabel)}\n @facetClick=${this.facetClicked}\n @pageChanged=${this.pageChanged}\n ></more-facets-scroller>\n ${when(\n this.loadFailed,\n () => this.loadErrorTemplate,\n () => when(this.noValuesMatch, () => this.noMatchesTemplate),\n )}\n `;\n }\n\n /**\n * A chiclet for each selected or hidden value, each with a button to clear it\n */\n private get chicletsTemplate(): TemplateResult {\n const valuesName = this.facetKey ? facetPluralTitles[this.facetKey] : '';\n return html`\n <ul class=\"chiclets\" aria-label=${msg(str`Selected ${valuesName}`)}>\n ${repeat(\n this.chosenBuckets,\n bucket => bucket.key,\n (bucket, index) => this.chicletTemplate(bucket, index),\n )}\n </ul>\n `;\n }\n\n private chicletTemplate(bucket: FacetBucket, index: number): TemplateResult {\n const isHidden = bucket.state === 'hidden';\n const text = [bucket.displayText ?? bucket.key, bucket.extraNote]\n .filter(Boolean)\n .join(' ');\n const removeLabel = isHidden\n ? msg(str`Unhide ${text}`)\n : msg(str`Deselect ${text}`);\n\n return html`\n <li class=\"chiclet\" title=${text}>\n <span class=\"chiclet-icon\" aria-hidden=\"true\"\n >${isHidden ? eyeClosedIcon : checkIcon}</span\n >\n <span class=\"sr-only\"\n >${isHidden ? msg('Hidden:') : msg('Selected:')}</span\n >\n <span class=\"chiclet-text\">${text}</span>\n <button\n type=\"button\"\n class=\"chiclet-remove\"\n aria-label=${removeLabel}\n @click=${() => this.chicletRemoved(bucket, index)}\n >\n ${closeCircleDark}\n </button>\n </li>\n `;\n }\n\n private get noMatchesTemplate(): TemplateResult {\n return html`<p class=\"facets-message no-matches\" role=\"status\">\n ${msg('No matching values found.')}\n </p>`;\n }\n\n private get loadErrorTemplate(): TemplateResult {\n return html`<p class=\"facets-message load-error\" role=\"alert\">\n ${msg('Sorry, these values couldn’t be loaded. Please try again later.')}\n </p>`;\n }\n\n private get loaderTemplate(): TemplateResult {\n return html`\n <ia-status-indicator\n class=\"facets-loader\"\n mode=\"loading\"\n ></ia-status-indicator>\n `;\n }\n\n private get footerTemplate(): TemplateResult {\n return html`\n <div class=\"footer\">\n <button class=\"btn btn-cancel\" type=\"button\" @click=${this.cancelClick}>\n ${msg('Cancel')}\n </button>\n <button\n class=\"btn btn-submit\"\n type=\"button\"\n @click=${this.applySearchFacetsClicked}\n >\n ${msg('Apply filters')}\n </button>\n </div>\n `;\n }\n\n private sortFacetAggregation(facetSortType: AggregationSortType) {\n this.sortedBy = facetSortType;\n this.dispatchEvent(\n new CustomEvent('sortedFacets', { detail: this.sortedBy }),\n );\n }\n\n private get modalHeaderTemplate(): TemplateResult {\n const facetSort =\n this.sortedBy ?? defaultFacetSort[this.facetKey as FacetOption];\n const defaultSwitchSide =\n facetSort === AggregationSortType.COUNT ? 'left' : 'right';\n const valuesName = this.facetKey ? facetPluralTitles[this.facetKey] : '';\n // From the facet key rather than the facet group, which is missing\n // until the values load (or if they fail to)\n const title = this.facetKey ? facetTitles[this.facetKey] : '';\n\n return html`<span class=\"sr-only\">${msg('More facets for:')}</span>\n <span class=\"title\">${title}</span>\n <span class=\"header-controls\">\n <span class=\"sort-controls\">\n <label class=\"sort-label\">${msg('Sort by:')}</label>\n ${this.facetKey\n ? html`<toggle-switch\n class=\"sort-toggle\"\n leftValue=${AggregationSortType.COUNT}\n leftLabel=${msg('Count')}\n rightValue=${valueFacetSort[this.facetKey]}\n .rightLabel=${title}\n side=${defaultSwitchSide}\n @change=${(e: CustomEvent<string>) => {\n this.sortFacetAggregation(\n Number(e.detail) as AggregationSortType,\n );\n }}\n ></toggle-switch>`\n : nothing}\n </span>\n <span class=\"filter-controls\">\n <label class=\"filter-label\">${msg('Filter by:')}</label>\n <ia-clearable-text-input\n class=\"filter-input\"\n .value=${this.filterText}\n .placeholder=${msg(str`Search ${valuesName}…`)}\n .screenReaderLabel=${msg(str`Filter ${valuesName}`)}\n .clearButtonScreenReaderLabel=${msg('Clear filter')}\n @input=${this.filterTextChanged}\n ></ia-clearable-text-input>\n </span>\n </span>`;\n }\n\n render() {\n return html`\n ${this.facetsLoading\n ? this.loaderTemplate\n : html`\n <section id=\"more-facets\">\n <div class=\"header-content\">${this.modalHeaderTemplate}</div>\n ${when(this.chosenBuckets.length, () => this.chicletsTemplate)}\n <div class=\"facets-content\">${this.moreFacetsTemplate}</div>\n ${this.footerTemplate}\n </section>\n `}\n `;\n }\n\n /**\n * Handler for typing in (or clearing) the filter text field\n */\n private filterTextChanged(e: Event): void {\n const input = e.target as HTMLElement & { value: string };\n this.filterText = input.value;\n }\n\n private facetClicked(e: CustomEvent<FacetEventDetails>): void {\n if (!this.facetKey) return;\n this.unappliedFacetChanges = updateSelectedFacetBucket(\n this.unappliedFacetChanges,\n this.facetKey,\n e.detail.bucket,\n );\n }\n\n /**\n * Clears the selection a chiclet stands for, which removes the chiclet and\n * unchecks the value in the list.\n */\n private chicletRemoved(bucket: FacetBucket, index: number): void {\n if (!this.facetKey) return;\n this.unappliedFacetChanges = updateSelectedFacetBucket(\n this.unappliedFacetChanges,\n this.facetKey,\n { ...bucket, state: 'none' },\n );\n this.chicletFocusIndex = index;\n }\n\n private pageChanged(e: CustomEvent<number>): void {\n this.analyticsHandler?.sendEvent({\n category: analyticsCategories.default,\n action: analyticsActions.moreFacetsPageChange,\n label: `${e.detail + 1}`,\n });\n }\n\n private applySearchFacetsClicked() {\n const mergedSelections = mergeSelectedFacets(\n this.selectedFacets,\n this.unappliedFacetChanges,\n );\n\n const event = new CustomEvent<SelectedFacets>('facetsChanged', {\n detail: mergedSelections,\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(event);\n\n // Reset the unapplied changes back to default, now that they have been applied\n this.unappliedFacetChanges = getDefaultSelectedFacets();\n\n this.modalManager?.closeModal();\n this.analyticsHandler?.sendEvent({\n category: analyticsCategories.default,\n action: `${analyticsActions.applyMoreFacetsModal}`,\n label: `${this.facetKey}`,\n });\n }\n\n private cancelClick() {\n // Reset the unapplied changes back to default\n this.unappliedFacetChanges = getDefaultSelectedFacets();\n\n this.modalManager?.closeModal();\n this.analyticsHandler?.sendEvent({\n category: analyticsCategories.default,\n action: analyticsActions.closeMoreFacetsModal,\n label: `${this.facetKey}`,\n });\n }\n\n static get styles(): CSSResultGroup {\n const modalSubmitButton = css`var(--primaryButtonBGColor, #194880)`;\n\n return [\n srOnlyStyle,\n css`\n section#more-facets {\n padding: 10px;\n }\n\n .header-content .title {\n display: block;\n text-align: left;\n font-size: 1.8rem;\n padding: 0 10px;\n font-weight: bold;\n }\n\n .header-controls {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 8px 20px;\n padding: 5px 10px 0;\n }\n\n /* Each label stays on the same line as its control when these wrap */\n .sort-controls,\n .filter-controls {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n white-space: nowrap;\n }\n\n .sort-label,\n .filter-label {\n font-size: 1.3rem;\n }\n\n .sort-toggle {\n font-weight: normal;\n }\n\n .filter-input {\n --input-height: 2.5rem;\n --input-font-size: 1.3rem;\n --input-border-radius: 4px;\n --input-padding: 4px 8px;\n --input-focused-border-color: ${modalSubmitButton};\n width: 16rem;\n }\n\n .chiclets {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin: 0;\n padding: 10px 10px 0;\n list-style: none;\n /* About three rows; any more scroll, so the values stay in view */\n max-height: 7.8rem;\n overflow-y: auto;\n }\n\n .chiclet {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n max-width: 24rem;\n padding: 2px 3px 2px 6px;\n border: 1px solid ${modalSubmitButton};\n border-radius: 5px;\n background: #fff;\n color: #2c2c2c;\n font-size: 1.2rem;\n line-height: normal;\n }\n\n .chiclet-icon {\n display: flex;\n flex: none;\n }\n\n .chiclet-icon svg {\n width: 12px;\n height: 12px;\n }\n\n .chiclet-text {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n\n .chiclet-remove {\n display: flex;\n flex: none;\n padding: 2px;\n border: none;\n border-radius: 50%;\n background: none;\n cursor: pointer;\n }\n\n .chiclet-remove svg {\n width: 10px;\n height: 10px;\n opacity: 0.55;\n }\n\n .chiclet-remove:hover svg,\n .chiclet-remove:focus-visible svg {\n opacity: 1;\n }\n\n .facets-content {\n position: relative;\n font-size: 1.2rem;\n padding: 10px 0;\n }\n\n .facets-message {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0;\n font-size: 1.4rem;\n color: #666;\n }\n\n .facets-loader {\n --icon-width: 70px;\n margin-bottom: 20px;\n display: block;\n margin-left: auto;\n margin-right: auto;\n }\n .btn {\n border: none;\n padding: 10px;\n margin-bottom: 10px;\n width: auto;\n border-radius: 4px;\n cursor: pointer;\n font-family: inherit;\n }\n .btn-cancel {\n background-color: #2c2c2c;\n color: white;\n }\n .btn-submit {\n background-color: ${modalSubmitButton};\n color: white;\n }\n .footer {\n text-align: center;\n }\n\n @media (max-width: 560px) {\n /* The filter gets a line of its own here, so let it fill that line */\n .filter-controls {\n flex: 1 1 auto;\n }\n .filter-input {\n flex: 1 1 auto;\n width: auto;\n min-width: 12rem;\n --input-font-size: 1.2rem;\n }\n }\n `,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"more-facets-content.js","sourceRoot":"","sources":["../../../src/collection-facets/more-facets-content.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EACV,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAA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AAM,EAAE,CAAC;uDAAsC;AAErC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAwC;AAGnE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2DACA;AAK5B;IAAhB,KAAK,EAAE;uDAAoD;AAK3C;IAAhB,KAAK,EAAE;qDAAiC;AAQxB;IAAhB,KAAK,EAAE;gEACqB;AAKZ;IAAhB,KAAK,EAAE;qDAAyB;AAMhB;IAAhB,KAAK,EAAE;qDAA4B;AA4B5B;IADP,KAAK,CAAC,sBAAsB,CAAC;mDACQ;AAG9B;IADP,KAAK,CAAC,yBAAyB,CAAC;sDACC;AArGvB,iBAAiB;IAF7B,aAAa,CAAC,qBAAqB,CAAC;IACpC,SAAS,EAAE;GACC,iBAAiB,CA+2B7B","sourcesContent":["import {\n css,\n CSSResultGroup,\n html,\n LitElement,\n nothing,\n PropertyValues,\n TemplateResult,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { when } from 'lit/directives/when.js';\nimport {\n Aggregation,\n Bucket,\n SearchServiceInterface,\n SearchParams,\n SearchType,\n AggregationSortType,\n FilterMap,\n PageType,\n} from '@internetarchive/search-service';\nimport type { ModalManagerInterface } from '@internetarchive/modal-manager';\nimport type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';\nimport { localized, msg, str } from '@lit/localize';\nimport {\n SelectedFacets,\n FacetGroup,\n FacetBucket,\n FacetOption,\n facetTitles,\n facetPluralTitles,\n suppressedCollections,\n valueFacetSort,\n defaultFacetSort,\n getDefaultSelectedFacets,\n FacetEventDetails,\n tvMoreFacetSort,\n} from '../models';\nimport type {\n CollectionTitles,\n PageSpecifierParams,\n TVChannelAliases,\n} from '../data-source/models';\nimport '@internetarchive/elements/ia-status-indicator/ia-status-indicator';\nimport '@internetarchive/elements/ia-clearable-text-input/ia-clearable-text-input';\nimport './more-facets-scroller';\nimport type { MoreFacetsScroller } from './more-facets-scroller';\nimport {\n analyticsActions,\n analyticsCategories,\n} from '../utils/analytics-events';\nimport './toggle-switch';\nimport { srOnlyStyle } from '../styles/sr-only';\nimport checkIcon from '../assets/img/icons/check';\nimport eyeClosedIcon from '../assets/img/icons/eye-closed';\nimport closeCircleDark from '../assets/img/icons/close-circle-dark';\nimport {\n mergeSelectedFacets,\n updateSelectedFacetBucket,\n} from '../utils/facet-utils';\nimport {\n filterTextIncludes,\n normalizeFilterText,\n type NormalizedFilterText,\n} from '../utils/normalize-filter-text';\nimport { log } from '../utils/log';\nimport { MORE_FACETS__MAX_AGGREGATIONS } from './models';\n\n@customElement('more-facets-content')\n@localized()\nexport class MoreFacetsContent extends LitElement {\n @property({ type: String }) facetKey?: FacetOption;\n\n @property({ type: String }) query?: string;\n\n @property({ type: Array }) identifiers?: string[];\n\n @property({ type: Object }) filterMap?: FilterMap;\n\n @property({ type: Number }) searchType?: SearchType;\n\n @property({ type: Object }) pageSpecifierParams?: PageSpecifierParams;\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @property({ type: Object })\n tvChannelAliases?: TVChannelAliases;\n\n /**\n * Whether we are waiting for facet data to load.\n * We begin with this set to true so that we show an initial loading indicator.\n */\n @property({ type: Boolean }) facetsLoading = true;\n\n /**\n * The set of pre-existing facet selections (including both selected & negated facets).\n */\n @property({ type: Object }) selectedFacets?: SelectedFacets;\n\n @property({ type: Number }) sortedBy: AggregationSortType =\n AggregationSortType.COUNT;\n\n @property({ type: Boolean }) isTvSearch = false;\n\n @property({ type: Object }) modalManager?: ModalManagerInterface;\n\n @property({ type: Object }) searchService?: SearchServiceInterface;\n\n @property({ type: Object, attribute: false })\n analyticsHandler?: AnalyticsManagerInterface;\n\n /**\n * The full set of aggregations received from the search service\n */\n @state() private aggregations?: Record<string, Aggregation>;\n\n /**\n * A FacetGroup storing the full set of facet buckets to be shown on the dialog.\n */\n @state() private facetGroup?: FacetGroup;\n\n /**\n * An object holding any changes the patron has made to their facet selections\n * within the modal dialog but which they have not yet applied. These are\n * eventually merged into the existing `selectedFacets` when the patron applies\n * their changes, or discarded if they cancel/close the dialog.\n */\n @state() private unappliedFacetChanges: SelectedFacets =\n getDefaultSelectedFacets();\n\n /**\n * Text the patron has entered to narrow down the facet values shown.\n */\n @state() private filterText = '';\n\n /**\n * Whether the search for this facet's values failed, either with an error\n * result or by throwing.\n */\n @state() private loadFailed = false;\n\n /**\n * The buckets from `facetGroup` that match `filterText`, in display order.\n * Derived in `willUpdate`.\n */\n private filteredBuckets: FacetBucket[] = [];\n\n /**\n * Each bucket's display text in the normalized form that filtering compares\n * against, keyed by bucket key. Filled lazily so that each value is only\n * normalized once, however many times the filter text changes.\n */\n private filterKeys = new Map<string, NormalizedFilterText>();\n\n /**\n * The values currently selected or hidden, in the order they were selected.\n * Shown as chiclets above the list. Derived in `willUpdate`.\n */\n private chosenBuckets: FacetBucket[] = [];\n\n /**\n * Position of a chiclet that was just removed, whose neighbor should get\n * focus once it's gone.\n */\n private chicletFocusIndex?: number;\n\n @query('more-facets-scroller')\n private scroller?: MoreFacetsScroller;\n\n @query('ia-clearable-text-input')\n private filterInput?: HTMLElement;\n\n willUpdate(changed: PropertyValues): void {\n if (changed.has('aggregations')) {\n this.filterKeys.clear();\n }\n\n const facetGroupChanged =\n changed.has('aggregations') ||\n changed.has('sortedBy') ||\n changed.has('selectedFacets') ||\n changed.has('unappliedFacetChanges');\n if (facetGroupChanged) {\n // Convert the merged selected facets & aggregations into a facet group\n this.facetGroup = this.mergedFacets;\n this.chosenBuckets = this.listChosenBuckets();\n }\n\n if (facetGroupChanged || changed.has('filterText')) {\n this.filteredBuckets = this.filterBuckets();\n }\n\n // If any of the search properties change, it triggers a facet fetch\n if (\n changed.has('facetKey') ||\n changed.has('query') ||\n changed.has('searchType') ||\n changed.has('filterMap')\n ) {\n this.facetsLoading = true;\n this.loadFailed = false;\n this.sortedBy =\n this.searchType === SearchType.TV\n ? tvMoreFacetSort[this.facetKey as FacetOption]\n : defaultFacetSort[this.facetKey as FacetOption];\n\n this.updateSpecificFacets();\n }\n }\n\n updated(changed: PropertyValues): void {\n // A new filter or sort order shows different values, so start over from\n // the first page rather than somewhere in the middle of them.\n if (changed.has('filterText') || changed.has('sortedBy')) {\n this.scroller?.scrollToPage(0);\n }\n\n // A removed chiclet took its focused button with it; move focus to the\n // chiclet that took its place, or back to the filter field if none are left.\n if (this.chicletFocusIndex !== undefined) {\n const buttons =\n this.shadowRoot?.querySelectorAll<HTMLElement>('.chiclet-remove') ?? [];\n const index = Math.min(this.chicletFocusIndex, buttons.length - 1);\n this.chicletFocusIndex = undefined;\n (buttons[index] ?? this.filterInput)?.focus();\n }\n }\n\n firstUpdated(): void {\n this.setupEscapeListeners();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('keydown', this.escapeHandler);\n }\n\n /**\n * Close more facets modal on Escape click\n */\n private escapeHandler = (e: KeyboardEvent): void => {\n if (e.key === 'Escape') this.modalManager?.closeModal();\n };\n\n private setupEscapeListeners() {\n if (this.modalManager) {\n document.addEventListener('keydown', this.escapeHandler);\n }\n }\n\n /**\n * Whether facet requests are for the search_results page type (either defaulted or explicitly).\n */\n private get isSearchResultsPage(): boolean {\n // Default page type is search_results when none is specified, so we check\n // for undefined as well.\n const pageType: PageType | undefined = this.pageSpecifierParams?.pageType;\n return pageType === undefined || pageType === 'search_results';\n }\n\n /**\n * Get specific facets data from search-service API based of currently query params\n * - this.aggregations - hold result of search service and being used for further processing.\n */\n async updateSpecificFacets(): Promise<void> {\n if (!this.facetKey) return; // Can't fetch facets if we don't know what type of facets we need!\n\n const trimmedQuery = this.query?.trim();\n if (!trimmedQuery && this.isSearchResultsPage) return; // The search page _requires_ a query\n\n const aggregations = {\n simpleParams: [this.facetKey],\n };\n const aggregationsSize = MORE_FACETS__MAX_AGGREGATIONS; // Only request the 10K highest-count facets\n\n const params: SearchParams = {\n ...this.pageSpecifierParams,\n query: trimmedQuery || '',\n identifiers: this.identifiers,\n filters: this.filterMap,\n aggregations,\n aggregationsSize,\n rows: 0, // todo - do we want server-side pagination with offset/page/limit flag?\n };\n\n try {\n const results = await this.searchService?.search(params, this.searchType);\n const response = results?.success?.response;\n if (!response) {\n log('More facets search failed', results?.error);\n this.loadFailed = true;\n this.aggregations = undefined;\n return;\n }\n\n // Record collection titles before the aggregations, so that they're\n // available for sorting & filtering once the facet group is built.\n const { collectionTitles } = response;\n if (collectionTitles) {\n for (const [id, title] of Object.entries(collectionTitles)) {\n this.collectionTitles?.set(id, title);\n }\n }\n\n this.aggregations = response.aggregations;\n } catch (err) {\n log('More facets search threw', err);\n this.loadFailed = true;\n this.aggregations = undefined;\n } finally {\n this.facetsLoading = false;\n }\n }\n\n /**\n * Combines the selected facets with the aggregations into the single list of\n * values the dialog shows. Selected and hidden values keep their place in the\n * current sort order rather than moving to the front; the chiclets above the\n * list are what call them out.\n */\n private get mergedFacets(): FacetGroup | undefined {\n if (!this.facetKey || !this.selectedFacets) return undefined;\n\n const { aggregationFacetGroup } = this;\n\n // If we don't have any aggregations, then there is nothing to show yet\n if (!aggregationFacetGroup) return undefined;\n\n const selections = this.currentSelections;\n\n // Mark each aggregated value with its selection state, if it has one\n const buckets = aggregationFacetGroup.buckets.map(bucket => {\n const selection = selections[bucket.key];\n return selection ? { ...bucket, state: selection.state } : bucket;\n });\n\n // Values selected before the dialog opened can be missing from the\n // aggregations (a hidden value is excluded from the results it would be\n // counted in). Slot them in where the current sort puts them, so they can\n // still be changed from the list.\n const aggregatedKeys = new Set(buckets.map(b => b.key));\n const preexisting = this.selectedFacets[this.facetKey] ?? {};\n for (const [key, data] of Object.entries(preexisting)) {\n if (aggregatedKeys.has(key)) continue;\n this.insertInSortOrder(buckets, {\n displayText: this.displayTextFor(key),\n key,\n count: data.count,\n state: selections[key]?.state ?? data.state,\n });\n }\n\n // For TV creator facets, uppercase the display text\n if (this.facetKey === 'creator' && this.isTvSearch) {\n buckets.forEach(b => {\n b.displayText = (b.displayText ?? b.key)?.toLocaleUpperCase();\n\n const channelLabel = this.tvChannelAliases?.get(b.displayText);\n if (channelLabel && channelLabel !== b.displayText) {\n b.extraNote = `(${channelLabel})`;\n }\n });\n }\n\n return { ...aggregationFacetGroup, buckets };\n }\n\n /**\n * This facet type's selections: the ones made before the dialog opened,\n * overridden by any unapplied changes made in it. Values stay in the order\n * they were first selected, and cleared ones remain with state `'none'`.\n */\n private get currentSelections(): Record<string, FacetBucket> {\n if (!this.facetKey) return {};\n return {\n ...this.selectedFacets?.[this.facetKey],\n ...this.unappliedFacetChanges[this.facetKey],\n };\n }\n\n /**\n * The values that are currently selected or hidden, in the order they were\n * selected, as they appear in `facetGroup`.\n */\n private listChosenBuckets(): FacetBucket[] {\n const byKey = new Map(this.facetGroup?.buckets.map(b => [b.key, b]));\n // Without a list (e.g. the search failed), fall back on the selections\n // themselves, so they can still be seen and cleared.\n return Object.entries(this.currentSelections)\n .map(\n ([key, selection]) =>\n byKey.get(key) ?? {\n ...selection,\n displayText: this.displayTextFor(key),\n },\n )\n .filter(bucket => bucket.state !== 'none');\n }\n\n /**\n * Inserts `bucket` ahead of the first bucket that the current sort would put\n * after it.\n */\n private insertInSortOrder(buckets: FacetBucket[], bucket: FacetBucket): void {\n const index = buckets.findIndex(b => this.compareForSort(bucket, b) < 0);\n buckets.splice(index === -1 ? buckets.length : index, 0, bucket);\n }\n\n /**\n * Orders two buckets the way the aggregations are ordered for the current\n * sort (see `getSortedBuckets` in search-service).\n */\n private compareForSort(a: FacetBucket, b: FacetBucket): number {\n switch (this.sortedBy) {\n case AggregationSortType.ALPHABETICAL:\n return (a.displayText ?? a.key).localeCompare(b.displayText ?? b.key);\n case AggregationSortType.NUMERIC:\n return Number(b.key) - Number(a.key);\n default:\n return b.count - a.count;\n }\n }\n\n /**\n * The text patrons see for a bucket: the collection title for collections,\n * and the bucket key for everything else.\n */\n private displayTextFor(key: string): string {\n const collectionTitle =\n this.facetKey === 'collection'\n ? this.collectionTitles?.get(key)\n : undefined;\n return collectionTitle ?? key;\n }\n\n /**\n * Converts the raw `aggregations` for the current facet key to a `FacetGroup`,\n * which is easier to work with.\n */\n private get aggregationFacetGroup(): FacetGroup | undefined {\n if (!this.aggregations || !this.facetKey) return undefined;\n\n const currentAggregation = this.aggregations[this.facetKey];\n if (!currentAggregation) return undefined;\n\n const facetGroupTitle = facetTitles[this.facetKey];\n\n // Order the facets according to the current sort option\n let sortedBuckets = currentAggregation.getSortedBuckets(\n this.sortedBy,\n ) as Bucket[];\n\n if (this.facetKey === 'collection') {\n // we are not showing fav- collections or certain deemphasized collections in facets\n sortedBuckets = sortedBuckets?.filter(bucket => {\n const bucketKey = bucket?.key?.toString();\n return (\n !suppressedCollections[bucketKey] && !bucketKey?.startsWith('fav-')\n );\n });\n }\n\n // Construct the array of facet buckets from the aggregation buckets\n const facetBuckets: FacetBucket[] = sortedBuckets.map(bucket => {\n const bucketKeyStr = `${bucket.key}`;\n return {\n displayText: this.displayTextFor(bucketKeyStr),\n key: bucketKeyStr,\n count: bucket.doc_count,\n state: 'none',\n };\n });\n\n // Collections sorted alphabetically should be in order of the titles\n // patrons see, not of the identifiers that getSortedBuckets used.\n if (\n this.facetKey === 'collection' &&\n this.sortedBy === AggregationSortType.ALPHABETICAL\n ) {\n facetBuckets.sort((a, b) =>\n (a.displayText ?? a.key).localeCompare(b.displayText ?? b.key),\n );\n }\n\n return {\n title: facetGroupTitle,\n key: this.facetKey,\n buckets: facetBuckets,\n };\n }\n\n /**\n * The buckets whose visible text contains the filter text, ignoring case,\n * accents and punctuation.\n */\n private filterBuckets(): FacetBucket[] {\n const buckets = this.facetGroup?.buckets ?? [];\n const needle = normalizeFilterText(this.filterText);\n if (!needle.spaced) return buckets;\n return buckets.filter(bucket =>\n filterTextIncludes(this.filterKeyFor(bucket), needle),\n );\n }\n\n private filterKeyFor(bucket: FacetBucket): NormalizedFilterText {\n let filterKey = this.filterKeys.get(bucket.key);\n if (filterKey === undefined) {\n const visibleText = [bucket.displayText ?? bucket.key, bucket.extraNote]\n .filter(Boolean)\n .join(' ');\n filterKey = normalizeFilterText(visibleText);\n this.filterKeys.set(bucket.key, filterKey);\n }\n return filterKey;\n }\n\n /**\n * Whether the patron's filter text has ruled out every value\n */\n private get noValuesMatch(): boolean {\n const isFiltering = normalizeFilterText(this.filterText).spaced !== '';\n return isFiltering && this.filteredBuckets.length === 0;\n }\n\n private get moreFacetsTemplate(): TemplateResult {\n const valuesLabel = this.facetKey\n ? msg(str`${facetTitles[this.facetKey]} values`)\n : undefined;\n return html`\n <more-facets-scroller\n .facetType=${this.facetKey}\n .buckets=${this.filteredBuckets}\n .collectionTitles=${this.collectionTitles}\n ?omitHideButtons=${this.facetGroup?.buckets.length === 1}\n label=${ifDefined(valuesLabel)}\n @facetClick=${this.facetClicked}\n @pageChanged=${this.pageChanged}\n ></more-facets-scroller>\n ${when(\n this.loadFailed,\n () => this.loadErrorTemplate,\n () => when(this.noValuesMatch, () => this.noMatchesTemplate),\n )}\n `;\n }\n\n /**\n * A chiclet for each selected or hidden value, each with a button to clear it\n */\n private get chicletsTemplate(): TemplateResult {\n const valuesName = this.facetKey ? facetPluralTitles[this.facetKey] : '';\n return html`\n <ul class=\"chiclets\" aria-label=${msg(str`Selected ${valuesName}`)}>\n ${repeat(\n this.chosenBuckets,\n bucket => bucket.key,\n (bucket, index) => this.chicletTemplate(bucket, index),\n )}\n </ul>\n `;\n }\n\n private chicletTemplate(bucket: FacetBucket, index: number): TemplateResult {\n const isHidden = bucket.state === 'hidden';\n const text = [bucket.displayText ?? bucket.key, bucket.extraNote]\n .filter(Boolean)\n .join(' ');\n const removeLabel = isHidden\n ? msg(str`Unhide ${text}`)\n : msg(str`Deselect ${text}`);\n\n return html`\n <li class=\"chiclet\" title=${text}>\n <span class=\"chiclet-icon\" aria-hidden=\"true\"\n >${isHidden ? eyeClosedIcon : checkIcon}</span\n >\n <span class=\"sr-only\"\n >${isHidden ? msg('Hidden:') : msg('Selected:')}</span\n >\n <span class=\"chiclet-text\">${text}</span>\n <button\n type=\"button\"\n class=\"chiclet-remove\"\n aria-label=${removeLabel}\n @click=${() => this.chicletRemoved(bucket, index)}\n >\n ${closeCircleDark}\n </button>\n </li>\n `;\n }\n\n private get noMatchesTemplate(): TemplateResult {\n return html`<p class=\"facets-message no-matches\" role=\"status\">\n ${msg('No matching values found.')}\n </p>`;\n }\n\n private get loadErrorTemplate(): TemplateResult {\n return html`<p class=\"facets-message load-error\" role=\"alert\">\n ${msg('Sorry, these values couldn’t be loaded. Please try again later.')}\n </p>`;\n }\n\n private get loaderTemplate(): TemplateResult {\n return html`\n <ia-status-indicator\n class=\"facets-loader\"\n mode=\"loading\"\n ></ia-status-indicator>\n `;\n }\n\n private get footerTemplate(): TemplateResult {\n return html`\n <div class=\"footer\">\n <button class=\"btn btn-cancel\" type=\"button\" @click=${this.cancelClick}>\n ${msg('Cancel')}\n </button>\n <button\n class=\"btn btn-submit\"\n type=\"button\"\n @click=${this.applySearchFacetsClicked}\n >\n ${msg('Apply filters')}\n </button>\n </div>\n `;\n }\n\n private sortFacetAggregation(facetSortType: AggregationSortType) {\n this.sortedBy = facetSortType;\n this.dispatchEvent(\n new CustomEvent('sortedFacets', { detail: this.sortedBy }),\n );\n }\n\n private get modalHeaderTemplate(): TemplateResult {\n const facetSort =\n this.sortedBy ?? defaultFacetSort[this.facetKey as FacetOption];\n const defaultSwitchSide =\n facetSort === AggregationSortType.COUNT ? 'left' : 'right';\n const valuesName = this.facetKey ? facetPluralTitles[this.facetKey] : '';\n // From the facet key rather than the facet group, which is missing\n // until the values load (or if they fail to)\n const title = this.facetKey ? facetTitles[this.facetKey] : '';\n\n return html`<span class=\"sr-only\">${msg('More facets for:')}</span>\n <span class=\"title\">${title}</span>\n <span class=\"header-controls\">\n <span class=\"sort-controls\">\n <label class=\"sort-label\">${msg('Sort by:')}</label>\n ${this.facetKey\n ? html`<toggle-switch\n class=\"sort-toggle\"\n leftValue=${AggregationSortType.COUNT}\n leftLabel=${msg('Count')}\n rightValue=${valueFacetSort[this.facetKey]}\n .rightLabel=${title}\n side=${defaultSwitchSide}\n @change=${(e: CustomEvent<string>) => {\n this.sortFacetAggregation(\n Number(e.detail) as AggregationSortType,\n );\n }}\n ></toggle-switch>`\n : nothing}\n </span>\n <span class=\"filter-controls\">\n <label class=\"filter-label\">${msg('Filter by:')}</label>\n <ia-clearable-text-input\n class=\"filter-input\"\n .value=${this.filterText}\n .placeholder=${msg(str`Search ${valuesName}…`)}\n .screenReaderLabel=${msg(str`Filter ${valuesName}`)}\n .clearButtonScreenReaderLabel=${msg('Clear filter')}\n @input=${this.filterTextChanged}\n ></ia-clearable-text-input>\n </span>\n </span>`;\n }\n\n render() {\n return html`\n ${this.facetsLoading\n ? this.loaderTemplate\n : html`\n <section id=\"more-facets\">\n <div class=\"header-content\">${this.modalHeaderTemplate}</div>\n ${when(this.chosenBuckets.length, () => this.chicletsTemplate)}\n <div class=\"facets-content\">${this.moreFacetsTemplate}</div>\n ${this.footerTemplate}\n </section>\n `}\n `;\n }\n\n /**\n * Handler for typing in (or clearing) the filter text field\n */\n private filterTextChanged(e: Event): void {\n const input = e.target as HTMLElement & { value: string };\n this.filterText = input.value;\n }\n\n private facetClicked(e: CustomEvent<FacetEventDetails>): void {\n if (!this.facetKey) return;\n this.unappliedFacetChanges = updateSelectedFacetBucket(\n this.unappliedFacetChanges,\n this.facetKey,\n e.detail.bucket,\n );\n }\n\n /**\n * Clears the selection a chiclet stands for, which removes the chiclet and\n * unchecks the value in the list.\n */\n private chicletRemoved(bucket: FacetBucket, index: number): void {\n if (!this.facetKey) return;\n this.unappliedFacetChanges = updateSelectedFacetBucket(\n this.unappliedFacetChanges,\n this.facetKey,\n { ...bucket, state: 'none' },\n );\n this.chicletFocusIndex = index;\n }\n\n private pageChanged(e: CustomEvent<number>): void {\n this.analyticsHandler?.sendEvent({\n category: analyticsCategories.default,\n action: analyticsActions.moreFacetsPageChange,\n label: `${e.detail + 1}`,\n });\n }\n\n private applySearchFacetsClicked() {\n const mergedSelections = mergeSelectedFacets(\n this.selectedFacets,\n this.unappliedFacetChanges,\n );\n\n const event = new CustomEvent<SelectedFacets>('facetsChanged', {\n detail: mergedSelections,\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(event);\n\n // Reset the unapplied changes back to default, now that they have been applied\n this.unappliedFacetChanges = getDefaultSelectedFacets();\n\n this.modalManager?.closeModal();\n this.analyticsHandler?.sendEvent({\n category: analyticsCategories.default,\n action: `${analyticsActions.applyMoreFacetsModal}`,\n label: `${this.facetKey}`,\n });\n }\n\n private cancelClick() {\n // Reset the unapplied changes back to default\n this.unappliedFacetChanges = getDefaultSelectedFacets();\n\n this.modalManager?.closeModal();\n this.analyticsHandler?.sendEvent({\n category: analyticsCategories.default,\n action: analyticsActions.closeMoreFacetsModal,\n label: `${this.facetKey}`,\n });\n }\n\n static get styles(): CSSResultGroup {\n const modalSubmitButton = css`var(--primaryButtonBGColor, #194880)`;\n\n return [\n srOnlyStyle,\n css`\n section#more-facets {\n padding: 10px;\n }\n\n .header-content .title {\n display: block;\n text-align: left;\n font-size: 1.8rem;\n padding: 0 10px;\n font-weight: bold;\n }\n\n .header-controls {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 8px 20px;\n padding: 5px 10px 0;\n }\n\n /* Each label stays on the same line as its control when these wrap */\n .sort-controls,\n .filter-controls {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n white-space: nowrap;\n }\n\n .sort-label,\n .filter-label {\n font-size: 1.3rem;\n }\n\n .sort-toggle {\n font-weight: normal;\n }\n\n .filter-input {\n --input-height: 2.5rem;\n --input-font-size: 1.3rem;\n --input-border-radius: 4px;\n --input-padding: 4px 8px;\n --input-focused-border-color: ${modalSubmitButton};\n width: 16rem;\n }\n\n .chiclets {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin: 0;\n padding: 10px 10px 0;\n list-style: none;\n /* About three rows; any more scroll, so the values stay in view */\n max-height: 7.8rem;\n overflow-y: auto;\n }\n\n .chiclet {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n max-width: 24rem;\n padding: 2px 3px 2px 6px;\n border: 1px solid ${modalSubmitButton};\n border-radius: 5px;\n background: #fff;\n color: #2c2c2c;\n font-size: 1.2rem;\n line-height: normal;\n }\n\n .chiclet-icon {\n display: flex;\n flex: none;\n }\n\n .chiclet-icon svg {\n width: 12px;\n height: 12px;\n }\n\n .chiclet-text {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n\n .chiclet-remove {\n display: flex;\n flex: none;\n padding: 2px;\n border: none;\n border-radius: 50%;\n background: none;\n cursor: pointer;\n }\n\n .chiclet-remove svg {\n width: 10px;\n height: 10px;\n opacity: 0.55;\n }\n\n .chiclet-remove:hover svg,\n .chiclet-remove:focus-visible svg {\n opacity: 1;\n }\n\n .facets-content {\n position: relative;\n font-size: 1.2rem;\n padding: 10px 0;\n }\n\n .facets-message {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0;\n font-size: 1.4rem;\n color: #666;\n }\n\n .facets-loader {\n --icon-width: 70px;\n margin-bottom: 20px;\n display: block;\n margin-left: auto;\n margin-right: auto;\n }\n .btn {\n border: none;\n padding: 10px;\n margin-bottom: 10px;\n width: auto;\n border-radius: 4px;\n cursor: pointer;\n font-family: inherit;\n }\n .btn-cancel {\n background-color: #2c2c2c;\n color: white;\n }\n .btn-submit {\n background-color: ${modalSubmitButton};\n color: white;\n }\n .footer {\n text-align: center;\n }\n\n @media (max-width: 560px) {\n /* The filter gets a line of its own here, so let it fill that line */\n .filter-controls {\n flex: 1 1 auto;\n }\n .filter-input {\n flex: 1 1 auto;\n width: auto;\n min-width: 12rem;\n --input-font-size: 1.2rem;\n }\n }\n `,\n ];\n }\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  import { LitElement, CSSResultGroup, nothing } from 'lit';
2
- import type { IaDropdown } from '@internetarchive/ia-dropdown';
2
+ import type { IADropdown } from '@internetarchive/elements/ia-dropdown/ia-dropdown';
3
3
  import type { FacetRef, SmartFacet } from './models';
4
4
  export declare class SmartFacetDropdown extends LitElement {
5
5
  facetInfo?: SmartFacet[];
6
6
  labelPrefix?: string;
7
7
  activeFacetRef?: FacetRef;
8
- dropdown?: IaDropdown;
8
+ dropdown?: IADropdown;
9
9
  render(): import("lit").TemplateResult<1> | typeof nothing;
10
10
  private get dropdownOptions();
11
11
  private get activeDropdownOption();
@@ -1 +1 @@
1
- {"version":3,"file":"smart-facet-dropdown.js","sourceRoot":"","sources":["../../../../src/collection-facets/smart-facets/smart-facet-dropdown.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG/B,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAShD,EAAE;IACF,8BAA8B;IAC9B,EAAE;IAEF,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,cAAc;YAAE,OAAO,OAAO,CAAC;QAC5D,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,OAAO,CAAC;QAEhD,MAAM,WAAW,GACf,IAAI,CAAC,cAAc,CAAC,WAAW,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;QACnE,IAAI,CAAC,WAAW;YAAE,OAAO,OAAO,CAAC;QAEjC,OAAO,IAAI,CAAA;;;;;;;;;;qBAUM,IAAI,CAAC,eAAe;4BACb,IAAI,CAAC,oBAAoB;2BAC1B,KAAK;4BACJ,IAAI,CAAC,cAAc;mBAC5B,IAAI,CAAC,eAAe;;;;;q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E,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAsB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAA2B;AAEhC;IAArB,KAAK,CAAC,aAAa,CAAC;oDAAuB;AAPjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAiL9B","sourcesContent":["import { css, html, LitElement, CSSResultGroup, nothing } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport type { IaDropdown, optionInterface } from '@internetarchive/ia-dropdown';\nimport type { FacetRef, SmartFacet, SmartFacetEvent } from './models';\nimport { log } from '../../utils/log';\n\n@customElement('smart-facet-dropdown')\nexport class SmartFacetDropdown extends LitElement {\n @property({ type: Array }) facetInfo?: SmartFacet[];\n\n @property({ type: String }) labelPrefix?: string;\n\n @property({ type: Object }) activeFacetRef?: FacetRef;\n\n @query('ia-dropdown') dropdown?: IaDropdown;\n\n //\n // COMPONENT LIFECYCLE METHODS\n //\n\n render() {\n if (!this.facetInfo || !this.activeFacetRef) return nothing;\n if (this.facetInfo.length === 0) return nothing;\n\n const displayText =\n this.activeFacetRef.displayText ?? this.activeFacetRef.bucketKey;\n if (!displayText) return nothing;\n\n return html`\n <div class=\"dropdown-container\">\n <ia-dropdown\n class=\"dropdown\"\n displayCaret\n closeOnSelect\n closeOnEscape\n closeOnBackdropClick\n includeSelectedOption\n usePopover\n .options=${this.dropdownOptions}\n .selectedOption=${this.activeDropdownOption}\n .openViaButton=${false}\n @optionSelected=${this.optionSelected}\n @click=${this.onDropdownClick}\n >\n <span\n class=\"dropdown-label\"\n slot=\"dropdown-label\"\n @click=${this.defaultOptionSelected}\n >${this.labelPrefix ?? nothing} ${displayText}</span\n >\n </ia-dropdown>\n </div>\n `;\n }\n\n //\n // OTHER METHODS\n //\n\n private get dropdownOptions(): optionInterface[] {\n return (\n this.facetInfo?.map(smartFacet => {\n const firstFacet = smartFacet.facets[0];\n return {\n id: firstFacet.bucketKey,\n label: html`<span>\n ${smartFacet.label ??\n firstFacet.displayText ??\n firstFacet.bucketKey}\n </span>`,\n };\n }) ?? []\n );\n }\n\n private get activeDropdownOption(): optionInterface | undefined {\n if (!this.activeFacetRef) return undefined;\n return this.dropdownOptions.find(\n opt => opt.id === this.activeFacetRef?.bucketKey,\n );\n }\n\n /**\n * Handler for when the default option on the dropdown button is clicked\n */\n private defaultOptionSelected(): void {\n this.handleSelection(this.activeFacetRef?.bucketKey);\n }\n\n /**\n * Handler for when an option in the dropdown menu is selected\n */\n private optionSelected(e: CustomEvent<{ option: optionInterface }>): void {\n this.handleSelection(e.detail.option.id);\n }\n\n /**\n * Responds to a dropdown selection by emitting a `facetClick` event with\n * the appropriate facet details.\n */\n private handleSelection(bucketKey?: string): void {\n if (!bucketKey || !this.facetInfo || !this.activeFacetRef) return;\n\n let selectedSmartFacet;\n for (const smartFacet of this.facetInfo) {\n const selectedRef = smartFacet.facets.find(\n b => b.bucketKey === bucketKey,\n );\n if (selectedRef) {\n this.activeFacetRef = selectedRef;\n selectedSmartFacet = smartFacet;\n }\n }\n\n if (!selectedSmartFacet) return;\n\n this.dispatchEvent(\n new CustomEvent<SmartFacetEvent>('facetClick', {\n detail: {\n smartFacet: selectedSmartFacet,\n details: [\n {\n facetType: this.activeFacetRef.facetType,\n bucket: {\n key: this.activeFacetRef.bucketKey,\n count: 0,\n state: 'selected',\n },\n negative: false,\n },\n ],\n },\n }),\n );\n }\n\n private onDropdownClick(): void {\n log('smart dropdown: onDropdownClick', this);\n this.dispatchEvent(\n new CustomEvent<SmartFacetDropdown>('dropdownClick', { detail: this }),\n );\n }\n\n close(): void {\n if (this.dropdown) {\n this.dropdown.open = false;\n }\n }\n\n //\n // STYLES\n //\n\n static get styles(): CSSResultGroup {\n return css`\n .dropdown-container {\n padding: 5px 5px;\n border-radius: 5px;\n background: white;\n color: #2c2c2c;\n border: 1px solid #194880;\n font-size: 1.4rem;\n font-family: inherit;\n }\n\n .dropdown-label {\n font-size: 1.4rem;\n font-family: inherit;\n }\n\n .dropdown {\n --dropdownBorderColor: #194880;\n --dropdownBorderWidth: 1px;\n --dropdownBgColor: white;\n --dropdownHoverBgColor: #f8f8f8;\n --dropdownTextColor: #2c2c2c;\n --dropdownHoverTextColor: #2c2c2c;\n --dropdownCaretColor: #2c2c2c;\n --dropdownWhiteSpace: nowrap;\n --caretWidth: 14px;\n --caretHeight: 14px;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"smart-facet-dropdown.js","sourceRoot":"","sources":["../../../../src/collection-facets/smart-facets/smart-facet-dropdown.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAMnE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG/B,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAShD,EAAE;IACF,8BAA8B;IAC9B,EAAE;IAEF,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,cAAc;YAAE,OAAO,OAAO,CAAC;QAC5D,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,OAAO,CAAC;QAEhD,MAAM,WAAW,GACf,IAAI,CAAC,cAAc,CAAC,WAAW,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;QACnE,IAAI,CAAC,WAAW;YAAE,OAAO,OAAO,CAAC;QAEjC,OAAO,IAAI,CAAA;;;;;;;;;;qBAUM,IAAI,CAAC,eAAe;4BACb,IAAI,CAAC,oBAAoB;2BAC1B,KAAK;4BACJ,IAAI,CAAC,cAAc;mBAC5B,IAAI,CAAC,eAAe;;;;;qBAKlB,IAAI,CAAC,qBAAqB;eAChC,IAAI,CAAC,WAAW,IAAI,OA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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAA2B;AAEhC;IAArB,KAAK,CAAC,aAAa,CAAC;oDAAuB;AAPjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAiL9B","sourcesContent":["import { css, html, LitElement, CSSResultGroup, nothing } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport type {\n IADropdown,\n OptionInterface,\n} from '@internetarchive/elements/ia-dropdown/ia-dropdown';\nimport type { FacetRef, SmartFacet, SmartFacetEvent } from './models';\nimport { log } from '../../utils/log';\n\n@customElement('smart-facet-dropdown')\nexport class SmartFacetDropdown extends LitElement {\n @property({ type: Array }) facetInfo?: SmartFacet[];\n\n @property({ type: String }) labelPrefix?: string;\n\n @property({ type: Object }) activeFacetRef?: FacetRef;\n\n @query('ia-dropdown') dropdown?: IADropdown;\n\n //\n // COMPONENT LIFECYCLE METHODS\n //\n\n render() {\n if (!this.facetInfo || !this.activeFacetRef) return nothing;\n if (this.facetInfo.length === 0) return nothing;\n\n const displayText =\n this.activeFacetRef.displayText ?? this.activeFacetRef.bucketKey;\n if (!displayText) return nothing;\n\n return html`\n <div class=\"dropdown-container\">\n <ia-dropdown\n class=\"dropdown\"\n displayCaret\n closeOnSelect\n closeOnEscape\n closeOnBackdropClick\n includeSelectedOption\n usePopover\n .options=${this.dropdownOptions}\n .selectedOption=${this.activeDropdownOption}\n .openViaButton=${false}\n @optionSelected=${this.optionSelected}\n @click=${this.onDropdownClick}\n >\n <span\n class=\"dropdown-label\"\n slot=\"dropdown-label\"\n @click=${this.defaultOptionSelected}\n >${this.labelPrefix ?? nothing} ${displayText}</span\n >\n </ia-dropdown>\n </div>\n `;\n }\n\n //\n // OTHER METHODS\n //\n\n private get dropdownOptions(): OptionInterface[] {\n return (\n this.facetInfo?.map(smartFacet => {\n const firstFacet = smartFacet.facets[0];\n return {\n id: firstFacet.bucketKey,\n label: html`<span>\n ${smartFacet.label ??\n firstFacet.displayText ??\n firstFacet.bucketKey}\n </span>`,\n };\n }) ?? []\n );\n }\n\n private get activeDropdownOption(): OptionInterface | undefined {\n if (!this.activeFacetRef) return undefined;\n return this.dropdownOptions.find(\n opt => opt.id === this.activeFacetRef?.bucketKey,\n );\n }\n\n /**\n * Handler for when the default option on the dropdown button is clicked\n */\n private defaultOptionSelected(): void {\n this.handleSelection(this.activeFacetRef?.bucketKey);\n }\n\n /**\n * Handler for when an option in the dropdown menu is selected\n */\n private optionSelected(e: CustomEvent<{ option: OptionInterface }>): void {\n this.handleSelection(e.detail.option.id);\n }\n\n /**\n * Responds to a dropdown selection by emitting a `facetClick` event with\n * the appropriate facet details.\n */\n private handleSelection(bucketKey?: string): void {\n if (!bucketKey || !this.facetInfo || !this.activeFacetRef) return;\n\n let selectedSmartFacet;\n for (const smartFacet of this.facetInfo) {\n const selectedRef = smartFacet.facets.find(\n b => b.bucketKey === bucketKey,\n );\n if (selectedRef) {\n this.activeFacetRef = selectedRef;\n selectedSmartFacet = smartFacet;\n }\n }\n\n if (!selectedSmartFacet) return;\n\n this.dispatchEvent(\n new CustomEvent<SmartFacetEvent>('facetClick', {\n detail: {\n smartFacet: selectedSmartFacet,\n details: [\n {\n facetType: this.activeFacetRef.facetType,\n bucket: {\n key: this.activeFacetRef.bucketKey,\n count: 0,\n state: 'selected',\n },\n negative: false,\n },\n ],\n },\n }),\n );\n }\n\n private onDropdownClick(): void {\n log('smart dropdown: onDropdownClick', this);\n this.dispatchEvent(\n new CustomEvent<SmartFacetDropdown>('dropdownClick', { detail: this }),\n );\n }\n\n close(): void {\n if (this.dropdown) {\n this.dropdown.open = false;\n }\n }\n\n //\n // STYLES\n //\n\n static get styles(): CSSResultGroup {\n return css`\n .dropdown-container {\n padding: 5px 5px;\n border-radius: 5px;\n background: white;\n color: #2c2c2c;\n border: 1px solid #194880;\n font-size: 1.4rem;\n font-family: inherit;\n }\n\n .dropdown-label {\n font-size: 1.4rem;\n font-family: inherit;\n }\n\n .dropdown {\n --dropdownBorderColor: #194880;\n --dropdownBorderWidth: 1px;\n --dropdownBgColor: white;\n --dropdownHoverBgColor: #f8f8f8;\n --dropdownTextColor: #2c2c2c;\n --dropdownHoverTextColor: #2c2c2c;\n --dropdownCaretColor: #2c2c2c;\n --dropdownWhiteSpace: nowrap;\n --caretWidth: 14px;\n --caretHeight: 14px;\n }\n `;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { LitElement, PropertyValues, TemplateResult } from 'lit';
2
2
  import type { SortDirection } from '@internetarchive/search-service';
3
3
  import { CollectionDisplayMode, PrefixFilterCounts, PrefixFilterType, SortField } from '../models';
4
- import '@internetarchive/ia-dropdown';
4
+ import '@internetarchive/elements/ia-dropdown/ia-dropdown';
5
5
  import './alpha-bar';
6
6
  type AlphaSelector = 'creator' | 'title';
7
7
  export declare class SortFilterBar extends LitElement {
@@ -10,7 +10,7 @@ import { tileIcon } from './img/tile';
10
10
  import { listIcon } from './img/list';
11
11
  import { compactIcon } from './img/compact';
12
12
  import { srOnlyStyle } from '../styles/sr-only';
13
- import '@internetarchive/ia-dropdown';
13
+ import '@internetarchive/elements/ia-dropdown/ia-dropdown';
14
14
  import './alpha-bar';
15
15
  let SortFilterBar = class SortFilterBar extends LitElement {
16
16
  constructor() {
@@ -1 +1 @@
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,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAEL,uBAAuB,EAGvB,YAAY,EACZ,SAAS,GAEV,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,UAAU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B,aAAa;IAFzB,aAAa,CAAC,iBAAiB,CAAC;IAChC,SAAS,EAAE;GACC,aAAa,CA0sBzB","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 { localized, msg, str } 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 SortOption,\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')\n@localized()\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 <div id=\"sort-bar-row\">\n <section id=\"sort-bar\" aria-label=${msg('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 <slot name=\"sort-bar-end\"></slot>\n </div>\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' ? msg('descending') : msg('ascending');\n const buttonLabel = this.canChangeSortDirection\n ? msg(str`Change to ${oppositeSortDirectionReadable} sort`)\n : msg('Directions are not available for the current sort option');\n\n return html`\n <button\n class=\"sort-direction-selector\"\n title=${buttonLabel}\n ?disabled=${!this.canChangeSortDirection}\n @click=${this.handleSortDirectionClicked}\n >\n <span class=\"sr-only\">${buttonLabel}</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 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=${msg('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=${msg('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=${msg('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 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 const resolvedField =\n this.selectedSort === SortField.default\n ? this.defaultSortField\n : this.selectedSort;\n if (this.sortFieldAvailability[resolvedField]) return resolvedField;\n\n // Fall back to the first available sort option shown in the sort bar, if\n // the requested one isn't available\n return this.firstAvailableOption?.field ?? resolvedField;\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 /** The first option shown in the sort dropdown, or undefined if none are available */\n private get firstAvailableOption(): SortOption | undefined {\n return Object.values(SORT_OPTIONS).find(\n opt => opt.shownInSortBar && this.sortFieldAvailability[opt.field],\n );\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=${msg('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=${msg('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 /*\n * The sort-bar-end slot shares this row with the sort bar but sits\n * outside its \"Sorting options\" landmark. When the slotted content\n * doesn't fit beside the sort controls, it wraps onto its own line at\n * the right rather than overflowing the row.\n */\n #sort-bar-row {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n align-items: center;\n padding-bottom: 1px;\n border-bottom: 1px solid #2c2c2c;\n font-size: 1.4rem;\n }\n\n #sort-bar {\n flex: auto;\n min-width: 0;\n display: flex;\n justify-content: flex-start;\n align-items: center;\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"]}
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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,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;IAFzB,aAAa,CAAC,iBAAiB,CAAC;IAChC,SAAS,EAAE;GACC,aAAa,CA0sBzB","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 { localized, msg, str } from '@lit/localize';\nimport type {\n IADropdown,\n OptionInterface,\n} from '@internetarchive/elements/ia-dropdown/ia-dropdown';\nimport type { SortDirection } from '@internetarchive/search-service';\nimport {\n CollectionDisplayMode,\n defaultSortAvailability,\n PrefixFilterCounts,\n PrefixFilterType,\n SORT_OPTIONS,\n SortField,\n SortOption,\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/elements/ia-dropdown/ia-dropdown';\nimport './alpha-bar';\n\ntype AlphaSelector = 'creator' | 'title';\n\n@customElement('sort-filter-bar')\n@localized()\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 <div id=\"sort-bar-row\">\n <section id=\"sort-bar\" aria-label=${msg('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 <slot name=\"sort-bar-end\"></slot>\n </div>\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' ? msg('descending') : msg('ascending');\n const buttonLabel = this.canChangeSortDirection\n ? msg(str`Change to ${oppositeSortDirectionReadable} sort`)\n : msg('Directions are not available for the current sort option');\n\n return html`\n <button\n class=\"sort-direction-selector\"\n title=${buttonLabel}\n ?disabled=${!this.canChangeSortDirection}\n @click=${this.handleSortDirectionClicked}\n >\n <span class=\"sr-only\">${buttonLabel}</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 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=${msg('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=${msg('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=${msg('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 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 const resolvedField =\n this.selectedSort === SortField.default\n ? this.defaultSortField\n : this.selectedSort;\n if (this.sortFieldAvailability[resolvedField]) return resolvedField;\n\n // Fall back to the first available sort option shown in the sort bar, if\n // the requested one isn't available\n return this.firstAvailableOption?.field ?? resolvedField;\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 /** The first option shown in the sort dropdown, or undefined if none are available */\n private get firstAvailableOption(): SortOption | undefined {\n return Object.values(SORT_OPTIONS).find(\n opt => opt.shownInSortBar && this.sortFieldAvailability[opt.field],\n );\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=${msg('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=${msg('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 /*\n * The sort-bar-end slot shares this row with the sort bar but sits\n * outside its \"Sorting options\" landmark. When the slotted content\n * doesn't fit beside the sort controls, it wraps onto its own line at\n * the right rather than overflowing the row.\n */\n #sort-bar-row {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n align-items: center;\n padding-bottom: 1px;\n border-bottom: 1px solid #2c2c2c;\n font-size: 1.4rem;\n }\n\n #sort-bar {\n flex: auto;\n min-width: 0;\n display: flex;\n justify-content: flex-start;\n align-items: center;\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
@@ -7,7 +7,7 @@
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/internetarchive/iaux-collection-browser.git"
9
9
  },
10
- "version": "4.10.1",
10
+ "version": "4.10.2-webdev-9737.0",
11
11
  "main": "dist/index.js",
12
12
  "module": "dist/index.js",
13
13
  "files": [
@@ -41,11 +41,9 @@
41
41
  "dependencies": {
42
42
  "@a11y/focus-trap": "^1.0.5",
43
43
  "@internetarchive/analytics-manager": "^0.1.4",
44
- "@internetarchive/elements": "^1.1.0",
44
+ "@internetarchive/elements": "^1.5.0",
45
45
  "@internetarchive/feature-feedback": "^1.0.0",
46
46
  "@internetarchive/field-parsers": "^1.0.0",
47
- "@internetarchive/ia-clearable-text-input": "^1.2.0",
48
- "@internetarchive/ia-dropdown": "^2.0.0",
49
47
  "@internetarchive/iaux-item-metadata": "^1.0.5",
50
48
  "@internetarchive/infinite-scroller": "^2.0.0",
51
49
  "@internetarchive/modal-manager": "^2.0.6",