Sha256: 52a52e54a7d179f0e33c74852979d2f82cf1c4a00148f77cb93c0b8eaed30424

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

import {controller, target, targets} from '@github/catalyst'

@controller
class SubHeaderElement extends HTMLElement {
  @target filterInput: HTMLElement
  @targets hiddenItemsOnExpandedFilter: HTMLElement[]
  @targets shownItemsOnExpandedFilter: HTMLElement[]

  expandFilterInput() {
    for (const item of this.hiddenItemsOnExpandedFilter) {
      item.classList.add('d-none')
    }

    for (const item of this.shownItemsOnExpandedFilter) {
      item.classList.remove('d-none')
    }

    this.classList.add('SubHeader--expandedSearch')

    this.filterInput.focus()
  }

  collapseFilterInput() {
    for (const item of this.hiddenItemsOnExpandedFilter) {
      item.classList.remove('d-none')
    }

    for (const item of this.shownItemsOnExpandedFilter) {
      item.classList.add('d-none')
    }

    this.classList.remove('SubHeader--expandedSearch')
  }
}

declare global {
  interface Window {
    SubHeaderElement: typeof SubHeaderElement
  }
}

if (!window.customElements.get('sub-header')) {
  window.SubHeaderElement = SubHeaderElement
  window.customElements.define('sub-header', SubHeaderElement)
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
openproject-primer_view_components-0.45.0 app/components/primer/open_project/sub_header_element.ts
openproject-primer_view_components-0.44.3 app/components/primer/open_project/sub_header_element.ts
openproject-primer_view_components-0.44.2 app/components/primer/open_project/sub_header_element.ts
openproject-primer_view_components-0.44.1 app/components/primer/open_project/sub_header_element.ts
openproject-primer_view_components-0.44.0 app/components/primer/open_project/sub_header_element.ts
openproject-primer_view_components-0.43.1 app/components/primer/open_project/sub_header_element.ts