import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { a as assignDescription, P as PdsLabel, m as messageId } from './pds-label.js';

const baseCss = ".sc-pds-radio:where(*:not(slot),*.sc-pds-radio:not(slot)::before,*.sc-pds-radio:not(slot)::after){-webkit-box-sizing:border-box;box-sizing:border-box}.sc-pds-radio:where(*:not(slot)){margin:0}.sc-pds-radio:where(img,picture.sc-pds-radio,video.sc-pds-radio,canvas.sc-pds-radio,svg).sc-pds-radio{display:block;max-width:100%}.sc-pds-radio:where(input,button.sc-pds-radio,textarea.sc-pds-radio,select).sc-pds-radio{font:inherit}.sc-pds-radio:where(p,h1.sc-pds-radio,h2.sc-pds-radio,h3.sc-pds-radio,h4.sc-pds-radio,h5.sc-pds-radio,h6).sc-pds-radio{overflow-wrap:break-word}.sc-pds-radio:where(a:not([href]):not([class])){color:currentColor;text-decoration:none}.sc-pds-radio:where(a:not([href]):not([class]):hover){color:currentColor;text-decoration:none}.sc-pds-radio:where(ul[role=list],ol[role=list]).sc-pds-radio{list-style:none}.sc-pds-radio:where(table){border-collapse:collapse;border-spacing:0}.sc-pds-radio:where(*:not(slot)){font-family:var(--pine-font-family-body), -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Ubuntu\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"}.sc-pds-radio:where(h1,h2.sc-pds-radio,h3.sc-pds-radio,h4.sc-pds-radio,h5.sc-pds-radio,h6).sc-pds-radio{font-family:var(--pine-font-family-heading);color:var(--pine-color-grey-950)}.sc-pds-radio:where(h1){font:var(--pine-typography-heading-h1);letter-spacing:var(--pine-letter-spacing-heading-h1)}.sc-pds-radio:where(h2){font:var(--pine-typography-heading-h2);letter-spacing:var(--pine-letter-spacing-heading-h2)}.sc-pds-radio:where(h3){font:var(--pine-typography-heading-h3);letter-spacing:var(--pine-letter-spacing-heading-h3)}.sc-pds-radio:where(h4){font:var(--pine-typography-heading-h4);letter-spacing:var(--pine-letter-spacing-heading-h4)}.sc-pds-radio:where(h5){font:var(--pine-typography-heading-h5);letter-spacing:var(--pine-letter-spacing-heading-h5)}.sc-pds-radio:where(h6){font:var(--pine-typography-heading-h6);letter-spacing:var(--pine-letter-spacing-heading-h6)}.sc-pds-radio:where(p){font:var(--pine-typography-body-md-default);letter-spacing:var(--pine-letter-spacing-body-md)}.sc-pds-radio:where(code,kbd.sc-pds-radio,pre.sc-pds-radio,samp).sc-pds-radio{font-family:monospace}.sc-pds-radio:where([role=button]){cursor:pointer}.sc-pds-radio:where(:focus){outline:0}.sc-pds-radio:where(:focus-visible){outline:var(--pine-border-width-thick) solid var(--pine-color-purple-500)}.sc-pds-radio:where([hidden]){display:none !important}";
const PdsRadioStyle0 = baseCss;

const pdsRadioCss = ".sc-pds-radio-h{--border-interactive-default:var(--pine-border-width-thin) solid var( --pine-color-grey-400);--border-radius:50%;--box-shadow-focus:0 0 0 1px #ffffff, 0 0 0 3px var(--color-focus);--box-shadow-focus-error:0 0 0 1px #ffffff, 0 0 0 3px var(--color-invalid-focus);--color:var(--pine-color-grey-700);--color-background:var(--pine-color-white);--color-background-hover:var(--pine-color-grey-100);--color-background-disabled:var(--pine-color-grey-200);--color-border-hover:var(--pine-color-grey-500);--color-border-disabled:var(--pine-color-grey-300);--color-checked:var(--pine-color-grey-950);--color-disabled:var(---pine-color-grey-500);--color-focus:var(--pine-color-purple-300);--color-invalid:var(--pine-color-red-300);--color-invalid-focus:var(--pine-color-red-200);--font-size:var(--pine-font-size-085);--sizing-check-size:6px;--sizing-input-size:16px;--sizing-margin-block-start:6px;-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap}.is-invalid.sc-pds-radio-h input.sc-pds-radio{border-color:var(--color-invalid)}.is-invalid.sc-pds-radio-h input.sc-pds-radio:checked{background:var(--color-invalid)}.is-invalid.sc-pds-radio-h input.sc-pds-radio:focus-visible{-webkit-box-shadow:var(--box-shadow-focus-error);box-shadow:var(--box-shadow-focus-error);outline:none}.is-invalid.sc-pds-radio-h label.sc-pds-radio,.is-invalid.sc-pds-radio-h .pds-radio__message--error.sc-pds-radio{color:var(--color-invalid)}input.sc-pds-radio{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:var(--border-interactive-default);border-radius:var(--border-radius);height:var(--sizing-input-size);margin:0;position:relative;width:var(--sizing-input-size)}input.sc-pds-radio:hover{background:var(--color-background-hover);border-color:var(--color-border-hover)}input.sc-pds-radio:checked{background:var(--color-checked);border-color:var(--color-checked)}input.sc-pds-radio:checked::after{background:var(--color-background);border-radius:50%;content:\"\";display:block;height:var(--sizing-check-size);left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);width:var(--sizing-check-size)}input.sc-pds-radio:disabled{background:var(--color-background-disabled);border-color:var(--color-border-disabled);cursor:not-allowed}input.sc-pds-radio:disabled:checked{background:var(--color-disabled);border-color:var(--color-border-disabled)}input.sc-pds-radio:disabled:checked::after{border-color:var(--color-border-disabled)}input.sc-pds-radio:disabled+label.sc-pds-radio{color:var(--color-border-hover);cursor:not-allowed}input.sc-pds-radio:disabled~.pds-radio__message.sc-pds-radio{color:var(--color-disabled)}input.sc-pds-radio:focus-visible{-webkit-box-shadow:var(--box-shadow-focus);box-shadow:var(--box-shadow-focus);outline:none}label.sc-pds-radio{-webkit-margin-start:10px;margin-inline-start:10px}.pds-radio__message.sc-pds-radio{color:var(--color);font-size:var(--font-size);-webkit-margin-before:var(--sizing-margin-block-start);margin-block-start:var(--sizing-margin-block-start);-webkit-margin-start:26px;margin-inline-start:26px;width:100%}";
const PdsRadioStyle1 = pdsRadioCss;

const PdsRadio$1 = /*@__PURE__*/ proxyCustomElement(class PdsRadio extends HTMLElement {
    constructor() {
        super();
        this.__registerHost();
        this.pdsRadioChange = createEvent(this, "pdsRadioChange", 7);
        this.handleRadioChange = (e) => {
            if (this.disabled) {
                return;
            }
            const target = e.target;
            const isChecked = target.checked;
            this.pdsRadioChange.emit(isChecked);
        };
        this.checked = false;
        this.disabled = false;
        this.errorMessage = undefined;
        this.invalid = false;
        this.componentId = undefined;
        this.label = undefined;
        this.helperMessage = undefined;
        this.name = undefined;
        this.required = false;
        this.value = undefined;
    }
    classNames() {
        const classNames = [];
        if (this.invalid) {
            classNames.push('is-invalid');
        }
        if (this.disabled) {
            classNames.push('is-disabled');
        }
        return classNames.join('  ');
    }
    render() {
        return (h(Host, { key: '9cb0d602497eac8edaf17715182e27ed4b0bc0ab', class: this.classNames() }, h("input", { key: '20f794bb58ab815d6e73b1d9bb01c0b5a01186c7', "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, type: "radio", id: this.componentId, name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onChange: this.handleRadioChange }), h(PdsLabel, { key: 'f968ebc75adae7365c7334e916b4370006937132', htmlFor: this.componentId, text: this.label }), this.helperMessage &&
            h("div", { key: '96fdd82a8e89a40b73687ce609caa4671007e882', class: 'pds-radio__message', id: messageId(this.componentId, 'helper') }, this.helperMessage), this.errorMessage &&
            h("div", { key: '7133583828149eb3c1c958f0fb6821a773c12951', class: `pds-radio__message pds-radio__message--error`, id: messageId(this.componentId, 'error'), "aria-live": "assertive" }, this.errorMessage)));
    }
    static get style() { return PdsRadioStyle0 + PdsRadioStyle1; }
}, [2, "pds-radio", {
        "checked": [4],
        "disabled": [4],
        "errorMessage": [1, "error-message"],
        "invalid": [4],
        "componentId": [1, "component-id"],
        "label": [1],
        "helperMessage": [1, "helper-message"],
        "name": [1],
        "required": [4],
        "value": [1]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["pds-radio"];
    components.forEach(tagName => { switch (tagName) {
        case "pds-radio":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, PdsRadio$1);
            }
            break;
    } });
}

const PdsRadio = PdsRadio$1;
const defineCustomElement = defineCustomElement$1;

export { PdsRadio, defineCustomElement };

//# sourceMappingURL=pds-radio.js.map