diff --git a/src/ec/packages/ec-component-text-area/__snapshots__/text-area.test.js.snap b/src/ec/packages/ec-component-text-area/__snapshots__/text-area.test.js.snap
index b8a4e9f26..f33377379 100644
--- a/src/ec/packages/ec-component-text-area/__snapshots__/text-area.test.js.snap
+++ b/src/ec/packages/ec-component-text-area/__snapshots__/text-area.test.js.snap
@@ -10,18 +10,17 @@ exports[`EC - Text area Default renders correctly 1`] = `
>
Label
-
Help message
+
`;
@@ -35,20 +34,19 @@ exports[`EC - Text area Default renders correctly with a default value 1`] = `
>
Label
+
+ Help message
+
-
- Help message
-
`;
@@ -62,20 +60,19 @@ exports[`EC - Text area Default renders correctly with extra attributes 1`] = `
>
Label
+
+ Help message
+
-
- Help message
-
`;
@@ -89,18 +86,41 @@ exports[`EC - Text area Default renders correctly with extra class names 1`] = `
>
Label
+
+ Help message
+
+
+`;
+
+exports[`EC - Text area Default renders correctly with extra group class names 1`] = `
+
+
Help message
+
`;
@@ -109,24 +129,23 @@ exports[`EC - Text area Disabled renders correctly 1`] = `
class="ecl-form-group ecl-form-group--text-area"
>
+
+ Help message
+
-
- Help message
-
`;
@@ -135,26 +154,25 @@ exports[`EC - Text area Disabled renders correctly with extra attributes 1`] = `
class="ecl-form-group ecl-form-group--text-area"
>
+
+ Help message
+
-
- Help message
-
`;
@@ -163,24 +181,48 @@ exports[`EC - Text area Disabled renders correctly with extra class names 1`] =
class="ecl-form-group ecl-form-group--text-area"
>
+
+ Help message
+
+
+`;
+
+exports[`EC - Text area Disabled renders correctly with extra group class names 1`] = `
+
+
Help message
+
`;
@@ -194,23 +236,22 @@ exports[`EC - Text area With error renders correctly 1`] = `
>
Label
-
- Error message
+ Help message
- Help message
+ Error message
+
`;
@@ -224,25 +265,24 @@ exports[`EC - Text area With error renders correctly with extra attributes 1`] =
>
Label
+
+ Help message
+
+
+ Error message
+
-
- Error message
-
-
- Help message
-
`;
@@ -256,22 +296,50 @@ exports[`EC - Text area With error renders correctly with extra class names 1`]
>
Label
+
+ Help message
+
+
+ Error message
+
-
+`;
+
+exports[`EC - Text area With error renders correctly with extra group class names 1`] = `
+
+
+ Label
+
Help message
+
+ Error message
+
+
`;
diff --git a/src/ec/packages/ec-component-text-area/docs/text-area.md b/src/ec/packages/ec-component-text-area/docs/text-area.md
index 4698a880d..73cc04637 100644
--- a/src/ec/packages/ec-component-text-area/docs/text-area.md
+++ b/src/ec/packages/ec-component-text-area/docs/text-area.md
@@ -15,9 +15,9 @@ npm install --save @ecl-twig/ec-component-text-area
- "invalid" (boolean) (default: false)
- "name" (string) (default: '')
- "default_value" (string) (default: '')
-- "hide_label" (boolean) (default: '')
-- "placeholder" (string) (default: '')
- "rows" (int) (default: 4)
+- "width" (string) (default: '') Input width size (s, m or l)
+- "extra_group_classes" (optional) (string) (default: '') Extra classes (space separated) for the text-area group
- "extra_classes" (optional) (string) (default: '') Extra classes (space separated) for the text area
- "extra_attributes" (optional) (array) (default: []) Extra attributes for text area
- "name" (string) Attribute name, eg. 'data-test'
@@ -27,6 +27,8 @@ npm install --save @ecl-twig/ec-component-text-area
- "helper_text"
- "invalid_text"
+- "required_text"
+- "optional_text"
- "label"
### Example:
@@ -42,6 +44,8 @@ npm install --save @ecl-twig/ec-component-text-area
name: 'comment',
default_value: 'Hello world!',
rows: 4,
+ width: 'm',
+ extra_group_classes: 'my-extra-group-class-1 my-extra-group-class-2',
extra_classes: 'my-extra-class-1 my-extra-class-2',
extra_attributes: [
{ name: 'data-test-1', value: 'data-test-value-1' },
diff --git a/src/ec/packages/ec-component-text-area/text-area.html.twig b/src/ec/packages/ec-component-text-area/text-area.html.twig
index af1b90528..02a1c2fa0 100644
--- a/src/ec/packages/ec-component-text-area/text-area.html.twig
+++ b/src/ec/packages/ec-component-text-area/text-area.html.twig
@@ -5,11 +5,12 @@
- "id" (string) (default: '')
- "disabled" (boolean) (default: false)
- "invalid" (boolean) (default: false)
+ - "required" (boolean) (default: false)
- "name" (string) (default: '')
- "default_value" (string) (default: '')
- - "hide_label" (boolean) (default: '')
- - "placeholder" (string) (default: '')
- "rows" (int) (default: 4)
+ - "width" (string) (default: '')
+ - "extra_group_classes" (optional) (string) (default: '') Extra classes (space separated) for the text-area group
- "extra_classes" (optional) (string) (default: '') Extra classes (space separated) for the text area
- "extra_attributes" (optional) (array) (default: []) Extra attributes for text area
- "name" (string) Attribute name, eg. 'data-test'
@@ -17,6 +18,8 @@
Blocks:
- "helper_text"
- "invalid_text"
+ - "required_text"
+ - "optional_text"
- "label"
#}
@@ -25,26 +28,31 @@
{% set _id = id|default('') %}
{% set _disabled = disabled|default(false) %}
{% set _invalid = invalid|default(false) %}
+{% set _required = required|default(false) %}
{% set _name = name|default('') %}
{% set _default_value = default_value|default('') %}
-{% set _hide_label = hide_label|default(false) %}
-{% set _placeholder = placeholder|default('') %}
{% set _rows = rows|default(4) %}
-
+{% set _width = width|default('m') %}
{% set _helper_text = helper_text|default('') %}
{% set _invalid_text = invalid_text|default('') %}
+{% set _required_text = required_text|default('') %}
+{% set _optional_text = optional_text|default('') %}
{% set _label = label|default('') %}
-
+{% set _css_group_class = 'ecl-form-group ecl-form-group--text-area' %}
{% set _css_class = ['ecl-text-area'] %}
{% if _invalid %}
{% set _css_class = _css_class|merge(['ecl-text-area--invalid']) %}
{% endif %}
+{% set _css_class = _css_class|merge(['ecl-text-area--' ~ _width]) %}
{% set _css_class = _css_class|join(' ') %}
-
{% set _extra_attributes = '' %}
{# Internal logic - Process properties #}
+{% if extra_group_classes is defined and extra_group_classes is not empty %}
+ {% set _css_group_class = _css_group_class ~ ' ' ~ extra_group_classes %}
+{% endif %}
+
{% if extra_classes is defined and extra_classes is not empty %}
{% set _css_class = _css_class ~ ' ' ~ extra_classes %}
{% endif %}
@@ -57,33 +65,41 @@
{# Print the result #}
-
+
{% if _label is not empty %}
{% endif %}
+ {% if _helper_text is not empty %}
+
{% block helper_text _helper_text %}
+ {% endif %}
+
+ {% if _invalid and _invalid_text is not empty %}
+
{% block invalid_text _invalid_text %}
+ {% endif %}
+
- {% if _invalid and _invalid_text is not empty %}
-
{% block invalid_text _invalid_text %}
- {% endif %}
-
- {% if _helper_text is not empty %}
-