'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-b7d9268e.js');
const pdsLabel = require('./pds-label-05f073ea.js');
const index$1 = require('./index-3ad62856.js');

const baseCss = ":where(*:not(slot),*:not(slot)::before,*:not(slot)::after){-webkit-box-sizing:border-box;box-sizing:border-box}:where(*:not(slot)){margin:0}:where(img,picture,video,canvas,svg){display:block;max-width:100%}:where(input,button,textarea,select){font:inherit}:where(p,h1,h2,h3,h4,h5,h6){overflow-wrap:break-word}:where(a:not([href]):not([class])){color:currentColor;text-decoration:none}:where(a:not([href]):not([class]):hover){color:currentColor;text-decoration:none}:where(ul[role=list],ol[role=list]){list-style:none}:where(table){border-collapse:collapse;border-spacing:0}:where(*:not(slot)){font:var(--pine-typography-body-md-default);letter-spacing:var(--pine-letter-spacing-body-md)}:where(h1,h2,h3,h4,h5,h6){font-family:var(--pine-font-family-heading);color:var(--pine-color-grey-950)}:where(h1){font:var(--pine-typography-heading-h1);letter-spacing:var(--pine-letter-spacing-heading-h1)}:where(h2){font:var(--pine-typography-heading-h2);letter-spacing:var(--pine-letter-spacing-heading-h2)}:where(h3){font:var(--pine-typography-heading-h3);letter-spacing:var(--pine-letter-spacing-heading-h3)}:where(h4){font:var(--pine-typography-heading-h4);letter-spacing:var(--pine-letter-spacing-heading-h4)}:where(h5){font:var(--pine-typography-heading-h5);letter-spacing:var(--pine-letter-spacing-heading-h5)}:where(h6){font:var(--pine-typography-heading-h6);letter-spacing:var(--pine-letter-spacing-heading-h6)}:where(div,label,p,span){color:var(--pine-color-text-default)}:where(code,kbd,pre,samp){font-family:monospace}:where([role=button]){cursor:pointer}:where(:focus){outline:0}:where(:focus-visible){outline:var(--pine-border-width-thick) solid var(--pine-color-purple-500)}:where([hidden]){display:none !important}";
const PdsTextareaStyle0 = baseCss;

const pdsTextareaCss = ":host{--border-interactive-default:var(--pine-border-interactive-default);--border-interactive-hover:var(--pine-border-interactive-hover);--box-shadow-focus:0 0 0 1px #ffffff, 0 0 0 3px var(--color-focus-visible-outline);--box-shadow-focus-error:0 0 0 1px #ffffff, 0 0 0 3px var(--color-focus-visible-outline-error);--color-background-default:var(--pine-color-white);--color-background-disabled:var(--pine-color-grey-100);--color-background-hover:var(--pine-color-grey-050);--color-background-error-default:var(--pine-color-red-050);--color-border-error-default:var(--pine-color-red-600);--color-border-focus-visible:var(--pine-color-grey-400);--color-border-hover:var(--pine-color-grey-400);--color-focus-visible-outline:var(--pine-color-purple-300);--color-focus-visible-outline-error:var(--pine-color-red-300);--color-text-disabled-default:var(--pine-color-grey-400);--color-text-message-error-default:var(--pine-color-red-600);--color-text-placeholder-default:var(--pine-color-grey-600);--color-text-placeholder-disabled:var(--pine-color-grey-400);--font-weight-label-default:var(--pine-font-weight-body-medium);--spacing-margin-block-end-label:var(--pine-spacing-100);--spacing-margin-block-start-helper-message:var(--pine-spacing-100);--spacing-padding-block-field:var(--pine-spacing-100);--spacing-padding-inline-field:var(--pine-spacing-200);--spacing-icon-error-message:var(--pine-spacing-050);--typography-message-default:var(--pine-typography-body-sm-default);display:inline}.pds-textarea{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}label{display:block;font-weight:var(--font-weight-label-default);-webkit-margin-after:var(--spacing-margin-block-end-label);margin-block-end:var(--spacing-margin-block-end-label)}.pds-textarea__field{background-color:var(--color-background-default);border:var(--border-interactive-default);border-radius:var(--pine-border-radius-100);padding:var(--spacing-padding-block-field) var(--spacing-padding-inline-field)}.pds-textarea__field:hover:not(:disabled,.is-invalid){border:var(--border-interactive-hover)}.pds-textarea__field:disabled{background-color:var(--color-background-disabled);color:var(--color-text-disabled-default);cursor:not-allowed}.pds-textarea__field:focus-visible{-webkit-box-shadow:var(--box-shadow-focus);box-shadow:var(--box-shadow-focus);outline:none}.pds-textarea__field::-webkit-input-placeholder{color:var(--color-text-placeholder-default)}.pds-textarea__field::-moz-placeholder{color:var(--color-text-placeholder-default)}.pds-textarea__field:-ms-input-placeholder{color:var(--color-text-placeholder-default)}.pds-textarea__field::-ms-input-placeholder{color:var(--color-text-placeholder-default)}.pds-textarea__field::placeholder{color:var(--color-text-placeholder-default)}.pds-textarea__field.is-invalid{border-color:var(--color-border-error-default)}.pds-textarea__field.is-invalid:focus-visible{-webkit-box-shadow:var(--box-shadow-focus-error);box-shadow:var(--box-shadow-focus-error)}.pds-textarea__error-message,.pds-textarea__helper-message{font:var(--typography-message-default);-webkit-margin-before:var(--spacing-margin-block-start-helper-message);margin-block-start:var(--spacing-margin-block-start-helper-message)}.pds-textarea__error-message{-ms-flex-align:center;align-items:center;color:var(--color-text-message-error-default);display:-ms-flexbox;display:flex;gap:var(--spacing-icon-error-message)}";
const PdsTextareaStyle1 = pdsTextareaCss;

const PdsTextarea = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.pdsTextareaChange = index.createEvent(this, "pdsTextareaChange", 7);
        this.onTextareaChange = (ev) => {
            const textarea = ev.target;
            pdsLabel.isRequired(textarea, this);
            if (textarea) {
                this.value = textarea.value;
            }
            this.pdsTextareaChange.emit({ value: this.value, event: ev });
        };
        this.autocomplete = undefined;
        this.componentId = undefined;
        this.disabled = false;
        this.errorMessage = undefined;
        this.helperMessage = undefined;
        this.invalid = false;
        this.label = undefined;
        this.name = this.componentId;
        this.placeholder = undefined;
        this.readonly = false;
        this.required = false;
        this.rows = undefined;
        this.value = undefined;
    }
    textareaClassNames() {
        const classNames = ['pds-textarea__field'];
        if (this.invalid && this.invalid === true) {
            classNames.push('is-invalid');
        }
        return classNames.join('  ');
    }
    render() {
        return (index.h(index.Host, { key: '461039704016b1b3858af80440863f1fc4930ceb', "aria-disabled": this.disabled ? 'true' : null }, index.h("div", { key: 'de68ba7ca3b6714e1da8594e76f60bab2a3de1fb', class: "pds-textarea" }, this.label &&
            index.h(pdsLabel.PdsLabel, { key: '102802b8244a929492731700fdde06a053f3e2d5', htmlFor: this.componentId, text: this.label }), index.h("textarea", { key: '55a3fde040749bd03a5e681dafad7db0717f4a7f', "aria-describedby": pdsLabel.assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, autocomplete: this.autocomplete, class: this.textareaClassNames(), disabled: this.disabled, id: this.componentId, name: this.name, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, rows: this.rows, onChange: this.onTextareaChange }, this.value), this.helperMessage &&
            index.h("p", { key: '552e0c1240cdc51c215f5ddfc51f250156d8a4b2', class: "pds-textarea__helper-message", id: pdsLabel.messageId(this.componentId, 'helper') }, this.helperMessage), this.invalid &&
            index.h("p", { key: 'a7e6f4a0d926203f5ac56a8f99d03fd9b5f3647b', "aria-live": "assertive", class: "pds-textarea__error-message", id: pdsLabel.messageId(this.componentId, 'error') }, index.h("pds-icon", { key: '53a40e204e076147b27c921cdbe54336ca50d9e3', icon: index$1.danger, size: "small" }), this.errorMessage))));
    }
    get el() { return index.getElement(this); }
};
PdsTextarea.style = PdsTextareaStyle0 + PdsTextareaStyle1;

exports.pds_textarea = PdsTextarea;

//# sourceMappingURL=pds-textarea.cjs.entry.js.map