import { Host, h } from "@stencil/core";
export class CpslSelect {
    constructor() {
        this.inputId = `cpsl-select-${inputIds++}`;
        this.onBlur = (ev) => {
            this.hasFocus = false;
            this.popoverEl.closePopover();
            this.cpslBlur.emit(ev);
        };
        this.onFocus = (ev) => {
            this.hasFocus = true;
            this.cpslFocus.emit(ev);
        };
        this.handleEnterPress = (ev) => {
            if (ev.key === 'Enter') {
                ev.preventDefault();
                this.el.dispatchEvent(new MouseEvent('mousedown'));
            }
        };
        this.selectItem = () => {
            var _a;
            const items = Array.from(this.el.querySelectorAll('cpsl-select-item'));
            items.forEach(item => {
                var _a;
                if (typeof this.selectedValue === 'string') {
                    if (item.value === this.selectedValue) {
                        item.setAttribute('selected', 'true');
                    }
                    else {
                        item.setAttribute('selected', 'false');
                    }
                }
                else {
                    if ((_a = this.selectedValue) === null || _a === void 0 ? void 0 : _a.includes(item.value)) {
                        item.setAttribute('selected', 'true');
                    }
                    else {
                        item.setAttribute('selected', 'false');
                    }
                }
            });
            this.hasSelectedItem = typeof this.selectedValue === 'string' ? !!this.selectedValue : !!((_a = this.selectedValue) === null || _a === void 0 ? void 0 : _a.length);
        };
        this.handleClickOutside = (event) => {
            if (this.hasFocus && !this.el.contains(event.target)) {
                this.hasFocus = false;
                typeof window !== 'undefined' && window.removeEventListener('click', this.handleClickOutside);
            }
        };
        this.handleClick = (e) => {
            var _a;
            const targetId = (_a = e.target.id) !== null && _a !== void 0 ? _a : '';
            if (targetId === 'ignore-click') {
                return;
            }
            if (!this.disabled) {
                this.hasFocus = true;
                typeof window !== 'undefined' && window.addEventListener('click', this.handleClickOutside);
            }
        };
        this.anchorEl = undefined;
        this.hasFocus = false;
        this.popoverOpen = false;
        this.hasSelectedItem = false;
        this.anchorElId = undefined;
        this.autoWidth = false;
        this.disabled = false;
        this.dropdownMaxHeight = undefined;
        this.errorText = undefined;
        this.formatValue = undefined;
        this.helperText = undefined;
        this.id = `${this.inputId}-trigger`;
        this.icon = 'chevronUp';
        this.label = undefined;
        this.multiple = undefined;
        this.noIconAnimation = undefined;
        this.placeholder = undefined;
        this.required = false;
        this.selectedValue = undefined;
        this.showFormattedSelectedItem = undefined;
        this.showOptionalLabel = false;
        this.showSearch = false;
        this.searchPlaceholder = undefined;
        this.selectedItemColor = 'primary';
        this.selectedItemVariant = 'bodyM';
        this.selectedItemWeight = 'regular';
    }
    onValueChange() {
        if (!this.multiple) {
            this.popoverEl.closePopover();
        }
    }
    handleValueChange() {
        this.selectItem();
    }
    selectItemClickHandler(event) {
        this.cpslSelectValueChange.emit(event.detail);
    }
    onPopoverOpen() {
        this.popoverOpen = true;
    }
    onPopoverClose() {
        this.popoverOpen = false;
    }
    componentDidLoad() {
        this.popoverEl = this.el.shadowRoot.querySelector(`cpsl-popover`);
        this.anchorEl = this.anchorElId ? document.getElementById(this.anchorElId) : this.el.shadowRoot.getElementById('select-container');
        this.selectItem();
    }
    render() {
        var _a, _b, _c, _d, _e;
        const selectedValueAsString = Array.isArray(this.selectedValue) ? this.selectedValue.join(', ') : this.selectedValue;
        return (h(Host, { key: 'f7c2db799e3462ef83fd0e7b29a3fd88a2d69e38', id: this.id, class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': this.hasSelectedItem } }, this.label && (h("label", { key: '8629dcd2d81bbf631962f84c551b2e2a3c96dd33', class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? h("span", { class: "optional-label" }, "(optional)") : '')), h("div", { key: 'f01a1d57e48256e4b1898beeebb4c01275966aa6', part: "select-container", id: "select-container", class: { 'select-container': true, 'error-container': Boolean(this.errorText) }, onMouseDown: this.handleClick }, this.hasSelectedItem && this.showFormattedSelectedItem && h("slot", { key: 'eb8a31b3254990d3f4165275561b21fe9e9abaf9', name: "selected-item" }), h("div", { key: 'a78cec861e87ac9702477bddf10ec4c66cf37626', class: { 'selected-container-content': true, 'hidden': this.hasSelectedItem && this.showFormattedSelectedItem }, id: "selected-container-content", style: {} }, (!this.hasSelectedItem || !this.showFormattedSelectedItem) && (h("cpsl-text", { key: '74fdd4ff8ad178376220d89890f507b304298be4', class: { 'selected-text': true, 'placeholder': !this.selectedValue }, part: "selected-text", color: this.selectedItemColor, variant: this.selectedItemVariant, weight: this.selectedItemWeight }, !this.selectedValue ? ((_a = this.placeholder) !== null && _a !== void 0 ? _a : 'Select') : ((_c = (_b = this.formatValue) === null || _b === void 0 ? void 0 : _b.call(this, this.selectedValue)) !== null && _c !== void 0 ? _c : selectedValueAsString)))), h("cpsl-icon", { key: '7f0f942c54e7b72279fbff7cba99b1a84105b912', part: "icon", class: { 'chevron': true, 'open': !this.noIconAnimation && this.popoverOpen, 'has-value': this.hasSelectedItem }, icon: this.icon }), h("input", { key: '43e2fbcd9d13168ecdd9fadb2047591480cf2c42', id: this.inputId, disabled: this.disabled, class: { disabled: this.disabled }, value: this.selectedValue, onFocus: this.onFocus, onBlur: this.onBlur, onKeyPress: this.handleEnterPress, inputmode: "none" }), h("cpsl-popover", { key: '926ef9d6f59215260143f133104e63a46ecedc1f', part: "popover", autoWidth: this.autoWidth, trigger: this.id, preventBlur: this.hasFocus, disabled: this.disabled, anchorEl: this.anchorEl }, h("div", { key: '90520534785a584d539d5ef8e49ff394d2f4c3d7', part: "dropdown", class: "dropdown" }, this.showSearch && (h("div", { key: 'e0cf6cf0e4d0c17981b78428ff3ceeb049cebba5', class: "search-container" }, h("cpsl-input", { key: 'e1d3bc0a68026b0cbbca0677a30b26934b6296be', onClick: e => e.stopPropagation(), placeholder: (_d = this.searchPlaceholder) !== null && _d !== void 0 ? _d : 'Search', value: "", onCpslInput: e => {
                e.stopPropagation();
                this.cpslSearchChange.emit(e.detail.value);
            } }))), h("div", { key: '4f12646017f6b9c95a717188d7329750e8bdf74e', class: "dropdown-inner", style: { maxHeight: `${this.dropdownMaxHeight}px` } }, h("slot", { key: '33fd8a222ea76686c6d00ed388decb5ab10b98d8', name: "items" }))))), (this.errorText || this.helperText) && (h("div", { key: 'f9e99bd7e2a4c4eb98ea540c2ba0ed9a1e0feb67', class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, h("span", { key: 'eae52c7b8dad9a6f702abb01f9f8205d7a96a82d' }, (_e = this.errorText) !== null && _e !== void 0 ? _e : this.helperText)))));
    }
    static get is() { return "cpsl-select"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["cpsl-select.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["cpsl-select.css"]
        };
    }
    static get properties() {
        return {
            "anchorElId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "ID of element to anchor popover to."
                },
                "attribute": "anchor-el-id",
                "reflect": false
            },
            "autoWidth": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "If `true` the popover container will use the width of the content, else it will be set to the width of the trigger.\nDefault is `false`"
                },
                "attribute": "auto-width",
                "reflect": false,
                "defaultValue": "false"
            },
            "disabled": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the user cannot interact with the input."
                },
                "attribute": "disabled",
                "reflect": false,
                "defaultValue": "false"
            },
            "dropdownMaxHeight": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Set the max height of the dropdown."
                },
                "attribute": "dropdown-max-height",
                "reflect": false
            },
            "errorText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Error text to show below the input. If this is provided the input will enter an error state."
                },
                "attribute": "error-text",
                "reflect": false
            },
            "formatValue": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(value: string | string[]) => string",
                    "resolved": "(value: string | string[]) => string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Format value for display when selected."
                }
            },
            "helperText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Helper text to show below the input. If `\"errorText\"` is provided that will take precedence."
                },
                "attribute": "helper-text",
                "reflect": false
            },
            "id": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "ID of the element, must be unique for the popover trigger."
                },
                "attribute": "id",
                "reflect": false,
                "defaultValue": "`${this.inputId}-trigger`"
            },
            "icon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "IconType",
                    "resolved": "\"search\" | \"lg\" | \"alertCircle\" | \"alertTriangle\" | \"alignVerticalCenter\" | \"angelListBrand\" | \"angelList\" | \"appleBrand\" | \"apple\" | \"arbitrumBrand\" | \"arrowCircleBrokenDownLeft\" | \"arrowCircleDownFilled\" | \"arrowNarrow\" | \"arrow\" | \"asterisk\" | \"backupKit\" | \"bank\" | \"baseBrand\" | \"brush\" | \"celoBrand\" | \"checkCircleFilled\" | \"checkCircle\" | \"checkSquare\" | \"check\" | \"chevronDown\" | \"chevronRight\" | \"chevronSelectorVertical\" | \"chevronUp\" | \"clock\" | \"close\" | \"clubhouseBrand\" | \"clubhouse\" | \"code\" | \"copy07\" | \"copy\" | \"cosmos\" | \"creditCard02\" | \"creditCard\" | \"cube03\" | \"cubeOutline\" | \"cube\" | \"currencyDollar\" | \"decentBrand\" | \"decent\" | \"dell\" | \"discordBrand\" | \"discord\" | \"dot\" | \"dots\" | \"downloadCloud\" | \"download\" | \"dribbbleBrand\" | \"dribbble\" | \"earth\" | \"edit02\" | \"emptyCircle\" | \"ethereum\" | \"eyeOff\" | \"eye\" | \"facebookBrand\" | \"facebook\" | \"farcasterBrand\" | \"farcaster\" | \"figmaBrand\" | \"figma\" | \"file\" | \"folder\" | \"githubBrand\" | \"github\" | \"globe\" | \"googleBrand\" | \"google\" | \"gridDots\" | \"helpCircle\" | \"heroAlertCircle\" | \"heroCheckmarkCapsule\" | \"heroCheckmark\" | \"heroEmail\" | \"heroExternalConnection\" | \"heroLock\" | \"heroPasskey\" | \"heroPhone\" | \"heroPlusCircleCapsule\" | \"heroPlusCircle\" | \"heroWallet\" | \"home\" | \"hp\" | \"image\" | \"infoCircle\" | \"instagramBrand\" | \"instagram\" | \"key\" | \"laptop\" | \"lenovo\" | \"lightning01\" | \"lightning\" | \"linkExternal\" | \"linkedinBrand\" | \"linkedin\" | \"lockKeyholeCircle\" | \"logOut\" | \"mail\" | \"menu\" | \"monitor\" | \"moonpayBrand\" | \"moreLoginOptions\" | \"motorola\" | \"nobleBrand\" | \"optimismBrand\" | \"paraBlackBg\" | \"paraBrand\" | \"paraIconBrand\" | \"paraIconQr\" | \"paraIcon\" | \"paraLogo\" | \"paraRingsDark\" | \"paraRings\" | \"para\" | \"passcode\" | \"phone\" | \"pintrestBrand\" | \"pintrest\" | \"plusCircle\" | \"plus\" | \"polygonBrand\" | \"polygon\" | \"puzzlePiece\" | \"qrCode02\" | \"qrCode\" | \"rampNetworkBrand\" | \"rampNetwork\" | \"redditBrand\" | \"reddit\" | \"refresh\" | \"samsung\" | \"send\" | \"settings\" | \"share\" | \"shield\" | \"signalBrand\" | \"signal\" | \"sliders\" | \"snapchatBrand\" | \"snapchat\" | \"solana\" | \"spacingHeight\" | \"star04Filled\" | \"stars01Filled\" | \"stars02\" | \"stars\" | \"stopSquare\" | \"stripeBrand\" | \"telegramBrand\" | \"telegram\" | \"tetherBrand\" | \"tikTokBrand\" | \"tikTok\" | \"trash\" | \"tumblrBrand\" | \"tumblr\" | \"twitterBrand\" | \"twitter\" | \"usdcBrand\" | \"userCircle\" | \"user\" | \"wallet\" | \"x\" | \"youtubeBrand\" | \"youtube\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BQ2\" | \"BQ3\" | \"BR\" | \"BS\" | \"BT\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CD2\" | \"CF\" | \"CH\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DS\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB2\" | \"GB\" | \"GD\" | \"GE\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GQ\" | \"GR\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SE\" | \"SG\" | \"SI\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"US\" | \"UY\" | \"UZ\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WS\" | \"YE\" | \"ZA\" | \"ZM\" | \"ZW\"",
                    "references": {
                        "IconType": {
                            "location": "import",
                            "path": "../../interface.js",
                            "id": "src/interface.ts::IconType"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "The name of the icon to use for the end icon.\nDefault: `chevronUp`"
                },
                "attribute": "icon",
                "reflect": false,
                "defaultValue": "'chevronUp'"
            },
            "label": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "The label for the input."
                },
                "attribute": "label",
                "reflect": false
            },
            "multiple": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the user can select more than one value."
                },
                "attribute": "multiple",
                "reflect": false
            },
            "noIconAnimation": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Whether or not to show the rotation animation for the end icon."
                },
                "attribute": "no-icon-animation",
                "reflect": false
            },
            "placeholder": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Placeholder to display if `selectedValue` is empty."
                },
                "attribute": "placeholder",
                "reflect": false
            },
            "required": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the user must fill in a value before submitting a form."
                },
                "attribute": "required",
                "reflect": false,
                "defaultValue": "false"
            },
            "selectedValue": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string | string[]",
                    "resolved": "string | string[]",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Value of the selected item."
                },
                "attribute": "selected-value",
                "reflect": false
            },
            "showFormattedSelectedItem": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Will show the formatted selected item (passed in the `selected-item` slot) in the select rather than the item value."
                },
                "attribute": "show-formatted-selected-item",
                "reflect": false
            },
            "showOptionalLabel": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the label will display an \"optional\" tag."
                },
                "attribute": "show-optional-label",
                "reflect": false,
                "defaultValue": "false"
            },
            "showSearch": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the dropdown will contain a search field."
                },
                "attribute": "show-search",
                "reflect": false,
                "defaultValue": "false"
            },
            "searchPlaceholder": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Placeholder for the search field."
                },
                "attribute": "search-placeholder",
                "reflect": false
            },
            "selectedItemColor": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'primary' | 'secondary' | 'tertiary' | 'subtle' | 'inverted' | 'error' | 'contrast'",
                    "resolved": "\"contrast\" | \"error\" | \"inverted\" | \"primary\" | \"secondary\" | \"subtle\" | \"tertiary\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "The color of the selected item or placeholder text.\nOptions are: `\"primary\"`, `\"secondary\", `\"tertiary\", `\"subtle\", `\"inverted\", `\"error\".\nDefault is: `\"primary\"`."
                },
                "attribute": "selected-item-color",
                "reflect": false,
                "defaultValue": "'primary'"
            },
            "selectedItemVariant": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'body2XS' | 'bodyXS' | 'bodyS' | 'bodyM' | 'bodyL' | 'bodyXL' | 'headingXS' | 'headingS' | 'headingM' | 'headingL' | 'headingXL' | 'heading2XL'",
                    "resolved": "\"body2XS\" | \"bodyL\" | \"bodyM\" | \"bodyS\" | \"bodyXL\" | \"bodyXS\" | \"heading2XL\" | \"headingL\" | \"headingM\" | \"headingS\" | \"headingXL\" | \"headingXS\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "The variant of the selected item or placeholder text.\nOptions are: `\"body2XS\"`, `\"bodyXS\", `\"bodyS\", `\"bodyM\", `\"bodyL\", `\"bodyXL\", `\"headingXS\", `\"headingS\", `\"headingM\", `\"headingL\", `\"headingXL\", `\"heading2XL\".\nDefault is: `\"bodyM\"`."
                },
                "attribute": "selected-item-variant",
                "reflect": false,
                "defaultValue": "'bodyM'"
            },
            "selectedItemWeight": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'regular' | 'medium' | 'semiBold' | 'bold'",
                    "resolved": "\"bold\" | \"medium\" | \"regular\" | \"semiBold\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "The weight of the selected item or placeholder text.\nOptions are: `\"regular\"`, `\"medium\", `\"semiBold\", `\"bold\".\nDefault is: `\"regular\"`."
                },
                "attribute": "selected-item-weight",
                "reflect": false,
                "defaultValue": "'regular'"
            }
        };
    }
    static get states() {
        return {
            "anchorEl": {},
            "hasFocus": {},
            "popoverOpen": {},
            "hasSelectedItem": {}
        };
    }
    static get events() {
        return [{
                "method": "cpslBlur",
                "name": "cpslBlur",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the input loses focus."
                },
                "complexType": {
                    "original": "FocusEvent",
                    "resolved": "FocusEvent",
                    "references": {
                        "FocusEvent": {
                            "location": "global",
                            "id": "global::FocusEvent"
                        }
                    }
                }
            }, {
                "method": "cpslFocus",
                "name": "cpslFocus",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the input has focus."
                },
                "complexType": {
                    "original": "FocusEvent",
                    "resolved": "FocusEvent",
                    "references": {
                        "FocusEvent": {
                            "location": "global",
                            "id": "global::FocusEvent"
                        }
                    }
                }
            }, {
                "method": "cpslSelectValueChange",
                "name": "cpslSelectValueChange",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the value changes."
                },
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                }
            }, {
                "method": "cpslSearchChange",
                "name": "cpslSearchChange",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the search value changes."
                },
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                }
            }];
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "selectedValue",
                "methodName": "onValueChange"
            }, {
                "propName": "selectedValue",
                "methodName": "handleValueChange"
            }];
    }
    static get listeners() {
        return [{
                "name": "cpslSelectItemClick",
                "method": "selectItemClickHandler",
                "target": undefined,
                "capture": false,
                "passive": false
            }, {
                "name": "cpslOpen",
                "method": "onPopoverOpen",
                "target": undefined,
                "capture": false,
                "passive": false
            }, {
                "name": "cpslClose",
                "method": "onPopoverClose",
                "target": undefined,
                "capture": false,
                "passive": false
            }];
    }
}
let inputIds = 0;
//# sourceMappingURL=cpsl-select.js.map
