'use strict';

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

const index = require('./index-c18b5a7b.js');
const pdsLabel = require('./pds-label-a3b0188d.js');

const pdsTextareaCss = ":host{--background-color:#fff;--background-color-disabled:var(--pine-color-neutral-grey-200);--color:var(--pine-color-neutral-charcoal-400);--color-error:var(--pine-color-red-300);--color-placeholder:var(--pine-color-neutral-charcoal-200);--color-disabled:var(--pine-color-neutral-charcoal-200);--border-color-default:var(--pine-color-neutral-grey-400);--border-color-hover:var(--pine-color-neutral-grey-500);--border-color-focus-visible:var(--pine-color-neutral-grey-300);--border-color-error:var(--pine-color-red-300);--focus-visible-outline-color:var(--pine-color-primary-200);--focus-visible-outline-color-error:var(--pine-color-red-200);--label-font-size:var(--pine-font-size-body);--label-font-weight:var(--pine-font-weight-medium);--label-line-height:var(--pine-line-height-md);--label-margin-block-end:var(--pine-spacing-xs);--field-font-size:var(--pine-font-size-body);--field-font-weight:var(--pine-font-weight-regular);--field-line-height:var(--pine-line-height-md);--field-padding-block:var(--pine-spacing-xs);--field-padding-inline:var(--pine-spacing-sm);--helper-message-font-size:var(--pine-font-size-body-xs);--helper-message-font-weight:var(--pine-font-weight-regular);--helper-message-line-height:var(--pine-line-height-sm);--helper-message-margin-block-start:var(--pine-spacing-xs);display:inline}.pds-textarea{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}label{display:block;font-size:var(--label-font-size);font-weight:var(--label-font-weight);line-height:var(--label-line-height);-webkit-margin-after:var(--label-margin-block-end);margin-block-end:var(--label-margin-block-end)}.pds-textarea__field{background-color:var(--background-color);border:var(--pine-border-interactive);border-radius:var(--pine-border-radius-md);font-family:inherit;font-size:var(--field-font-size);font-weight:var(--field-font-weight);line-height:var(--field-line-height);padding:var(--field-padding-block) var(--field-padding-inline)}.pds-textarea__field:hover:not(:disabled,.is-invalid){border-color:var(--border-color-hover)}.pds-textarea__field:disabled{background-color:var(--background-color-disabled);color:var(--color-disabled);cursor:not-allowed}.pds-textarea__field:focus-visible{border-color:var(--border-color-focus-visible);outline:4px solid var(--focus-visible-outline-color)}.pds-textarea__field::-webkit-input-placeholder{color:var(--color-placeholder)}.pds-textarea__field::-moz-placeholder{color:var(--color-placeholder)}.pds-textarea__field:-ms-input-placeholder{color:var(--color-placeholder)}.pds-textarea__field::-ms-input-placeholder{color:var(--color-placeholder)}.pds-textarea__field::placeholder{color:var(--color-placeholder)}.pds-textarea__field.is-invalid{border-color:var(--color-error);outline-color:var(--focus-visible-outline-color-error)}.pds-textarea__error-message,.pds-textarea__helper-message{font-size:var(--helper-message-font-size);font-weight:var(--helper-message-font-weight);line-height:var(--helper-message-line-height);-webkit-margin-after:0;margin-block-end:0;-webkit-margin-before:var(--helper-message-margin-block-start);margin-block-start:var(--helper-message-margin-block-start)}.pds-textarea__error-message{color:var(--color-error)}";
const PdsTextareaStyle0 = 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.innerHTML;
            }
            this.pdsTextareaChange.emit({ value: this.value, event: ev });
        };
        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: '1f722be202c2daa9c8ac782716f7be2ef2da2edc', "aria-disabled": this.disabled ? 'true' : null }, index.h("div", { key: '5eb779ac1fbbb24420b1362ec103ef6112319aaf', class: "pds-textarea" }, this.label &&
            index.h(pdsLabel.PdsLabel, { htmlFor: this.componentId, text: this.label }), index.h("textarea", { key: '8e2a2de3ea1aa172022b7dea79a34ddcfa8a501b', "aria-describedby": pdsLabel.assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, 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", { class: "pds-textarea__helper-message", id: pdsLabel.messageId(this.componentId, 'helper') }, this.helperMessage), this.invalid &&
            index.h("p", { "aria-live": "assertive", class: "pds-textarea__error-message", id: pdsLabel.messageId(this.componentId, 'error') }, this.errorMessage))));
    }
    get el() { return index.getElement(this); }
};
PdsTextarea.style = PdsTextareaStyle0;

exports.pds_textarea = PdsTextarea;

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