No notes defined.
<div class="sds-textarea -textareaComposer" data-js-textarea="">
<div class="sds-textarea__inner">
<textarea class="form-control" id="" rows="1" placeholder="Votre message" aria-describedby=" textarea-hint-message"></textarea>
</div>
<div class="sds-textarea__hint">
<p class="sds-hint sds-textHelperSmall" id="textarea-hint-message">
{Hint}
</p>
</div>
</div>
<div class="{{ namespace }}textarea{% for mod in parentModifiers %} {{ mod }}{% endfor %}{% for mod in parentClasses %} {{ mod }}{% endfor %}"{% for attrKey, attr in attrs %} {{ attrKey }}="{{ attr }}"{% endfor %}>
<div class="{{ namespace }}textarea__inner">
<textarea class="form-control{% for mod in modifiers %} {{ mod }}{% endfor %}{% for mod in classes %} {{ mod }}{% endfor %}" id="{{ labelFor }}" rows="{{ rows }}" placeholder="{{ placeholder }}"{% if error %} aria-invalid="true"{% endif %}{% if error or hint %} aria-describedby="{% if error %}{{ errorID }}{% endif %} {% if hint %} {{ hintID }}{% endif %}"{% endif %}></textarea>
{% if deleteValue %}
<div class="{{ namespace }}textarea__delete">
{% render "@icon-btn-secondary--small",{
action: "Supprimer valeur",
icon: "icon-cross"
},true %}
</div>
{% endif %}
</div>
{% if error %}
<div class="invalid-feedback">
{% render "@hint--error",{
text: feedback
},true %}
</div>
{% endif %}
{% if hint %}
<div class="{{ namespace }}textarea__hint">
{% render "@hint",{
attrs: {
id: hintID
}
},true %}
</div>
{% endif %}
{% if message %}
{% render '@message',{classes: [namespace + "textarea__message"]},true %}
{% endif %}
</div>
export default class TextAreaComposer {
constructor() {
this.increaseHeight();
}
increaseHeight() {
console.log("textarea test 1")
let textareas = document.querySelectorAll("[data-js-textarea] textarea");
console.log("textarea test 2")
textareas.forEach(element => {
if (element) {
element.addEventListener("input", (e) => {
console.log("textarea test 3")
let _this = e.target;
_this.style.height = "";
_this.style.height = _this.scrollHeight + "px"
})
}
});
}
}
/* variables specific to current element */
$element-specific-variables: "";
.#{$namespace}textarea {
/* Save root element context for easy access if nesting is needed */
$self: &;
/* properties of current element + media queries */
/* Pseudo Elements */
&::before {
}
&::after {
}
/*
Include elements that are linked to the current element but have to reside at the root level of the stylesheet
(e.g: keyframes)
*/
@at-root {
}
/* children - write selector in full in comments in order to facilitate search */
&__inner {
position: relative;
z-index: z("zero");
}
// textarea__message
&__message {
// follows same logic as parent
margin-top: map-deep-get($token-spacer-stack-max-map, "sm");
}
&__hint {
@include custom-prop-fallback("margin-left","comp-input-label-inset-h")
}
&__delete {
position: absolute;
z-index: z("low");
bottom: 2px;
right: 0;
padding-right: 8px;
padding-bottom: 8px;
@include custom-prop-fallback("height","comp-input-height");
display: none;
align-items: flex-end;
}
/* modifiers */
// textarea -textareaComposer
&.-textareaComposer {
// follows same logic as base element
.form-control {
border-radius: 24px;
border: $border-width*2 solid var(--comp-input-border-color);
padding-inline: 16px;
max-height: 144px;
resize: none;
background-color: #F0F3F6;
&:focus {
@include custom-prop-fallback("border-color", "comp-input-active-border-color","true","true");
}
&:focus,
&:not(:placeholder-shown) {
@include custom-prop-fallback("background-color","comp-input-background-color");
}
}
}
&.-textareaShowAction {
#{$self}__delete {
display: flex;
}
.form-control {
padding-right: 48px;
}
}
/* random parent element */
/*
*
* Syntax : .randomParentElt & {}
*
*/
/* Pseudo Classes */
&:hover {
@media (hover: hover) {
}
}
&:focus {
}
&:active {
}
&:focus,
&:active {
}
}