'use strict';

var index = require('./index-BEF5cZxd.js');
var props = require('./props-CPENhBnM.js');
var constants = require('./constants-WvkMgj1j.js');
var template = require('./template-Cj6PcLmR.js');
require('./gov.log-C5EH15b_.js');
require('./utils-NnC78QR3.js');
require('./sizes-D5zsw2g5.js');

const GovAccordion = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.govChange = index.createEvent(this, "gov-change");
        this.hydrated = false;
        /**
         * Accordion’s size.
         */
        this.size = 'm';
        /**
         * Accordion item underline
         */
        this.noBorder = false;
        this.h = template.govHost(this.host);
    }
    validateSize(newValue) {
        props.validateProp(constants.AccordionSizes, newValue, constants.AccordionClass.root);
    }
    componentWillLoad() {
        this.validateSize(this.size);
    }
    componentDidLoad() {
        this.host.querySelectorAll(constants.AccordionItemClass.root).forEach((child) => {
            child.addEventListener('gov-change', (e) => {
                e.stopPropagation();
                this.govChange.emit({
                    component: constants.AccordionClass.root,
                    open: e.detail.open,
                    ref: e.detail.ref
                });
            });
        });
    }
    connectedCallback() {
        this.hydrated = true;
    }
    render() {
        return (index.h(index.Host, { key: '62ad311346ed2f7caa86f8085b4ee9a7a81c5f92', hydrated: this.hydrated, class: this.h.classes(constants.AccordionClass.root), size: this.size, role: 'list' }, index.h("slot", { key: 'c4fade9da340c36695c6781e411abac9202ffdf8' })));
    }
    get host() { return index.getElement(this); }
    static get watchers() { return {
        "size": ["validateSize"]
    }; }
};

exports.gov_accordion = GovAccordion;
//# sourceMappingURL=gov-accordion.entry.cjs.js.map

//# sourceMappingURL=gov-accordion.cjs.entry.js.map