<commit_before>// Copyright 2019 Ayogo Health Inc

/**
 * ay-accordion-header acts as a button for its first parent ay-accordion element thereby enabling the toggle functionality
 *
 * For example:
 * ```
 * <ay-accordion-header>
 *  Button Name
 * </ay-accordion-header>
 * ```
 *
 * @name ay-accordion-header
 *
 */

const accordionHeaderClickMap : WeakMap<HTMLElement, () => void> = new WeakMap();
const accordionHeaderPressMap : WeakMap<HTMLElement, (event: KeyboardEvent) => void> = new WeakMap();

export class AyAccordionHeader extends HTMLElement {

  connectedCallback() {
    const ayAccordionElem = this.closest('ay-accordion') as HTMLElement;

    this.setAttribute('role', 'button');
    this.setAttribute('tabIndex', '0');


    const toggleOnClick = () => {
      let toggleEvent = new Event('toggle');
      console.log('dispatching click event from header');
      ayAccordionElem.dispatchEvent(toggleEvent);
    };

    const toggleOnPress = (event: KeyboardEvent) => {
      let toggleEvent = new Event('toggle');
      if (event.keyCode === 32 || event.keyCode === 13) {
        ayAccordionElem.dispatchEvent(toggleEvent);
      } else {
        return;
      }
    };
<commit_msg>MS-125 Removed console.log<commit_after>// Copyright 2019 Ayogo Health Inc

/**
 * ay-accordion-header acts as a button for its first parent ay-accordion element thereby enabling the toggle functionality
 *
 * For example:
 * ```
 * <ay-accordion-header>
 *  Button Name
 * </ay-accordion-header>
 * ```
 *
 * @name ay-accordion-header
 *
 */

const accordionHeaderClickMap : WeakMap<HTMLElement, () => void> = new WeakMap();
const accordionHeaderPressMap : WeakMap<HTMLElement, (event: KeyboardEvent) => void> = new WeakMap();

export class AyAccordionHeader extends HTMLElement {

  connectedCallback() {
    const ayAccordionElem = this.closest('ay-accordion') as HTMLElement;

    this.setAttribute('role', 'button');
    this.setAttribute('tabIndex', '0');


    const toggleOnClick = () => {
      let toggleEvent = new Event('toggle');
      ayAccordionElem.dispatchEvent(toggleEvent);
    };

    const toggleOnPress = (event: KeyboardEvent) => {
      let toggleEvent = new Event('toggle');
      if (event.keyCode === 32 || event.keyCode === 13) {
        ayAccordionElem.dispatchEvent(toggleEvent);
      } else {
        return;
      }
    };

{'fraction_non_alphanumeric': 0.13237165888841748, 'fraction_numerical': 0.008909630886720407, 'mean_word_length': 3.5609284332688587, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1361876', 'n_tokens_mistral': 737, 'n_tokens_neox': 704, 'n_words': 171}