import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { h as handle } from './index2.js';
import { d as defineCustomElement$2 } from './pds-icon2.js';

const pdsSortableItemCss = ".pds-sortable-item.sc-pds-sortable-item-h{--border-radius:var(--pine-border-radius-125);--border-default:var(--pine-border-width-thin) solid var(--pine-color-grey-300);--box-shadow:var(--pine-box-shadow-400);--color-background-default:var(--pine-color-white);--color-background-interactive:var(--pine-color-grey-200);--color-interactive-handle:var(--pine-color-blue-300);--spacing-margin-inline-end:var(--pine-spacing-300);--spacing-padding-block-xs:var(--pine-spacing-100);--spacing-padding-inline:var(--pine-spacing-300);--spacing-padding-inline-start:var(--pine-spacing-300);-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;padding-block:var(--spacing-padding-block-xs);padding-inline:var(--spacing-padding-inline)}.pds-sortable-item.sc-pds-sortable-item-h .pds-sortable-item__actions.sc-pds-sortable-item{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-padding-start:var(--spacing-padding-inline-start);padding-inline-start:var(--spacing-padding-inline-start)}.pds-sortable-item.sc-pds-sortable-item-h .pds-sortable-item__handle.sc-pds-sortable-item{line-height:1;-webkit-margin-end:var(--spacing-margin-inline-end);margin-inline-end:var(--spacing-margin-inline-end)}.pds-sortable--bordered .pds-sortable-item.sc-pds-sortable-item-h:first-child{border-start-end-radius:var(--border-radius);border-start-start-radius:var(--border-radius)}.pds-sortable--bordered .pds-sortable-item.sc-pds-sortable-item-h:last-child{border-end-end-radius:var(--border-radius);border-end-start-radius:var(--border-radius)}.pds-sortable--divided .pds-sortable-item.sc-pds-sortable-item-h{-webkit-border-after:var(--border-default);border-block-end:var(--border-default)}.pds-sortable--divided .pds-sortable-item.sc-pds-sortable-item-h:last-child{-webkit-border-after:0;border-block-end:0}.pds-sortable--handle-type-row .pds-sortable-item.sc-pds-sortable-item-h{cursor:-webkit-grab;cursor:grab}.pds-sortable--handle-type-handle .pds-sortable-item.sc-pds-sortable-item-h .pds-sortable-item__handle.sc-pds-sortable-item{cursor:-webkit-grab;cursor:grab}.pds-sortable-item.sc-pds-sortable-item-h:hover{background-color:var(--color-background-interactive)}.pds-sortable-item.sc-pds-sortable-item-h:hover pds-icon.sc-pds-sortable-item{color:var(--color-interactive-handle)}.pds-sortable-item--drag.sc-pds-sortable-item-h{background-color:var(--color-background-default);border-radius:0;-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);opacity:1}.pds-sortable-item--ghost.sc-pds-sortable-item-h{background-color:var(--color-background-interactive);border-radius:0}";
const PdsSortableItemStyle0 = pdsSortableItemCss;

const PdsSortableItem$1 = /*@__PURE__*/ proxyCustomElement(class PdsSortableItem extends HTMLElement {
    constructor() {
        super();
        this.__registerHost();
        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: handle }))), h("slot", { key: 'bca5cbb3c4f5b4f1732030428660f5ae976cced0' }), this.enableActions && (h("div", { key: '2928a942128e4bbad4c869f42b59d10501af4419', class: "pds-sortable-item__actions" }, h("slot", { key: 'c2a4e2a47300f1c8f06a23ba134c436a591442bf', name: "sortable-item-actions" })))));
    }
    get el() { return this; }
    static get style() { return PdsSortableItemStyle0; }
}, [6, "pds-sortable-item", {
        "enableActions": [4, "enable-actions"],
        "componentId": [1, "component-id"],
        "showHandle": [1028, "show-handle"]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["pds-sortable-item", "pds-icon"];
    components.forEach(tagName => { switch (tagName) {
        case "pds-sortable-item":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, PdsSortableItem$1);
            }
            break;
        case "pds-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}

const PdsSortableItem = PdsSortableItem$1;
const defineCustomElement = defineCustomElement$1;

export { PdsSortableItem, defineCustomElement };

//# sourceMappingURL=pds-sortable-item.js.map