import { Host, h } from "@stencil/core";
import { handle as handleIcon } from "@pine-ds/icons/icons";
/**
 * @slot sortable-item-actions - Content is placed within the `pds-sortable-item__actions` element as children. This slot is only rendered if `actions` is set to `true`.
 */
export class PdsSortableItem {
    constructor() {
        this.enableActions = false;
        this.componentId = undefined;
        this.showHandle = false;
    }
    componentWillRender() {
        // When the parent sortable has a type of 'handle', the sortable items
        // will automatically set showHandle to 'true'.
        this.sortableRef = this.el.closest('pds-sortable');
        if (this.sortableRef && this.sortableRef.handleType === 'handle') {
            this.showHandle = true;
        }
    }
    render() {
        return (h(Host, { key: '53229fa4308319c59c520bdf84291fb738d6f7c2', class: "pds-sortable-item", id: this.componentId }, this.showHandle && (h("div", { key: '28a4a4fe6a946880e7501fd2a0697152f0665f4c', class: "pds-sortable-item__handle" }, h("pds-icon", { key: 'e45540e3787977b0861418455f6a0689cfcec887', icon: handleIcon }))), h("slot", { key: 'bca5cbb3c4f5b4f1732030428660f5ae976cced0' }), this.enableActions && (h("div", { key: '2928a942128e4bbad4c869f42b59d10501af4419', class: "pds-sortable-item__actions" }, h("slot", { key: 'c2a4e2a47300f1c8f06a23ba134c436a591442bf', name: "sortable-item-actions" })))));
    }
    static get is() { return "pds-sortable-item"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() {
        return {
            "$": ["pds-sortable-item.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["pds-sortable-item.css"]
        };
    }
    static get properties() {
        return {
            "enableActions": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "defaultValue",
                            "text": "false"
                        }],
                    "text": "Determines whether `sortable-item-actions` slot should be enabled."
                },
                "attribute": "enable-actions",
                "reflect": false,
                "defaultValue": "false"
            },
            "componentId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "A unique identifier used for the sortable item `id` attribute."
                },
                "attribute": "component-id",
                "reflect": false
            },
            "showHandle": {
                "type": "boolean",
                "mutable": true,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "defaultValue",
                            "text": "false"
                        }],
                    "text": "Determines whether `sortable-item` should have a handle."
                },
                "attribute": "show-handle",
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
    static get elementRef() { return "el"; }
}
//# sourceMappingURL=pds-sortable-item.js.map
