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: '60214e183314736338f9b38cb93a9c5989e16cdf', class: "pds-sortable-item", id: this.componentId }, this.showHandle && (h("div", { key: '7cc252c99598f384a87518c101d0772a4ce344e4', class: "pds-sortable-item__handle" }, h("pds-icon", { key: 'e2b219927cf717fa53112066ba3fe0ac12688edd', icon: handleIcon }))), h("slot", { key: 'e259bfbf7e8c848567d07639e62adfe5781f29b8' }), this.enableActions && (h("div", { key: 'e83d28d55b6fee971575433a3e3f8b1d5b7e52fe', class: "pds-sortable-item__actions" }, h("slot", { key: '7ac52a8109e49cfff96cead45a3b318646c7f064', 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
