{"version":3,"file":"sebgroup-green-angular-src-v-angular-dropdown.mjs","sources":["../../../../libs/angular/src/v-angular/dropdown/typeahead/typeahead-highlight/typeahead-highlight.component.ts","../../../../libs/angular/src/v-angular/dropdown/typeahead/typeahead-highlight/typeahead-highlight.component.html","../../../../libs/angular/src/v-angular/dropdown/dropdown-list/dropdown-list.component.ts","../../../../libs/angular/src/v-angular/dropdown/dropdown-list/dropdown-list.component.html","../../../../libs/angular/src/v-angular/dropdown/dropdown.component.ts","../../../../libs/angular/src/v-angular/dropdown/dropdown.component.html","../../../../libs/angular/src/v-angular/dropdown/typeahead/typeahead-dropdown-list/typeahead-dropdown-list.component.ts","../../../../libs/angular/src/v-angular/dropdown/typeahead/typeahead-input/typeahead-input.component.ts","../../../../libs/angular/src/v-angular/dropdown/typeahead/typeahead-input/typeahead-input.component.html","../../../../libs/angular/src/v-angular/dropdown/typeahead/typeahead.module.ts","../../../../libs/angular/src/v-angular/dropdown/dropdown.module.ts","../../../../libs/angular/src/v-angular/dropdown/typeahead/typeahead.directive.ts","../../../../libs/angular/src/v-angular/dropdown/sebgroup-green-angular-src-v-angular-dropdown.ts"],"sourcesContent":["import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'\n\n@Component({\n    selector: 'nggv-typeahead-highlight',\n    templateUrl: './typeahead-highlight.component.html',\n    styleUrls: ['./typeahead-highlight.component.scss'],\n    standalone: false\n})\nexport class NggvTypeaheadHighlightComponent implements OnChanges {\n  /** The text that is displayed in the dropdown list */\n  @Input() textContent?: string\n  /** The substring that should be highlighted within textContent */\n  @Input() textToHighlight?: string\n\n  prefix?: string // Substring before the match\n  match?: string // The match\n  suffix?: string // Substring after the match\n\n  text = ''\n  input = ''\n\n  /**\n   * Regexp of characters that are allowed in textContent without being found in textToHighlight\n   * Allow whitespaces.\n   * */\n  allowedNonMatchingChars = new RegExp(/\\s/)\n\n  ngOnChanges(changes: SimpleChanges) {\n    const { textContent, textToHighlight } = changes\n    if (textContent?.currentValue != null)\n      this.text = `${textContent.currentValue}`\n    if (textToHighlight?.currentValue != null)\n      this.input = `${textToHighlight.currentValue}`\n    this.updateValues()\n  }\n\n  private updateValues() {\n    const splittedText = this.text.toLocaleLowerCase().split('')\n    const splittedInput = this.input.toLocaleLowerCase().split('')\n\n    const { start, end } = this.getHighlightedPart(splittedText, splittedInput)\n\n    // If user input is not found within the textcontent, reset options and return.\n    if (start === -1 || end === -1) {\n      this.prefix = this.match = this.suffix = ''\n      return\n    }\n    this.prefix = this.text.substring(0, start)\n    this.match = this.text.substring(start, end)\n    this.suffix = this.text.substring(end)\n  }\n\n  /**\n   * Function that finds the start and end index of where the input is located within the text to display.\n   * First occurence is returned. Allows for spaces to occur despite input not matching space.\n   * Loops through each character in splittedText and when a char in splittedText equlas the first character of\n   * splittedInput, evaluate wether it's match on the entire input.\n   * - If it's => return indexes.\n   * - If it's not => break out and check next char in outer loop.\n   * @param splittedText the text content splitted in an array\n   * @param splittedInput the input splitted in an array\n   * @returns { start: number, end: number } Indexes of where the match starts and ends in the text displatyed\n   */\n  private getHighlightedPart(\n    splittedText: string[],\n    splittedInput: string[],\n  ): { start: number; end: number } {\n    let start = -1\n    let end = -1\n\n    for (let i = 0; i < splittedText.length; i++) {\n      // If start and end have been set, break and return\n      if (start > -1 || end > -1) break\n\n      // If current char match first in input, try see if whole input match from that index\n      if (splittedText[i] === splittedInput[0]) {\n        let matches = 1\n        for (let t = 1; t <= splittedText.length; t++) {\n          // If match on last character of input, we're finished.\n          if (matches === splittedInput.length) {\n            start = i\n            end = start + t\n            break\n          }\n          if (splittedText[t + i] === splittedInput[matches]) matches++\n          else if (this.allowedNonMatchingChars.test(splittedText[t + i]))\n            continue // Ignore whitespace, continue\n          else break // No match, break out of inner loop to check next char in text\n        }\n      }\n    }\n    return { start, end }\n  }\n}\n","<ng-container *ngIf=\"!this.match\">{{ textContent }}</ng-container>\n<!-- Note that this is sensitive to line breaks producing extra spacing between the different parts -->\n<ng-container *ngIf=\"!!this.match\">\n  {{ prefix || '' }}<span class=\"match\">{{ match }}</span\n  >{{ suffix || '' }}\n</ng-container>\n","import {\n  Component,\n  ElementRef,\n  EventEmitter,\n  HostBinding,\n  Inject,\n  Input,\n  OnChanges,\n  OnInit,\n  Optional,\n  Output,\n  QueryList,\n  Renderer2,\n  SimpleChanges,\n  TemplateRef,\n  ViewChildren,\n} from '@angular/core'\nimport { TRANSLOCO_SCOPE, TranslocoScope } from '@jsverse/transloco'\nimport { filter, fromEvent, Subject, Subscription, takeUntil } from 'rxjs'\n\nimport {\n  DropdownUtils,\n  Option,\n  OptionBase,\n} from '@sebgroup/green-angular/src/v-angular/core'\n\n@Component({\n  selector: 'nggv-dropdown-list',\n  templateUrl: './dropdown-list.component.html',\n  styleUrls: ['./dropdown-list.component.scss'],\n  standalone: false,\n})\nexport class NggvDropdownListComponent implements OnInit, OnChanges {\n  @Input() set expanded(state: boolean) {\n    this.setExpanded(state)\n  }\n  get expanded(): boolean {\n    return this._expanded\n  }\n  @Input() state: any\n\n  /** The additional amount to show when option is scrolled into view. */\n  @Input() scrollOffset = 24\n\n  @Input() optionContentTpl: TemplateRef<OptionBase<any>> | undefined\n  @Input() groupLabelTpl: TemplateRef<OptionBase<any>> | undefined\n\n  /** @internal List of references to the option elements. */\n  @ViewChildren('optionRefs') optionRefs:\n    | QueryList<ElementRef<HTMLLIElement>>\n    | undefined\n\n  /** Id of the host element and is accessible by the children, automatically generated if not provided. */\n  @HostBinding('attr.id') @Input() id = (window as any).nggv?.nextId()\n\n  /** Special property used for selecting DOM elements during automated UI testing. */\n  @HostBinding('attr.data-thook') @Input() thook: string | null | undefined =\n    'dropdown'\n\n  @HostBinding('attr.data-position') get positionAttr() {\n    return this.dropdownPosition\n  }\n\n  @Input() options!: any[]\n\n  @Input() textToHighlight?: string\n\n  /**\n   * Used to control if \"selectedValueChanged\" only should emit distinct changes, or each time a value is selected\n   * When true, value is not emitted if there's no distinct change\n   * When false, value is emitted every time an option is selected\n   * */\n  @Input() onlyEmitDistinctChanges = true\n\n  /**\n   * Used to control if the dropdown list should select the current active element, when Space is pressed on the keyboard.\n   * Primary usage is for typeahead, where the should be able to write a filter query containing spaces,\n   * but not select the current active element with Space.\n   */\n  @Input() selectWithSpace = true\n\n  /**\n   * When true, the dropdown will automatically choose to open above or below the input\n   * based on available space in the viewport, and will scale its height to fit if needed.\n   */\n  @Input() dynamicPosition = false\n\n  @Output() selectedValueChanged = new EventEmitter<any>()\n\n  /**\n   * Emitted when the dropdown is closed by user interactions (e.g. Escape or Tab) or other immediate close triggers.\n   * This notifies external consumers that the dropdown was closed as a result of a user action.\n   */\n  @Output() closed = new EventEmitter<void>()\n\n  /**\n   * Emitted after the dropdown has fully closed and internal cleanup has been performed.\n   * Use this for post-close tasks that must run after subscriptions are torn down and resources released.\n   */\n  @Output() afterClose = new EventEmitter<void>()\n\n  /** The current active option based on numeric index. */\n  public activeIndex = -1\n\n  scope: string | undefined\n\n  // Indicates whether the dropdown list should be displayed below ('bottom') or above ('top') the input, based on available space.\n  dropdownPosition: 'bottom' | 'top' = 'bottom'\n\n  private dropdownUtils: DropdownUtils<string | null, string, any> =\n    new DropdownUtils<string | null, string, any>()\n  private _expanded = false\n  private closed$ = new Subject<boolean>()\n  public selectedValue?: Option<string, any>\n\n  /** Subscribe if dropdown expanded to listen to click outside to close dropdown. */\n  protected onClickSubscription: Subscription | undefined\n  /** Subscribe to to keyboard events only when list is open. */\n  private onKeyDownSubscription: Subscription | undefined\n  private onKeyUpSubscription: Subscription | undefined\n  private _flattenedOptions: any[] = []\n\n  constructor(\n    @Optional()\n    @Inject(TRANSLOCO_SCOPE)\n    protected translocoScope: TranslocoScope,\n    private renderer: Renderer2,\n    private elRef: ElementRef,\n  ) {\n    if (this.translocoScope) this.scope = this.translocoScope.toString()\n  }\n\n  ngOnInit(): void {\n    if (this.state)\n      this.activeIndex = this.options.findIndex(\n        (option) => option.key === this.state.key,\n      )\n  }\n\n  ngOnChanges(changes: SimpleChanges): void {\n    if (!!changes.state && !changes.state.firstChange)\n      this.selectedValue = changes.state.currentValue\n    if (!!changes.options?.currentValue?.length && this.expanded)\n      this.refreshSelectedOption()\n  }\n\n  /**\n   * Returns true if argument is an {@link OptionGroup}.\n   * @param option the object to check.\n   */\n  isGroup(option: any): boolean {\n    return 'options' in option\n  }\n\n  /** @internal */\n  updateState(option: any, event: Event) {\n    if (option.disabled) return\n\n    if (\n      !this.onlyEmitDistinctChanges ||\n      !this.dropdownUtils.deepEqual(this.selectedValue, option)\n    ) {\n      this.selectedValue = option\n      this.state = option\n      this.selectedValueChanged.emit(option)\n    }\n\n    this.setExpanded(false)\n    event.stopPropagation()\n  }\n\n  /**\n   * @internal\n   */\n  setExpanded(expanded = true) {\n    // update expanded state\n    this._expanded = expanded\n\n    if (expanded) {\n      if (this.dynamicPosition) {\n        this.setDropdownPosition()\n      }\n      this.refreshSelectedOption()\n      this.subscribeToKeyUpEvents()\n      this.subscribeToKeyDownEvents()\n    } else {\n      this.closed$.next(true)\n      this.afterClose.emit()\n      this.onClickSubscription?.unsubscribe()\n      this.onKeyDownSubscription?.unsubscribe()\n      this.onKeyUpSubscription?.unsubscribe()\n      // to trigger gc removal\n      this.onKeyDownSubscription = undefined\n      this.onKeyUpSubscription = undefined\n    }\n  }\n\n  /**\n   * @internal\n   */\n  refreshSelectedOption() {\n    this._flattenedOptions = this.dropdownUtils.flattenOptions(\n      this.options,\n      !this.optionContentTpl,\n    )\n    this.activeIndex = this.getActiveIndex()\n    this.state = this._flattenedOptions[this.activeIndex]\n    this.scrollToResult(this.state)\n  }\n\n  /**\n   * @internal\n   * @returns The active index (number) if option is found, -1 otherwise.\n   * - If a selectedValue exists that's not nullish and that options is found, return that index\n   * - Else, return first non nullish index\n   * - If none of the above criterias are met, -1 are returned\n   */\n  getActiveIndex(): number {\n    if (!!this.selectedValue && this.selectedValue?.key != null) {\n      const selectedIndex = this._flattenedOptions.findIndex(\n        (option) =>\n          option.key != null && option.key === this.selectedValue?.key,\n      )\n      if (selectedIndex > -1) return selectedIndex\n    }\n    return this._flattenedOptions.findIndex((option) => option.key != null)\n  }\n\n  /**\n   * @internal\n   * evaluates wether the HTML element overflows\n   * @param elem The HTMLElement to evaluate\n   * */\n  isOverflow(elem: HTMLElement) {\n    return elem.offsetWidth < elem.scrollWidth\n  }\n\n  /**\n   * Typecast anything to an {@link OptionGroup}.\n   * @param group the object to typecast.\n   */\n  castGroup(group: any): any {\n    return group\n  }\n\n  /**\n   * @internal\n   * Disables default events.\n   * @param event fired containing which key was pressed.\n   */\n  onKeyDown(event: KeyboardEvent) {\n    // If space is pressed but it should not select an option, do nothing\n    if (event.key === ' ' && !this.selectWithSpace) return true\n    switch (event.key) {\n      case ' ': // Space - placed here to ensure the dropdown-list closes after selecting using \"Space\"\n      case 'ArrowUp': // Disable scrolling up\n      case 'ArrowDown': // Disable scrolling down\n        event.preventDefault()\n        event.stopPropagation()\n        return false\n      case 'Enter': // Disable form submission and select the currently active value\n        event.preventDefault()\n        event.stopPropagation()\n        if (this.expanded) {\n          const option = this._flattenedOptions[this.activeIndex]\n          this.updateState(option, event)\n        }\n        return false\n      case 'Tab': // trigger dropdown to close (for typeahead)\n        event.preventDefault()\n        event.stopPropagation()\n        if (this.expanded) {\n          this.setExpanded(false)\n          this.closed.emit()\n        }\n        return false\n    }\n    return true\n  }\n\n  /**\n   * @internal\n   * Enter toggles the dropdown, home, end, and, arrows change the index.\n   * Space selects the currently active option if `selectWithSpace` is true.\n   * @param event fired containing which key was released.\n   */\n  onKeyUp(event: KeyboardEvent) {\n    // If space is pressed but it should not select an option, do nothing\n    if (!this.expanded || (event.key === ' ' && !this.selectWithSpace)) return\n    let option\n\n    switch (event.key) {\n      case 'Escape':\n        this.setExpanded(false)\n        this.closed.emit()\n        break\n\n      case ' ': // Space - select the currently chosen value\n        option = this._flattenedOptions[this.activeIndex]\n        this.updateState(option, event)\n        break\n\n      case 'Home': // Move to the first option\n        this.activeIndex = 0\n\n        option = this._flattenedOptions[this.activeIndex]\n        this.state = option\n        this.scrollToResult(option, true)\n        break\n\n      case 'ArrowUp': // Move up one step to the previous option\n        if (this.activeIndex > 0) this.activeIndex--\n        else if (this.activeIndex === 0)\n          this.activeIndex = this._flattenedOptions.length - 1\n\n        option = this._flattenedOptions[this.activeIndex]\n        this.state = option\n        this.scrollToResult(option, true)\n        break\n\n      case 'ArrowDown': // Move down one step to the next option\n        if (this._flattenedOptions.length > this.activeIndex + 1)\n          this.activeIndex++\n        else if (this.activeIndex === this._flattenedOptions.length - 1)\n          this.activeIndex = 0\n\n        option = this._flattenedOptions[this.activeIndex]\n        this.state = option\n        this.scrollToResult(option, true)\n        break\n\n      case 'End': // Move to the last options\n        this.activeIndex = this._flattenedOptions.length - 1\n\n        option = this._flattenedOptions[this.activeIndex]\n        this.state = option\n        this.scrollToResult(option, true)\n        break\n    }\n  }\n\n  /** @internal */\n  subscribeToKeyUpEvents() {\n    this.onKeyUpSubscription = fromEvent<KeyboardEvent>(document, 'keyup')\n      .pipe(\n        filter(() => this.expanded),\n        takeUntil(this.closed$),\n      )\n      .subscribe((event) => this.onKeyUp(event))\n  }\n\n  /** @internal */\n  subscribeToKeyDownEvents() {\n    this.onKeyDownSubscription = fromEvent<KeyboardEvent>(document, 'keydown')\n      .pipe(\n        filter(() => this.expanded),\n        takeUntil(this.closed$),\n      )\n      .subscribe((event) => this.onKeyDown(event))\n  }\n\n  /**\n   * Scrolls focused result into view with a specified offset.\n   * @param key the result index which to scroll to.\n   */\n  scrollToResult(option: any, focusElement?: boolean) {\n    if (!this.optionRefs || !option) return\n    const optionRef = this.optionRefs.find(\n      (li) =>\n        li.nativeElement.id ===\n        this.id + '-option-' + (option.id ?? option.key),\n    )\n    const offset = this.scrollOffset\n    if (optionRef) {\n      let delta = window.scrollY || document.documentElement.scrollTop\n\n      // The list seems not to be visible at the time of scrolling, but this setTimeout \"hack\" makes it work...\n      setTimeout(() => {\n        optionRef.nativeElement.scrollIntoView({\n          block: 'nearest',\n        })\n\n        delta -= window.scrollY || document.documentElement.scrollTop\n        if (delta) {\n          window.scrollBy(0, delta > 0 ? -offset : offset)\n        }\n        if (focusElement) {\n          optionRef.nativeElement.focus()\n        }\n      }, 0)\n    }\n  }\n\n  /**\n   * Calculates available space above and below the dropdown input,\n   * sets dropdownPosition ('top' or 'bottom') accordingly,\n   * and dynamically sets the max-height of the dropdown list to fit the viewport.\n   */\n  setDropdownPosition() {\n    const dropdown = this.elRef.nativeElement\n    // dropdown trigger\n    const dropdownInput = dropdown.parentElement\n    const dropdownList = dropdown.querySelector('ul[role=\"listbox\"]')\n    const rect = dropdownInput.getBoundingClientRect()\n\n    const viewportHeight = window.innerHeight\n    const spaceBelow = viewportHeight - rect.bottom\n    const spaceAbove = rect.top\n\n    const MARGIN = 10\n    const MIN_HEIGHT = 100\n    const DROPDOWN_MAX_HEIGHT = 500\n    let maxDropdownHeight\n\n    if (spaceBelow >= DROPDOWN_MAX_HEIGHT) {\n      this.dropdownPosition = 'bottom'\n      maxDropdownHeight = DROPDOWN_MAX_HEIGHT\n    } else if (spaceAbove >= DROPDOWN_MAX_HEIGHT) {\n      this.dropdownPosition = 'top'\n      maxDropdownHeight = DROPDOWN_MAX_HEIGHT\n    } else if (spaceBelow > spaceAbove) {\n      this.dropdownPosition = 'bottom'\n      maxDropdownHeight = Math.max(spaceBelow - MARGIN, MIN_HEIGHT) // 10px margin, minimum height 100px\n    } else {\n      this.dropdownPosition = 'top'\n      maxDropdownHeight = Math.max(spaceAbove - MARGIN, MIN_HEIGHT) // 10px margin, minimum height 100px\n    }\n\n    this.renderer.setStyle(dropdownList, 'max-height', `${maxDropdownHeight}px`)\n  }\n}\n","<ng-container *transloco=\"let t; read: scope\">\n  <div class=\"visually-hidden\">{{ t(state?.label) }}</div>\n  <ul\n    class=\"gds-dropdown__options card options gds-reset\"\n    [class.gds-dropdown__options-expanded]=\"expanded\"\n    role=\"listbox\"\n    tabindex=\"-1\"\n    [attr.data-thook]=\"thook + '-options'\"\n    [attr.aria-labelledby]=\"id + '-label'\"\n    [attr.aria-activedescendant]=\"\n      state ? id + '-option-' + (state?.id ?? state?.key) : undefined\n    \"\n  >\n    <ng-container *ngFor=\"let item of options\">\n      <!-- OPTION -->\n      <ng-container *ngIf=\"!isGroup(item)\">\n        <ng-template\n          *ngTemplateOutlet=\"listItemTemplate; context: { $implicit: item }\"\n        ></ng-template>\n      </ng-container>\n\n      <!-- OPTION GROUP -->\n      <li\n        class=\"gds-dropdown__options__label group\"\n        [attr.data-thook]=\"thook + '-option-group'\"\n        *ngIf=\"isGroup(item)\"\n      >\n        <!-- group label template (default or custom) -->\n        <ng-template\n          *ngTemplateOutlet=\"listGroupTemplate; context: { $implicit: item }\"\n        ></ng-template>\n\n        <ul [attr.aria-disabled]=\"item.disabled\" class=\"gds-reset\">\n          <ng-container *ngFor=\"let option of castGroup(item).options\">\n            <ng-template\n              *ngTemplateOutlet=\"\n                listItemTemplate;\n                context: { $implicit: option }\n              \"\n            ></ng-template>\n          </ng-container>\n        </ul>\n      </li>\n    </ng-container>\n  </ul>\n\n  <!-- TEMPLATE -->\n  <ng-template #listItemTemplate let-option>\n    <li\n      #optionRefs\n      *ngIf=\"!optionContentTpl\"\n      tabindex=\"-1\"\n      [id]=\"id + '-option-' + (option.id ?? option.key)\"\n      class=\"gds-dropdown__options__label option\"\n      role=\"option\"\n      #liElem\n      [attr.data-thook]=\"thook + '-option-' + option.key\"\n      [attr.aria-disabled]=\"option.disabled\"\n      [attr.aria-selected]=\"\n        option.key === selectedValue?.key && !!selectedValue?.key\n      \"\n      [attr.aria-focus]=\"option.key === state?.key && !option.disabled\"\n      [nggvTooltip]=\"isOverflow(liElem) ? t(option.label) : undefined\"\n      (click)=\"updateState(option, $event)\"\n    >\n      <ng-template\n        *ngTemplateOutlet=\"\n          basicOptionContentTpl;\n          context: { $implicit: option }\n        \"\n      >\n      </ng-template>\n    </li>\n    <!-- Checking overflow on custom templates do not work skip adding nggvToolTip if custom template is provided -->\n    <li\n      #optionRefs\n      *ngIf=\"!!optionContentTpl\"\n      tabindex=\"-1\"\n      [id]=\"id + '-option-' + (option.id ?? option.key)\"\n      class=\"gds-dropdown__options__label option\"\n      role=\"option\"\n      #liElem\n      [attr.data-thook]=\"thook + '-option-' + option.key\"\n      [attr.aria-disabled]=\"option.disabled\"\n      [attr.aria-selected]=\"\n        option.key === selectedValue?.key && !!selectedValue?.key\n      \"\n      [attr.aria-focus]=\"option.key === state?.key && !option.disabled\"\n      (click)=\"updateState(option, $event)\"\n    >\n      <ng-template\n        *ngTemplateOutlet=\"optionContentTpl; context: { $implicit: option }\"\n      >\n      </ng-template>\n    </li>\n  </ng-template>\n\n  <ng-template #listGroupTemplate let-item>\n    <ng-container *ngIf=\"groupLabelTpl\">\n      <ng-template\n        *ngTemplateOutlet=\"groupLabelTpl; context: { $implicit: item }\"\n      ></ng-template>\n    </ng-container>\n    <ng-container *ngIf=\"!groupLabelTpl\">\n      <ng-template\n        *ngTemplateOutlet=\"basicGroupLabelTpl; context: { $implicit: item }\"\n      ></ng-template>\n    </ng-container>\n  </ng-template>\n\n  <ng-template #basicOptionContentTpl let-option>\n    <nggv-typeahead-highlight\n      *ngIf=\"!!textToHighlight\"\n      [textToHighlight]=\"textToHighlight\"\n      [textContent]=\"t(option.label)\"\n    >\n    </nggv-typeahead-highlight>\n    <ng-container *ngIf=\"!textToHighlight\">\n      {{ t(option.label) }}\n    </ng-container>\n  </ng-template>\n\n  <ng-template #basicGroupLabelTpl let-item>\n    <div class=\"nggv-group-label\">{{ t(item.label) }}</div>\n  </ng-template>\n</ng-container>\n","import '@sebgroup/green-core/components/icon/icons/triangle-exclamation.js'\n\nimport {\n  ChangeDetectorRef,\n  Component,\n  ContentChild,\n  EventEmitter,\n  HostBinding,\n  HostListener,\n  Inject,\n  Input,\n  OnChanges,\n  OnDestroy,\n  Optional,\n  Output,\n  Self,\n  SimpleChanges,\n  TemplateRef,\n} from '@angular/core'\nimport { NgControl } from '@angular/forms'\nimport { TRANSLOCO_SCOPE, TranslocoScope } from '@jsverse/transloco'\nimport { fromEvent, Subscription } from 'rxjs'\n\nimport { NggvBaseControlValueAccessorComponent } from '@sebgroup/green-angular/src/v-angular/base-control-value-accessor'\nimport {\n  DropdownUtils,\n  Option,\n  OptionBase,\n  OptionGroup,\n} from '@sebgroup/green-angular/src/v-angular/core'\n\n/**\n * A dropdown allows the user to select an option from a list.\n * Dropdowns enables users to make a quick selection of the available options for a specific entry.\n * https://designlibrary.sebgroup.com/components/component-dropdown\n */\n@Component({\n    selector: 'nggv-dropdown',\n    templateUrl: './dropdown.component.html',\n    styleUrls: ['./dropdown.component.scss'],\n    standalone: false\n})\nexport class NggvDropdownComponent<\n    K = string | null | undefined,\n    V = string | null | undefined,\n    T extends Option<K, V> = Option<K, V>,\n  >\n  extends NggvBaseControlValueAccessorComponent\n  implements OnDestroy, OnChanges\n{\n  /** Custom template for displaying options and groups. */\n  @ContentChild('selectedTpl', { read: TemplateRef }) selectedContentTpl:\n    | TemplateRef<OptionBase<T>>\n    | undefined\n  @ContentChild('optionTpl', { read: TemplateRef }) optionContentTpl:\n    | TemplateRef<OptionBase<any>>\n    | undefined\n  @ContentChild('groupLabelTpl', { read: TemplateRef }) groupLabelTpl:\n    | TemplateRef<OptionBase<any>>\n    | undefined\n\n  /**\n   * Special property used for selecting DOM elements during automated UI testing.\n   */\n  @HostBinding('attr.data-thook') @Input() thook: string | null | undefined =\n    'dropdown'\n\n  @HostBinding('class.small') get isSmall(): boolean {\n    return this.size === 'small'\n  }\n\n  @HostBinding('class.large') get isLarge(): boolean {\n    return this.size === 'large'\n  }\n\n  /**\n   * Sets the displayed size of the dropdown.\n   */\n  @Input() size: 'small' | 'large' = 'large'\n\n  /** Text shown before an option is selected. */\n  @Input() placeholder?: string\n  /** Specific value for aria-label. If not provided, label/labelTpl will be used. */\n  @Input() ariaLabel?: string\n  /** If the dropdown should close when scrolling the viewport. Default: false */\n  @Input() closeOnScroll = false\n  /** List of {@link Option} and {@link OptionGroup} listed when dropdown is expanded. */\n  @Input() set options(value: OptionBase<T>[]) {\n    // update options\n    this._options = value\n    // already has a null/undefined key\n    const nullishOption = this.dropdownUtils\n      .flattenOptions(value, false)\n      .find((option) => option.key == null)\n    // if the dropdown is optional, add a null value to deselect option\n    if (!this.required && !nullishOption && this.allowControlNullishOption) {\n      this._options = [this.defaultNullishOption].concat(this._options)\n    }\n\n    // set default value and emit if there is only one option\n    if (value.length === 1 && this.required && this.selectOnSingleOption) {\n      const onlyOption = this.dropdownUtils.flattenOptions(value, false)[0]\n      this.updateModel(onlyOption)\n      return\n    }\n\n    // don't update local state if we shouldn't control nullish value and we cant find the selected value amongst the options\n    const matchingOption = this.dropdownUtils\n      .flattenOptions(value, false)\n      .find((option) => option.key == this.ngControl?.value)\n    if (!this.allowControlNullishOption && !matchingOption) return\n\n    // Update local state\n    this.writeValue(this.ngControl?.value)\n  }\n\n  get options(): OptionBase<T>[] {\n    return this._options\n  }\n\n  /** The additional amount to show when option is scrolled into view. */\n  @Input() scrollOffset = 24\n\n  /**\n   * Allow this component to add/ remove nullish options based on wether the control is required or not\n   * Defaults to true.\n   */\n  @Input() allowControlNullishOption = true\n\n  /** Text to highlight in option */\n  @Input() textToHighlight?: string\n\n  /**\n   * If only one option exists in options[], default is to select it.\n   * This input can be used to alter that behaviour so it doesn't automatically\n   * select a value if it's the only one.\n   * Defaults to true.\n   */\n  @Input() selectOnSingleOption = true\n\n  /**\n   * Used to control if the dropdown list should select the current active element, when Space is pressed on the keyboard.\n   * Primary usage is for typeahead, where the should be able to write a filter query containing spaces,\n   * but not select the current active element with Space.\n   */\n  @Input() selectWithSpace = true\n\n  /**\n   * Used to determine which changes should be handled by the dropdown.\n   * If set to false, all changes will be handled by the dropdown.\n   * If set to true, only changes that are distinct from the current value will be handled.\n   * Defaults to true.\n   */\n  @Input() onlyHandleDistinctChanges = true\n\n  /**\n   * Emits changes of the expanded state of the dropdown\n   */\n  @Output() expandedChange = new EventEmitter<boolean>()\n\n  /** @internal nullish option. */\n  get defaultNullishOption(): OptionBase<any> {\n    return { key: null, label: this.placeholder ?? '\\u00A0' }\n  }\n\n  /** The current expanded state of the dropdown options. */\n  public expanded = false\n  /** The current option selected based on numeric index. */\n  public activeIndex = -1\n  /** Subscribe if dropdown expanded to listen to click outside to close dropdown. */\n  private onClickSubscription: Subscription | undefined\n  /** Subscribe if dropdown expanded to listen to scroll outside to close dropdown. */\n  private onScrollSubscription: Subscription | undefined\n\n  public keyEvent: KeyboardEvent = {} as KeyboardEvent\n  private _options: OptionBase<T>[] = []\n\n  constructor(\n    @Self() @Optional() public ngControl: NgControl,\n    @Optional()\n    @Inject(TRANSLOCO_SCOPE)\n    protected translocoScope: TranslocoScope,\n    protected cdr: ChangeDetectorRef,\n    protected dropdownUtils: DropdownUtils<K, V, T>,\n  ) {\n    super(ngControl, translocoScope, cdr)\n  }\n\n  ngOnChanges(changes: SimpleChanges): void {\n    if (changes.required?.currentValue !== undefined) {\n      const isRequired = changes.required.currentValue\n      // remove nullish option\n      const hasNullishOption =\n        this.dropdownUtils.flattenOptions(this._options, false)[0]?.key == null\n      // if required, remove nullish option\n      if (isRequired && hasNullishOption && this.allowControlNullishOption) {\n        this._options = this._options.slice(1)\n        return\n      }\n      // if not required, add nullish option\n      if (!isRequired && !hasNullishOption && this.allowControlNullishOption) {\n        this._options = [this.defaultNullishOption].concat(this._options)\n        return\n      }\n    }\n  }\n\n  ngOnDestroy(): void {\n    this.onClickSubscription?.unsubscribe()\n    this.onScrollSubscription?.unsubscribe()\n  }\n\n  /** @internal override to correctly set state from form value */\n  writeValue(value: any): void {\n    const options = this.dropdownUtils.flattenOptions(this._options, false)\n    this.state = options.find((option) => option.key === value)\n  }\n\n  // ----------------------------------------------------------------------------\n  // EVENTS\n  // ----------------------------------------------------------------------------\n\n  /** @internal */\n  onSelectChange(option: T) {\n    if (option.disabled) return\n    this.updateModel(option)\n    this.setExpanded(false)\n  }\n\n  // /**\n  //  * @internal\n  //  * Enter toggles the dropdown, home, end, and, arrows change the index.\n  //  * @param event fired containing which key was released.\n  //  */\n  @HostListener('keyup', ['$event'])\n  onKeyUp(event: KeyboardEvent) {\n    this.keyEvent = event\n  }\n\n  /**\n   * Closes the dropdown on click outside.\n   */\n  subscribeToOutsideClickEvent() {\n    this.onClickSubscription = fromEvent(document, 'click').subscribe({\n      next: (event: Event) => {\n        if (\n          this.expanded &&\n          !this.inputRef?.nativeElement.contains(event.target)\n        ) {\n          this.toggleDropdown()\n          this.onClickSubscription?.unsubscribe()\n        }\n      },\n    })\n  }\n  subscribeToOutsideScrollEvent() {\n    this.onScrollSubscription = fromEvent(document, 'scroll').subscribe({\n      next: (event: Event) => {\n        if (\n          this.expanded &&\n          !this.inputRef?.nativeElement.contains(event.target)\n        ) {\n          this.toggleDropdown()\n          this.onScrollSubscription?.unsubscribe()\n        }\n      },\n    })\n  }\n\n  // ----------------------------------------------------------------------------\n  // HELPERS\n  // ----------------------------------------------------------------------------\n\n  /**\n   * Set the dropdown value to given option.\n   * @param value the dropdown option to select.\n   */\n  private updateModel(value: T) {\n    this.state = value\n    this.onChange(value.key)\n  }\n\n  /** Toggle the expanded state of the dropdown options. */\n  toggleDropdown() {\n    this.setExpanded(!this.expanded)\n    this.cdr.detectChanges()\n  }\n\n  /**\n   * Set the expanded state of the dropdown options. If true the options are shown below the field.\n   * Activate on click event to be able to close dropdown on click outside.\n   * @param state the expanded state which to set.\n   */\n  setExpanded(state = true) {\n    this.expanded = state\n    this.expandedChange.emit(this.expanded)\n    if (this.expanded) {\n      this.subscribeToOutsideClickEvent()\n      if (this.closeOnScroll) {\n        this.subscribeToOutsideScrollEvent()\n      }\n    }\n    if (!this.expanded) this.onTouched()\n  }\n\n  /* TYPE CASTS */\n\n  /**\n   * Typecast anything to an {@link Option}.\n   * @param option the object to typecast.\n   */\n  castOption(option: any): T {\n    return option\n  }\n\n  /**\n   * Typecast anything to an {@link OptionGroup}.\n   * @param group the object to typecast.\n   */\n  castGroup(group: any): OptionGroup<T> {\n    return group\n  }\n\n  /* TYPE CHECKS */\n\n  /**\n   * Returns true if argument is an {@link Option}.\n   * @param option the object to check.\n   */\n  isOption(option: OptionBase<T>): option is OptionGroup<T> {\n    return !('options' in option)\n  }\n}\n","<!-- LABEL -->\n<ng-container *transloco=\"let t; read: scope\">\n  <label\n    [id]=\"id + '-label'\"\n    class=\"gds-field-label hide-if-empty\"\n    [attr.for]=\"id + '-toggle'\"\n    *ngIf=\"labelContentTpl || label\"\n  >\n    <ng-template\n      *ngTemplateOutlet=\"labelContentTpl || basicLabelContentTpl\"\n    ></ng-template>\n  </label>\n  <ng-template #basicLabelContentTpl>\n    <!-- to trigger css:empty if no label was added -->\n    <ng-container *ngIf=\"label\">\n      {{ label }}\n      <span\n        *ngIf=\"optional === true || (required !== true && optional !== false)\"\n        class=\"gds-field-label--optional\"\n      >\n        ({{ t('label.optional') }})\n      </span>\n    </ng-container>\n  </ng-template>\n\n  <!-- DESCRIPTION -->\n  <div class=\"description\" *ngIf=\"description\">{{ description }}</div>\n\n  <!-- LOCKED INPUT -->\n  <ng-container *ngIf=\"locked\">\n    <ng-template\n      *ngTemplateOutlet=\"\n        lockedTpl || defaultLockedTpl;\n        context: { $implicit: state }\n      \"\n    ></ng-template>\n    <ng-template #defaultLockedTpl>\n      <div\n        [id]=\"id + '-input'\"\n        class=\"nggv-field--locked\"\n        [attr.name]=\"name\"\n        [attr.value]=\"state\"\n        [attr.role]=\"role\"\n        [attr.aria-labelledby]=\"id + '-label ' + id + '-input'\"\n      >\n        <span *ngIf=\"!state\" class=\"unset-state\">-</span>\n        <ng-container *ngIf=\"state\">\n          <ng-template\n            *ngTemplateOutlet=\"\n              selectedContentTpl || defaultSelectedContentTpl;\n              context: { $implicit: state }\n            \"\n          >\n          </ng-template>\n        </ng-container>\n      </div>\n    </ng-template>\n  </ng-container>\n\n  <!-- INPUT -->\n  <ng-container *ngIf=\"!locked\">\n    <div class=\"gds-input-wrapper dropdown-wrapper\">\n      <div #input [id]=\"id + '-input'\" class=\"dropdown\">\n        <button\n          [id]=\"id + '-toggle'\"\n          [disabled]=\"disabled\"\n          type=\"button\"\n          class=\"nggv-field-dropdown__label toggle\"\n          [class.nggv-field--error]=\"invalid\"\n          role=\"combobox\"\n          aria-owns=\"listbox\"\n          aria-haspopup=\"listbox\"\n          aria-controls=\"listbox\"\n          [attr.data-thook]=\"thook + '-toggle'\"\n          [attr.aria-expanded]=\"expanded\"\n          [attr.aria-labelledby]=\"\n            ariaLabel ? null : id + '-label ' + id + '-toggle'\n          \"\n          [attr.aria-label]=\"ariaLabel || null\"\n          (click)=\"toggleDropdown()\"\n        >\n          <span>\n            <ng-template\n              *ngTemplateOutlet=\"\n                selectedContentTpl || defaultSelectedContentTpl;\n                context: { $implicit: state }\n              \"\n            >\n            </ng-template>\n          </span>\n        </button>\n        <nggv-dropdown-list\n          #dropDownList\n          [options]=\"options\"\n          [scrollOffset]=\"scrollOffset\"\n          [state]=\"state\"\n          [expanded]=\"expanded\"\n          [optionContentTpl]=\"optionContentTpl\"\n          [groupLabelTpl]=\"groupLabelTpl\"\n          [textToHighlight]=\"textToHighlight\"\n          [onlyEmitDistinctChanges]=\"onlyHandleDistinctChanges\"\n          [selectWithSpace]=\"selectWithSpace\"\n          [dynamicPosition]=\"true\"\n          (closed)=\"setExpanded(false)\"\n          (selectedValueChanged)=\"onSelectChange($event)\"\n        >\n        </nggv-dropdown-list>\n      </div>\n      <!-- ERRORS -->\n      <div class=\"gds-form-item__footer error-wrapper\">\n        <span\n          class=\"form-info form-info--error\"\n          [attr.for]=\"id + '-input'\"\n          *ngIf=\"invalid && (error || ngControl?.invalid)\"\n        >\n          <span class=\"error-icon\">\n            <gds-icon-triangle-exclamation\n              width=\"16\"\n              height=\"16\"\n              [solid]=\"true\"\n              *nggCoreElement\n            ></gds-icon-triangle-exclamation>\n          </span>\n          <span\n            *ngIf=\"error; else errorsRef\"\n            [attr.data-thook]=\"thook + '-errorlabel'\"\n            >{{ error }}</span\n          >\n        </span>\n        <ng-template #errorsRef>\n          <span\n            *ngIf=\"firstError as error\"\n            [attr.data-thook]=\"thook + '-errorlabel'\"\n          >\n            {{ t('error.field' + error?.code, error?.params) }}\n          </span>\n        </ng-template>\n      </div>\n      <!-- CHILDREN -->\n      <ng-content></ng-content>\n    </div>\n  </ng-container>\n\n  <ng-template #defaultSelectedContentTpl let-state>\n    <!-- eslint-disable-next-line @angular-eslint/template/eqeqeq -->\n    {{ state?.key != null && state?.label ? t(state.label) : placeholder }}\n  </ng-template>\n</ng-container>\n","import {\n  Component,\n  ElementRef,\n  Inject,\n  Input,\n  OnDestroy,\n  OnInit,\n  Optional,\n  Renderer2,\n  SkipSelf,\n} from '@angular/core'\nimport { TRANSLOCO_SCOPE, TranslocoScope } from '@jsverse/transloco'\nimport { fromEvent, Subject, takeUntil } from 'rxjs'\n\nimport { OptionBase } from '@sebgroup/green-angular/src/v-angular/core'\nimport { NggvInputComponent } from '@sebgroup/green-angular/src/v-angular/input'\nimport { NggvDropdownListComponent } from '../../dropdown-list/dropdown-list.component'\n\n// Use dropdownList template and combine stylesheets\n@Component({\n    selector: 'nggv-typeahead-dropdown-list',\n    templateUrl: '../../dropdown-list/dropdown-list.component.html',\n    styleUrls: [\n        '../typeahead-dropdown-list/typeahead-dropdown-list.component.scss',\n        '../../dropdown-list/dropdown-list.component.scss',\n    ],\n    standalone: false\n})\nexport class NggvTypeaheadDropdownListComponent\n  extends NggvDropdownListComponent\n  implements OnInit, OnDestroy\n{\n  @Input() hostComponent!: NggvInputComponent\n\n  /** Formats each item that is displayed as an option. Only applies format if the option if it implement Option interface. */\n  @Input() resultFormatter?: (option: OptionBase<any>) => string\n\n  /** Formats the selected item in the input when dropdown is opened. If no function is provided, it will display the value of the selected objects label property */\n  @Input() selectedFormatter?: (selected: OptionBase<any>) => string\n\n  private _destroy$ = new Subject<boolean>()\n\n  constructor(\n    @SkipSelf()\n    @Optional()\n    @Inject(TRANSLOCO_SCOPE)\n    protected translocoScope: TranslocoScope,\n    private renderer2: Renderer2,\n    private element: ElementRef,\n  ) {\n    super(translocoScope, renderer2, element)\n  }\n\n  ngOnInit(): void {\n    this.handleSelectedValueChanges()\n    this.handleFocusChanges()\n  }\n\n  ngOnDestroy(): void {\n    this._destroy$.next(true)\n    this._destroy$.complete()\n  }\n\n  /** @Internal Subscribe to click outside dropdownList and input to close dropdownList */\n  private subscribeToOutsideClickEvent() {\n    this.onClickSubscription = fromEvent(document, 'click')\n      .pipe(takeUntil(this._destroy$))\n      .subscribe({\n        next: (event: Event) => {\n          if (\n            this.expanded &&\n            !this.element.nativeElement.contains(event.target) &&\n            !this.hostComponent.inputRef?.nativeElement.contains(event.target)\n          ) {\n            this.setExpanded(false)\n            this.onClickSubscription?.unsubscribe()\n          }\n        },\n      })\n  }\n\n  /** @Internal Update state of the host-input to reflect the selected value */\n  private handleSelectedValueChanges() {\n    this.selectedValueChanged\n      .pipe(takeUntil(this._destroy$))\n      .subscribe((selected) => {\n        if (this.hostComponent.inputRef) {\n          this.hostComponent.state = `${this.formatSelected(selected)}`\n        }\n      })\n  }\n\n  /** @Internal Expand the dropdown when input receives focus. If no state, set empty string in input */\n  private handleFocusChanges() {\n    this.hostComponent.nggvFocus\n      .asObservable()\n      .pipe(takeUntil(this._destroy$))\n      .subscribe(() => {\n        if (!this.state) this.hostComponent.nggvInput.emit('')\n        this.setExpanded(true)\n        this.subscribeToOutsideClickEvent()\n      })\n  }\n\n  /**\n   * @internal Formats the selected option to display in the input. Interpolate the returned value\n   * since we don't know the return type or label type.\n   * @param value The selected value\n   * @returns The formatted value\n   */\n  private formatSelected(value: OptionBase<any>) {\n    if (value?.key == null) return ''\n    //If no formatter exists, return the label or empty string\n    if (!this.selectedFormatter) return value.label ?? ''\n    // If a formatter exists, use it\n    return this.selectedFormatter(value) ?? ''\n  }\n\n  /**\n   *\n   * @param expanded boolean to set if dropdown is expanded\n   */\n  override setExpanded(expanded = true) {\n    super.setExpanded(expanded)\n\n    /**\n     * Makes the typeahead dropdown as wide as the host component\n     */\n    this.renderer2.setStyle(\n      this.element.nativeElement,\n      'width',\n      `${this.hostComponent.element.nativeElement.offsetWidth}px`,\n    )\n  }\n}\n","import {\n  ChangeDetectorRef,\n  Component,\n  ElementRef,\n  HostListener,\n  Inject,\n  Input,\n  OnDestroy,\n  OnInit,\n  Optional,\n  Renderer2,\n  Self,\n} from '@angular/core'\nimport { NgControl } from '@angular/forms'\nimport { TRANSLOCO_SCOPE, TranslocoScope } from '@jsverse/transloco'\nimport { takeUntil } from 'rxjs'\n\nimport { OptionBase } from '@sebgroup/green-angular/src/v-angular/core'\nimport { NggvInputComponent } from '@sebgroup/green-angular/src/v-angular/input'\nimport { NggvDropdownComponent } from '../../dropdown.component'\n\n@Component({\n    selector: 'nggv-typeahead-input',\n    templateUrl: './typeahead-input.component.html',\n    styleUrls: ['./typeahead-input.component.scss'],\n    standalone: false\n})\nexport class NggvTypeaheadInputComponent\n  extends NggvInputComponent\n  implements OnInit, OnDestroy\n{\n  /** Reference to the host dropdown */\n  @Input() hostComponent!: NggvDropdownComponent\n\n  /** Formats each item that is displayed as an option. Only applies format if the option if it implement Option interface. */\n  @Input() resultFormatter?: (option: OptionBase<any>) => string\n\n  /** Formats the selected item in the input when dropdown is opened. If no function is provided, it will display the value of the selected objects label property */\n  @Input() selectedFormatter?: (selected: OptionBase<any>) => string\n\n  get dropdownButton(): HTMLElement {\n    return this.hostComponent.inputRef?.nativeElement\n  }\n\n  /** Boolean to indicate wether the dropdown is expanded or not, to apply appropriate styling */\n  expanded = false\n\n  /** Used to determine the height of the inputin html */\n  buttonHeight?: number\n\n  /** @internal Used to determine wether the input has been moved or not */\n  inputMoved = false\n\n  constructor(\n    public element: ElementRef,\n    private renderer2: Renderer2,\n    @Self() @Optional() public ngControl: NgControl,\n    @Optional()\n    @Inject(TRANSLOCO_SCOPE)\n    protected translocoScope: TranslocoScope,\n    protected cdr: ChangeDetectorRef,\n  ) {\n    super(ngControl, translocoScope, cdr, element)\n    super.ngOnInit()\n  }\n\n  ngOnInit() {\n    this.autocomplete = 'off'\n    this.debounceTime = 0\n    this.hostComponent.selectOnSingleOption = false\n\n    this.handleExpandedChange()\n  }\n\n  /**\n   * @internal\n   * Allow space to be inputted as text\n   * @param event fired containing which key was released.\n   */\n  @HostListener('keyup', ['$event'])\n  onKeyUp(event: KeyboardEvent) {\n    if (event.code === 'Space' && this.expanded) {\n      event.preventDefault()\n    }\n  }\n\n  /**\n   * @internal\n   * First time the dropdown is expanded, move the input sp it becomes a child of the dropdown button\n   * to better reflect semantics and styling.\n   */\n  private moveInput() {\n    // Workaround to execute code in setTimeout due to hooks management etc.\n    setTimeout(() => {\n      // Only move if parent dropdown is found\n      if (this.dropdownButton) {\n        this.renderer2.appendChild(\n          this.dropdownButton.querySelector('button'),\n          this.element.nativeElement,\n        )\n        this.inputMoved = true\n      }\n    }, 0)\n  }\n\n  /**\n   * @internal\n   * When dropdown is expanded, focus on the input. If a value is selected, set it in the input.\n   * When the dropdown is collapsed, empty the input from text.\n   */\n  private handleExpandedChange() {\n    this.hostComponent.expandedChange\n      .pipe(takeUntil(this._destroy$))\n      .subscribe((state) => {\n        this.expanded = state\n\n        // Calling this function from onInit caused issues when DOM has not fully been initialized because of\n        // different CSS used to hide (but not remove) from DOM\n        if (!this.inputMoved) this.moveInput()\n\n        // Get the height of the parent button so the input can be explicitly set to the same height since it's absolutely positioned\n        this.buttonHeight =\n          this.dropdownButton?.getBoundingClientRect().height || 32 // Default to 2em;\n\n        if (this.expanded) {\n          // Weird workaround for setting focus. Didn't set focus, but wrapping in setTimeout solved it.\n          // See suggestion here: https://github.com/ionic-team/stencil/issues/3772#issuecomment-1292599609\n          setTimeout(() => this.setFocus())\n          // Format and interpolate result since return type can be other than string from the formatter\n          const formattedValue = `${this.formatSelected(this.hostComponent.state)}`\n          this.setInput(formattedValue, false)\n        } else this.setInput('', true)\n      })\n  }\n\n  /**\n   * @internal Formats the selected option to display in the input. Interpolate the returned value\n   * since we don't know the return type or label type.\n   * @param value The selected value\n   * @returns The formatted value\n   */\n  private formatSelected(value: OptionBase<any>) {\n    if (value?.key == null) return ''\n    // If no formatter exists, return the label or empty string\n    if (!this.selectedFormatter) return value.label ?? ''\n    // If a formatter exists, use it\n    return this.selectedFormatter(value) ?? ''\n  }\n\n  /**\n   * Sets the input programmatically instead of native HTML input event.\n   * @param input\n   */\n  private setInput(input: string, triggerFilter: boolean) {\n    this.state = input\n    if (triggerFilter) {\n      this.onChange(this.state)\n      this.inputChange$.next(this.state)\n    }\n  }\n}\n","<ng-container>\n  <div\n    class=\"input-wrapper\"\n    [ngClass]=\"{ expanded: expanded, collapsed: !expanded }\"\n    [ngStyle]=\"{ 'height.px': buttonHeight }\"\n    (click)=\"$event.stopPropagation()\"\n  >\n    <!-- INPUT FIELD -->\n    <div class=\"input-group\">\n      <input\n        #input\n        [id]=\"id + '-input'\"\n        class=\"gds-field\"\n        [attr.type]=\"type\"\n        [attr.name]=\"name\"\n        [attr.required]=\"required || null\"\n        [attr.email]=\"email\"\n        [min]=\"min\"\n        [max]=\"max\"\n        [step]=\"step\"\n        [attr.maxlength]=\"maxlength\"\n        [attr.minlength]=\"minlength\"\n        [pattern]=\"pattern\"\n        [disabled]=\"disabled\"\n        [autocomplete]=\"autocomplete\"\n        [autofocus]=\"autofocus\"\n        [readOnly]=\"readonly\"\n        [attr.role]=\"role\"\n        [attr.placeholder]=\"placeholder\"\n        [attr.aria-label]=\"description\"\n        aria-owns=\"listbox\"\n        aria-haspopup=\"listbox\"\n        aria-controls=\"listbox\"\n        [value]=\"state\"\n        (input)=\"onInput($event)\"\n        (focus)=\"onFocus($event)\"\n        (blur)=\"onBlur($event)\"\n      />\n    </div>\n  </div>\n</ng-container>\n","import { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\n\nimport { NggvTooltipModule } from '@sebgroup/green-angular/src/v-angular/tooltip'\nimport { NggvTypeaheadDropdownListComponent } from './typeahead-dropdown-list/typeahead-dropdown-list.component'\nimport { NggvTypeaheadHighlightComponent } from './typeahead-highlight/typeahead-highlight.component'\nimport { NggvTypeaheadInputComponent } from './typeahead-input/typeahead-input.component'\n\n@NgModule({\n  declarations: [\n    NggvTypeaheadHighlightComponent,\n    NggvTypeaheadInputComponent,\n    NggvTypeaheadDropdownListComponent,\n  ],\n  imports: [CommonModule, NggvTooltipModule],\n  exports: [\n    NggvTypeaheadHighlightComponent,\n    NggvTypeaheadInputComponent,\n    NggvTypeaheadDropdownListComponent,\n  ],\n})\nexport class NggvTypeaheadModule {}\n","import { CommonModule } from '@angular/common'\nimport { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'\n\nimport { NggCoreWrapperModule } from '@sebgroup/green-angular/src/lib/shared'\nimport { NggvI18nModule } from '@sebgroup/green-angular/src/v-angular/i18n'\nimport { NggvTooltipModule } from '@sebgroup/green-angular/src/v-angular/tooltip'\nimport { NggvDropdownListComponent } from './dropdown-list/dropdown-list.component'\nimport { NggvDropdownComponent } from './dropdown.component'\nimport { NggvTypeaheadModule } from './typeahead/typeahead.module'\n\n@NgModule({\n  declarations: [NggvDropdownComponent, NggvDropdownListComponent],\n  imports: [\n    CommonModule,\n    NggCoreWrapperModule,\n    NggvTypeaheadModule,\n    NggvTooltipModule,\n    NggvI18nModule,\n  ],\n  exports: [NggvDropdownComponent, NggvDropdownListComponent],\n  schemas: [CUSTOM_ELEMENTS_SCHEMA],\n})\nexport class NggvDropdownModule {}\n","import {\n  ComponentRef,\n  Directive,\n  ElementRef,\n  EventEmitter,\n  Host,\n  HostListener,\n  Input,\n  OnDestroy,\n  OnInit,\n  Optional,\n  Output,\n  ViewContainerRef,\n} from '@angular/core'\nimport {\n  distinctUntilChanged,\n  from,\n  OperatorFunction,\n  Subject,\n  Subscription,\n  takeUntil,\n  tap,\n  withLatestFrom,\n} from 'rxjs'\n\nimport { Option, OptionBase } from '@sebgroup/green-angular/src/v-angular/core'\nimport { NggvInputComponent } from '@sebgroup/green-angular/src/v-angular/input'\nimport { NggvDropdownComponent } from '../dropdown.component'\nimport { NggvTypeaheadDropdownListComponent } from '../typeahead/typeahead-dropdown-list/typeahead-dropdown-list.component'\nimport { NggvTypeaheadInputComponent } from './typeahead-input/typeahead-input.component'\n\n@Directive({\n  selector: 'nggv-input[nggvTypeahead], nggv-dropdown[nggvTypeahead]',\n  standalone: true,\n})\nexport class NggvTypeaheadDirective<\n    K = string | null | undefined,\n    V = string | null | undefined,\n    T extends Option<K, V> = Option<K, V>,\n  >\n  implements OnInit, OnDestroy\n{\n  /** Function that filter the inputvalue */\n  @Input() set nggvTypeahead(value: OperatorFunction<string, T[]> | undefined) {\n    this.typeaheadFunction = value\n\n    // If inputsubscription already exists, unsubscribe and subscribe again\n    if (this.inputSubscription$) {\n      this.inputSubscription$?.unsubscribe()\n      this.inputSubscription$ = undefined\n      this.handleInputChanges()\n    }\n  }\n\n  /** Formats each item that is displayed as an option. Only applies format if the option if it implement Option interface. */\n  @Input() resultFormatter?: (option: OptionBase<any>) => string\n\n  /** Formats the selected item in the input when dropdown is opened. If no function is provided, it will display the value of the selected objects label property */\n  @Input() selectedFormatter?: (selected: OptionBase<any>) => string\n\n  /** Allow option to be unselected in the dropdown even if it is required. Defaults to true */\n  @Input() allowUnselect = true\n\n  /** Custom label for the unselect option */\n  @Input() unselectLabel?: string\n\n  /** Custom label for the empty option */\n  @Input() emptyOptionLabel?: string\n\n  /** Emits the entered string the user has written in the input */\n  @Output() filterPhraseChange = new EventEmitter<string>()\n\n  /** Forward text inputs to apply the filter function*/\n  @HostListener('nggvInput', ['$event']) onNggvInput(event: any) {\n    this.inputValue$.next(event)\n  }\n\n  /** Helper to the determine if the host is nggv-drodpown or nggv-input*/\n  get hostIsDropdown() {\n    return !!this.hostDropdown\n  }\n\n  /** Predefined options */\n  get defaultNullishOption(): OptionBase<any> {\n    return { key: null, label: this.unselectLabel || '\\u00A0' }\n  }\n\n  get emptyOption(): OptionBase<any> {\n    return {\n      key: null,\n      label: this.emptyOptionLabel || 'label.nomatchingoptions',\n      disabled: true,\n    }\n  }\n\n  /** Name of the component. nggv-dropdown if NggvDropdownComponent or nggv-input if NggvInputComponent */\n  get localName() {\n    return this.element.nativeElement.localName\n  }\n\n  dropdownListComponent!: ComponentRef<NggvTypeaheadDropdownListComponent>\n  inputComponent!: ComponentRef<NggvTypeaheadInputComponent>\n\n  private typeaheadFunction?: OperatorFunction<string, T[]>\n  private inputValue$ = new Subject<any>()\n  private inputSubscription$?: Subscription\n  private onDestroy$ = new Subject<boolean>()\n\n  constructor(\n    private viewContainerRef: ViewContainerRef,\n    private element: ElementRef,\n    @Optional() @Host() private hostDropdown: NggvDropdownComponent,\n    @Optional() @Host() private hostInput: NggvInputComponent,\n  ) {}\n\n  ngOnInit() {\n    this.handleInputChanges()\n\n    if (this.hostIsDropdown) this.createInput()\n    else this.createDropdownList()\n  }\n\n  ngOnDestroy(): void {\n    this.onDestroy$.next(true)\n    this.onDestroy$.complete()\n  }\n\n  /**\n   * @internal\n   * Core functionality of typeahead. Emits input, then filters the result based on the supplied function\n   * If directive is applied on nggv-input, manually show or hide options in the list.\n   * If directive is applied on nggv-dropdown, let the dropdown itself choose when to open or close\n   */\n  private handleInputChanges() {\n    this.inputSubscription$ = this.inputValue$\n      .pipe(\n        takeUntil(this.onDestroy$),\n        distinctUntilChanged(),\n        tap((inputValue) => this.filterPhraseChange.emit(inputValue)),\n        this.typeaheadFunction ? this.typeaheadFunction : () => from([]),\n        withLatestFrom(this.inputValue$),\n      )\n      .subscribe(([filteredValues, input]) =>\n        this.setOptions(filteredValues, input),\n      )\n\n    // Trigger the pipe when this function have been called\n    this.inputValue$.next('')\n  }\n\n  /**\n   * @internal\n   * Creates a nggv-input if the host itself is not a text-input\n   * Set styles to not display the input when closed\n   * Trigger filtering when changes occur in the field\n   * */\n  private createInput() {\n    // Create the input component\n    this.inputComponent = this.viewContainerRef.createComponent(\n      NggvTypeaheadInputComponent,\n    )\n    // Forward necessary info to component\n    this.inputComponent.setInput('hostComponent', this.hostDropdown)\n    this.inputComponent.setInput('selectedFormatter', this.selectedFormatter)\n    this.inputComponent.setInput('resultFormatter', this.resultFormatter)\n    // Listen to value changes\n    this.inputComponent.instance.nggvInput\n      .pipe(takeUntil(this.onDestroy$))\n      .subscribe((inputValue) => this.inputValue$.next(inputValue))\n  }\n\n  /** @internal Creates a nggv-dropdown-list if the host itself is a nggv-input */\n  private createDropdownList() {\n    this.dropdownListComponent = this.viewContainerRef.createComponent(\n      NggvTypeaheadDropdownListComponent,\n    )\n    this.dropdownListComponent.setInput('hostComponent', this.hostInput)\n  }\n\n  /**\n   * @internal Sets the options the user can select.\n   * If the host is a nggv-dropdown, utilize the dropdown itself to display the options\n   * If the host is a nggv-input, use the created nggv-dropdown-list to displaye the options\n   * @param filteredValues The options to display in the dropdown\n   * @param emptyInput If the input is empty\n   */\n  private setOptions(filteredValues: T[], input: string) {\n    if (!filteredValues) return\n    // Conditionally add empty or nullish option if it's allowed, the input is empty and does not already contain nullish\n    const allowNullish =\n      this.allowUnselect &&\n      !input &&\n      !(\n        Object.keys(filteredValues[0] ?? {}).includes('key') &&\n        filteredValues[0]?.key == null\n      )\n    if (filteredValues.length === 0) {\n      filteredValues = [this.emptyOption]\n    } else if (allowNullish) {\n      filteredValues = [this.defaultNullishOption].concat(filteredValues)\n    }\n\n    if (this.hostIsDropdown) {\n      // Add nullish option when no input is written (or when dropdown is epanded and has a selection)\n      this.hostDropdown.allowControlNullishOption = false\n      this.hostDropdown.options = this.formatOptions(filteredValues)\n      this.hostDropdown.textToHighlight = `${input || ''}`\n      this.hostDropdown.onlyHandleDistinctChanges = false\n      this.hostDropdown.selectWithSpace = false\n      this.hostDropdown.detectChanges()\n      return\n    }\n\n    if (!this.hostIsDropdown) {\n      this.dropdownListComponent.setInput(\n        'options',\n        this.formatOptions(filteredValues),\n      )\n      this.dropdownListComponent.setInput('textToHighlight', `${input || ''}`)\n    }\n  }\n\n  /**\n   * @internal Formats the available options to display in the dropdown list\n   * @param options The selected value\n   * @returns The formatted value\n   */\n  private formatOptions(options: T[]): OptionBase<any>[] {\n    if (!options) return []\n    if (!this.resultFormatter) return options\n    return options.map((value) =>\n      value?.label ? this.resultFormatter?.(value) : value,\n    )\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.NggvTypeaheadHighlightComponent","i3","i4","i5","i6.NggvDropdownListComponent","i2","i3.NggvTypeaheadHighlightComponent","i1.NggvDropdownComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;MAQa,+BAA+B,CAAA;AAN5C,IAAA,WAAA,GAAA;QAgBE,IAAA,CAAA,IAAI,GAAG,EAAE;QACT,IAAA,CAAA,KAAK,GAAG,EAAE;AAEV;;;AAGK;AACL,QAAA,IAAA,CAAA,uBAAuB,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC;AAoE3C,IAAA;AAlEC,IAAA,WAAW,CAAC,OAAsB,EAAA;AAChC,QAAA,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,OAAO;AAChD,QAAA,IAAI,WAAW,EAAE,YAAY,IAAI,IAAI;YACnC,IAAI,CAAC,IAAI,GAAG,CAAA,EAAG,WAAW,CAAC,YAAY,EAAE;AAC3C,QAAA,IAAI,eAAe,EAAE,YAAY,IAAI,IAAI;YACvC,IAAI,CAAC,KAAK,GAAG,CAAA,EAAG,eAAe,CAAC,YAAY,EAAE;QAChD,IAAI,CAAC,YAAY,EAAE;IACrB;IAEQ,YAAY,GAAA;AAClB,QAAA,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;AAC5D,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;AAE9D,QAAA,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,aAAa,CAAC;;QAG3E,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC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