import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-4a3a9179.js';
import { m as messageId, P as PdsLabel, a as assignDescription } from './pds-label-5a20380b.js';

const pdsCheckboxCss = ":host{--background-color:var(--pine-color-base-white);--background-color-disabled:var(--pine-color-neutral-grey-200);--background-color-hover:var(--pine-color-neutral-grey-100);--border:var(--pine-border-interactive);--border-color-disabled:var(--pine-color-neutral-charcoal-100);--border-color-hover:var(--pine-border-interactive-hover-color);--border-color-icon:var(--pine-color-base-white);--border-radius:var(--pine-border-radius-xs);--color-checked:var(--pine-color-neutral-charcoal-500);--color-disabled:var(--pine-color-neutral-grey-300);--color-focus:var(--pine-color-primary-200);--color-invalid-focus:var(--pine-color-red-200);--color-invalid:var(--pine-color-red-300);--message-color-disabled:var(--pine-color-neutral-grey-500);--message-color:var(--pine-color-neutral-charcoal-200);--input-size:16px;-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap}:host(.is-invalid) input{border-color:var(--color-invalid)}:host(.is-invalid) input:checked{background:var(--color-invalid)}:host(.is-invalid) input:focus-visible{-webkit-box-shadow:0 0 0 4px var(--color-invalid-focus);box-shadow:0 0 0 4px var(--color-invalid-focus);outline:none}:host(.is-invalid) label,:host(.is-invalid) .pds-checkbox__message--error{color:var(--color-invalid)}:host(.is-indeterminate) input:checked::after{border-bottom:0;-webkit-transform:rotate(87deg) translate3d(-114%, 25%, 0);transform:rotate(87deg) translate3d(-114%, 25%, 0)}input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--background-color);border:var(--border);border-radius:var(--border-radius);height:var(--input-size);margin:0;position:relative;width:var(--input-size)}input:hover{background:var(--background-color-hover);border-color:var(--border-color-hover)}input:checked{background:var(--color-checked);border-color:var(--color-checked)}input:checked::after{border:1px solid var(--border-color-icon);border-left:0;border-top:0;content:\"\";display:block;height:7px;left:50%;position:absolute;top:50%;-webkit-transform:rotate(43deg) translate3d(-110%, -30%, 0);transform:rotate(43deg) translate3d(-110%, -30%, 0);width:4px}input:disabled{background:var(--background-color-disabled);border-color:var(--color-disabled);cursor:not-allowed}input:disabled:checked{background:var(--color-disabled);border-color:var(--color-disabled)}input:disabled:checked::after{border-color:var(--border-color-disabled)}input:disabled+label{color:var(--border-color-hover);cursor:not-allowed}input:disabled~.pds-checkbox__message{color:var(--message-color-disabled)}input:focus-visible{-webkit-box-shadow:0 0 0 4px var(--color-focus);box-shadow:0 0 0 4px var(--color-focus);outline:none}label{-webkit-margin-start:10px;margin-inline-start:10px}.visually-hidden{border:0;clip:rect(0 0 0 0);-webkit-clip-path:polygon(0 0, 0 0, 0 0);clip-path:polygon(0 0, 0 0, 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pds-checkbox__message{color:var(--message-color);font-size:14px;-webkit-margin-before:6px;margin-block-start:6px;-webkit-margin-start:26px;margin-inline-start:26px;width:100%}";
const PdsCheckboxStyle0 = pdsCheckboxCss;

const PdsCheckbox = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.pdsCheckboxChange = createEvent(this, "pdsCheckboxChange", 7);
        this.handleCheckboxChange = (e) => {
            if (this.disabled) {
                return;
            }
            const target = e.target;
            this.checked = target.checked;
            this.pdsCheckboxChange.emit({
                checked: target.checked,
                value: this.value
            });
        };
        this.checked = undefined;
        this.componentId = undefined;
        this.disabled = undefined;
        this.errorMessage = undefined;
        this.helperMessage = undefined;
        this.indeterminate = undefined;
        this.invalid = undefined;
        this.label = undefined;
        this.labelHidden = undefined;
        this.name = undefined;
        this.required = undefined;
        this.value = undefined;
    }
    classNames() {
        const classNames = [];
        if (this.invalid) {
            classNames.push('is-invalid');
        }
        if (this.indeterminate) {
            classNames.push('is-indeterminate');
        }
        if (this.disabled) {
            classNames.push('is-disabled');
        }
        return classNames.join('  ');
    }
    render() {
        return (h(Host, { key: '44451f5e8df2550217af485162015a0810b2735e', class: this.classNames() }, h("input", { key: 'c4bac864eb6c990b389b1892f26211af7a6b5be8', "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, type: "checkbox", id: this.componentId, name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onChange: this.handleCheckboxChange }), h(PdsLabel, { key: 'eea4ae7c7795854e34a228d79f7e3228d695ff7e', htmlFor: this.componentId, text: this.label, classNames: this.labelHidden ? 'visually-hidden' : '' }), this.helperMessage &&
            h("div", { class: 'pds-checkbox__message', id: messageId(this.componentId, 'helper') }, this.helperMessage), this.errorMessage &&
            h("div", { class: `pds-checkbox__message pds-checkbox__message--error`, id: messageId(this.componentId, 'error'), "aria-live": "assertive" }, this.errorMessage)));
    }
};
PdsCheckbox.style = PdsCheckboxStyle0;

const pdsTableCellCss = ":host{--background-fixed:var(--pine-color-base-white);--box-shadow:3px 3px 6px -2px rgba(0, 0, 0, 0.2);--color:var(--pine-color-neutral-charcoal-200);--fixed-column-index:0;--font-size:var(--pine-font-size-body-sm);--line-height:var(--pine-line-height-sm);--padding:calc(var(--pine-spacing-md) / 2);--padding-compact:var(--pine-spacing-xxs);--fixed-cell-position:0;--max-width-truncated:100px;color:var(--color);display:table-cell;font-size:var(--font-size);line-height:var(--line-height);padding:var(--padding);vertical-align:inherit}:host(.is-compact){padding-block:var(--padding-compact)}:host(.is-fixed){background:var(--background-fixed);left:var(--fixed-cell-position);position:-webkit-sticky;position:sticky;z-index:1}:host(.has-scrolled.is-fixed){-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}:host(.is-truncated){max-width:var(--max-width-truncated);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.has-checkbox){vertical-align:middle;width:16px}";
const PdsTableCellStyle0 = pdsTableCellCss;

const PdsTableCell = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.handleScroll = () => {
            if (this.tableRef.scrollLeft > 0) {
                this.tableScrolling = true;
            }
            else {
                this.tableScrolling = false;
            }
        };
        this.truncate = undefined;
        this.tableScrolling = false;
    }
    componentWillRender() {
        this.tableRef = this.hostElement.closest('pds-table');
    }
    componentDidLoad() {
        if (this.tableRef && this.tableRef.responsive && this.tableRef.fixedColumn) {
            this.tableRef.addEventListener('scroll', this.handleScroll);
        }
    }
    classNames() {
        const classNames = [];
        if (this.tableRef && this.tableRef.compact) {
            classNames.push('is-compact');
        }
        if (this.truncate) {
            classNames.push('is-truncated');
        }
        if (this.tableRef && this.tableRef.fixedColumn && this.tableScrolling) {
            classNames.push('has-scrolled');
        }
        return classNames.join(' ');
    }
    render() {
        return (h(Host, { key: 'a4dc8a8339277b782f4a2ee0a675fe1cfba9882f', class: this.classNames(), role: "gridcell", style: this.tableRef &&
                this.tableRef.fixedColumn &&
                this.tableRef.selectable
                ? { '--fixed-cell-position': '40px' }
                : {} }, h("slot", { key: '1f00d0fe4e83ada31b33d760a34e2dfcb914be23' })));
    }
    get hostElement() { return getElement(this); }
};
PdsTableCell.style = PdsTableCellStyle0;

export { PdsCheckbox as pds_checkbox, PdsTableCell as pds_table_cell };

//# sourceMappingURL=pds-checkbox_2.entry.js.map