/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { b as getIonTheme } from './ionic-global.js';

const listIonicCss = "ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}.list-ionic.list-inset{-webkit-margin-start:var(--token-space-100, var(--token-scale-100, 4px));margin-inline-start:var(--token-space-100, var(--token-scale-100, 4px));-webkit-margin-end:var(--token-space-100, var(--token-scale-100, 4px));margin-inline-end:var(--token-space-100, var(--token-scale-100, 4px));margin-top:var(--token-space-100, var(--token-scale-100, 4px));margin-bottom:var(--token-space-100, var(--token-scale-100, 4px))}.list-ionic-lines-none .item-lines-default{--inner-border-width:0px;--border-width:0px}.list-ionic:has(ion-list-header){}.list-ionic:has(ion-list-header).list-round{border-start-start-radius:initial;border-start-end-radius:initial;border-end-end-radius:var(--token-border-radius-400, var(--token-scale-400, 16px));border-end-start-radius:var(--token-border-radius-400, var(--token-scale-400, 16px))}.list-ionic:has(ion-list-header).list-round ion-list-header+*{border-start-start-radius:var(--token-border-radius-400, var(--token-scale-400, 16px));border-start-end-radius:var(--token-border-radius-400, var(--token-scale-400, 16px));border-end-end-radius:initial;border-end-start-radius:initial}.list-ionic:has(ion-list-header).list-soft{border-start-start-radius:initial;border-start-end-radius:initial;border-end-end-radius:var(--token-border-radius-200, var(--token-scale-200, 8px));border-end-start-radius:var(--token-border-radius-200, var(--token-scale-200, 8px))}.list-ionic:has(ion-list-header).list-soft ion-list-header+*{border-start-start-radius:var(--token-border-radius-200, var(--token-scale-200, 8px));border-start-end-radius:var(--token-border-radius-200, var(--token-scale-200, 8px));border-end-end-radius:initial;border-end-start-radius:initial}.list-ionic:has(ion-list-header).list-rectangular{border-start-start-radius:initial;border-start-end-radius:initial;border-end-end-radius:var(--token-border-radius-0, var(--token-scale-0, 0px));border-end-start-radius:var(--token-border-radius-0, var(--token-scale-0, 0px))}.list-ionic:has(ion-list-header).list-rectangular ion-list-header+*{border-start-start-radius:var(--token-border-radius-0, var(--token-scale-0, 0px));border-start-end-radius:var(--token-border-radius-0, var(--token-scale-0, 0px));border-end-end-radius:initial;border-end-start-radius:initial}.list-ionic:not(:has(ion-list-header)){}.list-ionic:not(:has(ion-list-header)).list-round{border-radius:var(--token-border-radius-400, var(--token-scale-400, 16px))}.list-ionic:not(:has(ion-list-header)).list-soft{border-radius:var(--token-border-radius-200, var(--token-scale-200, 8px))}.list-ionic:not(:has(ion-list-header)).list-rectangular{border-radius:var(--token-border-radius-0, var(--token-scale-0, 0px))}.list-ionic-lines-none .item-lines-default{--inner-border-width:var(--token-border-size-0, var(--token-scale-0, 0px));--border-width:var(--token-border-size-0, var(--token-scale-0, 0px))}.list-ionic-lines-full .item-lines-default{--inner-border-width:var(--token-border-size-0, var(--token-scale-0, 0px));--border-width:var(--token-border-size-0, var(--token-scale-0, 0px)) var(--token-border-size-0, var(--token-scale-0, 0px)) var(--token-border-size-025, var(--token-scale-025, 1px)) var(--token-border-size-0, var(--token-scale-0, 0px))}.list-ionic-lines-inset .item-lines-default{--inner-border-width:var(--token-border-size-0, var(--token-scale-0, 0px)) var(--token-border-size-0, var(--token-scale-0, 0px)) var(--token-border-size-025, var(--token-scale-025, 1px)) var(--token-border-size-0, var(--token-scale-0, 0px));--border-width:var(--token-border-size-0, var(--token-scale-0, 0px))}";

const listIosCss = "ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{-webkit-transform:translateZ(0);transform:translateZ(0);overflow:hidden}.list-ios{background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-ios.list-inset{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px;border-radius:10px}.list-ios.list-inset ion-item:only-child,.list-ios.list-inset ion-item:not(:only-of-type):last-of-type,.list-ios.list-inset ion-item-sliding:last-of-type ion-item{--border-width:0;--inner-border-width:0}.list-ios.list-inset+ion-list.list-inset{margin-top:0}.list-ios-lines-none .item-lines-default{--inner-border-width:0px;--border-width:0px}.list-ios-lines-full .item-lines-default{--inner-border-width:0px;--border-width:0 0 0.55px 0}.list-ios-lines-inset .item-lines-default{--inner-border-width:0 0 0.55px 0;--border-width:0px}ion-card .list-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";

const listMdCss = "ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{-webkit-transform:translateZ(0);transform:translateZ(0);overflow:hidden}.list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-md>.input:last-child::after{inset-inline-start:0}.list-md.list-inset{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px;border-radius:2px}.list-md.list-inset ion-item:not(:only-of-type):last-of-type,.list-md.list-inset ion-item-sliding:last-of-type ion-item{--border-width:0;--inner-border-width:0}.list-md.list-inset ion-item:only-child{--border-width:0;--inner-border-width:0}.list-md.list-inset+ion-list.list-inset{margin-top:0}.list-md-lines-none .item-lines-default{--inner-border-width:0px;--border-width:0px}.list-md-lines-full .item-lines-default{--inner-border-width:0px;--border-width:0 0 1px 0}.list-md-lines-inset .item-lines-default{--inner-border-width:0 0 1px 0;--border-width:0px}ion-card .list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";

const List = /*@__PURE__*/ proxyCustomElement(class List extends HTMLElement {
    constructor(registerHost) {
        super();
        if (registerHost !== false) {
            this.__registerHost();
        }
        /**
         * If `true`, the list will have margin around it and rounded corners.
         */
        this.inset = false;
    }
    /**
     * If `ion-item-sliding` are used inside the list, this method closes
     * any open sliding item.
     *
     * Returns `true` if an actual `ion-item-sliding` is closed.
     */
    async closeSlidingItems() {
        const item = this.el.querySelector('ion-item-sliding');
        if (item === null || item === void 0 ? void 0 : item.closeOpened) {
            return item.closeOpened();
        }
        return false;
    }
    getShape() {
        const theme = getIonTheme(this);
        const { shape, inset } = this;
        // TODO(ROU-10831): Remove theme check when shapes are defined for all themes.
        if (theme !== 'ionic') {
            return undefined;
        }
        if (shape === undefined && inset) {
            return 'round';
        }
        if (shape === undefined) {
            return 'rectangular';
        }
        return shape;
    }
    render() {
        const theme = getIonTheme(this);
        const shape = this.getShape();
        const { lines, inset } = this;
        return (h(Host, { key: '7deda9d813391cac1c4156fb9e9fd1f1a43cdea8', role: "list", class: {
                [theme]: true,
                // Used internally for styling
                [`list-${theme}`]: true,
                'list-inset': inset,
                [`list-lines-${lines}`]: lines !== undefined,
                [`list-${theme}-lines-${lines}`]: lines !== undefined,
                [`list-${shape}`]: shape !== undefined,
            } }));
    }
    get el() { return this; }
    static get style() { return {
        ionic: listIonicCss,
        ios: listIosCss,
        md: listMdCss
    }; }
}, [288, "ion-list", {
        "lines": [1],
        "inset": [4],
        "shape": [1],
        "closeSlidingItems": [64]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["ion-list"];
    components.forEach(tagName => { switch (tagName) {
        case "ion-list":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, List);
            }
            break;
    } });
}

export { List as L, defineCustomElement as d };
