diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7dd895f..5f2e0c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,9 @@ name: ci on: pull_request: - branches: [ main ] + branches: + - main + - '0.x' jobs: tests: diff --git a/templates/form/default.html.twig b/templates/form/default.html.twig index 3833bb3..d04649f 100644 --- a/templates/form/default.html.twig +++ b/templates/form/default.html.twig @@ -13,32 +13,33 @@ {%- elseif type == 'file' -%} {%- set attr_class = block('class_input_file') -%} {%- endif -%} - {%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%} + {%- set attr_class = attr_class ~ ' ' ~ attr.class|default('') -%} + {%- set attr = attr|merge({'class': attr_class|trim|tailwind_merge}) -%} {{- parent() -}} {%- endif -%} {%- endblock form_widget_simple -%} {%- block textarea_widget -%} - {%- set attr_class = attr_class|default(block('class_textarea')) -%} - {%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%} + {%- set attr_class = block('class_textarea') ~ ' ' ~ attr.class|default('') -%} + {%- set attr = attr|merge({'class': attr_class|trim|tailwind_merge}) -%} {{- parent() -}} {%- endblock textarea_widget -%} {%- block choice_widget_collapsed -%} - {%- set attr_class = attr_class|default(block('class_select')) -%} - {%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%} + {%- set attr_class = block('class_select') ~ ' ' ~ attr.class|default('') -%} + {%- set attr = attr|merge({'class': attr_class|trim|tailwind_merge}) -%} {{- parent() -}} {%- endblock choice_widget_collapsed -%} {%- block checkbox_widget -%} - {%- set attr_class = attr_class|default(block('class_input_checkbox')) -%} - {%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%} + {%- set attr_class = block('class_input_checkbox') ~ ' ' ~ attr.class|default('') -%} + {%- set attr = attr|merge({'class': attr_class|trim|tailwind_merge}) -%} {{- form_label(form, null, { widget: parent() }) -}} {%- endblock checkbox_widget -%} {%- block radio_widget -%} - {%- set attr_class = attr_class|default(block('class_input_radio')) -%} - {%- set attr = attr|merge({'class': (attr_class ~ ' ' ~ attr.class|default(''))|trim}) -%} + {%- set attr_class = block('class_input_radio') ~ ' ' ~ attr.class|default('') -%} + {%- set attr = attr|merge({'class': attr_class|trim|tailwind_merge}) -%} {{- form_label(form, null, { widget: parent() }) -}} {%- endblock radio_widget -%} @@ -52,9 +53,9 @@ {%- set append = not (money_pattern ends with '}}') -%} {%- if prepend or append -%}
{{- block('form_help_content') -}}
@@ -219,7 +238,7 @@ {# Rows #} {%- block form_row -%} - {%- set row_attr = row_attr|merge({'class': (row_attr.class|default('mb-3'))|trim}) -%} + {%- set row_attr = row_attr|merge({'class': (row_attr.class|default('mb-3'))|trim|tailwind_merge}) -%} {%- set widget_attr = {} -%} {%- if help is not empty -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} @@ -314,30 +333,34 @@ text-white bg-blue-700 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 {%- endblock class_submit %} -{% block class_time_separator -%} - inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-x-0 border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600 -{%- endblock class_time_separator %} +{% block class_input_group -%} + rounded-none first-of-type:rounded-s-lg first-of-type:border-e-0 last-of-type:rounded-e-lg last-of-type:border-s-0 +{%- endblock class_input_group %} {% block class_addon -%} - inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600 + inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border-y border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600 {%- endblock class_addon %} {% block class_widget_addon_prepend -%} - rounded-none rounded-l-lg + rounded-s-none {%- endblock class_widget_addon_prepend %} {% block class_widget_addon_append -%} - rounded-none rounded-r-lg + rounded-e-none {%- endblock class_widget_addon_append %} {% block class_addon_prepend -%} - border-r-0 rounded-l-md + rounded-s-lg border-s {%- endblock class_addon_prepend %} {% block class_addon_append -%} - border-l-0 rounded-r-md + rounded-e-lg border-e {%- endblock class_addon_append %} +{% block class_time_separator -%} + {{ block('class_addon') }} +{%- endblock class_time_separator %} + {% block class_help_text -%} mt-2 text-sm text-gray-500 dark:text-gray-400 {%- endblock class_help_text %} diff --git a/tests/FormLayout/BirthdayLayoutTest.php b/tests/FormLayout/BirthdayLayoutTest.php index 9e66f92..5908677 100644 --- a/tests/FormLayout/BirthdayLayoutTest.php +++ b/tests/FormLayout/BirthdayLayoutTest.php @@ -24,7 +24,7 @@ public function testBirthday(): void ./select [@name="birthday[month]"] [@id="birthday_month"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-l-lg"] + [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none first-of-type:rounded-s-lg first-of-type:border-e-0 last-of-type:rounded-e-lg last-of-type:border-s-0"] [ ./option [@value="2"] @@ -33,7 +33,7 @@ public function testBirthday(): void /following-sibling::select [@name="birthday[day]"] [@id="birthday_day"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none"] + [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none first-of-type:rounded-s-lg first-of-type:border-e-0 last-of-type:rounded-e-lg last-of-type:border-s-0"] [ ./option [@value="3"] @@ -42,7 +42,7 @@ public function testBirthday(): void /following-sibling::select [@name="birthday[year]"] [@id="birthday_year"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-r-lg"] + [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none first-of-type:rounded-s-lg first-of-type:border-e-0 last-of-type:rounded-e-lg last-of-type:border-s-0"] [ ./option [@value="2000"] diff --git a/tests/FormLayout/DateLayoutTest.php b/tests/FormLayout/DateLayoutTest.php index 6978014..4b22145 100644 --- a/tests/FormLayout/DateLayoutTest.php +++ b/tests/FormLayout/DateLayoutTest.php @@ -24,7 +24,7 @@ public function testDate(): void ./select [@name="date[month]"] [@id="date_month"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-l-lg"] + [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none first-of-type:rounded-s-lg first-of-type:border-e-0 last-of-type:rounded-e-lg last-of-type:border-s-0"] [ ./option [@value="2"] @@ -33,7 +33,7 @@ public function testDate(): void /following-sibling::select [@name="date[day]"] [@id="date_day"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none"] + [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none first-of-type:rounded-s-lg first-of-type:border-e-0 last-of-type:rounded-e-lg last-of-type:border-s-0"] [ ./option [@value="3"] @@ -42,7 +42,7 @@ public function testDate(): void /following-sibling::select [@name="date[year]"] [@id="date_year"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-r-lg"] + [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none first-of-type:rounded-s-lg first-of-type:border-e-0 last-of-type:rounded-e-lg last-of-type:border-s-0"] [ ./option [@value="'.date('Y').'"] diff --git a/tests/FormLayout/MoneyLayoutTest.php b/tests/FormLayout/MoneyLayoutTest.php index dee8b52..2eb2535 100644 --- a/tests/FormLayout/MoneyLayoutTest.php +++ b/tests/FormLayout/MoneyLayoutTest.php @@ -20,12 +20,12 @@ public function testMoney(): void [@class="flex"] [ ./span - [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600 border-r-0 rounded-l-md"] + [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border-y border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600 rounded-s-lg border-s"] /following-sibling::input [@type="text"] [@name="name"] [@id="name"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-r-lg"] + [@class="text-gray-900 bg-gray-50 rounded-lg text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-s-none"] [@value="1234.56"] ] ' diff --git a/tests/FormLayout/PercentLayoutTest.php b/tests/FormLayout/PercentLayoutTest.php index 87e90e2..5253d95 100644 --- a/tests/FormLayout/PercentLayoutTest.php +++ b/tests/FormLayout/PercentLayoutTest.php @@ -23,10 +23,10 @@ public function testPercent(): void [@type="text"] [@name="name"] [@id="name"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-l-lg"] + [@class="text-gray-900 bg-gray-50 rounded-lg text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-e-none"] [@value="50"] /following-sibling::span - [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600 border-l-0 rounded-r-md"] + [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border-y border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600 rounded-e-lg border-e"] [.="%"] ] ' diff --git a/tests/FormLayout/TimeLayoutTest.php b/tests/FormLayout/TimeLayoutTest.php index 3190283..c862f15 100644 --- a/tests/FormLayout/TimeLayoutTest.php +++ b/tests/FormLayout/TimeLayoutTest.php @@ -25,7 +25,7 @@ public function testTime(): void ./select [@name="name[hour]"] [@id="name_hour"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-l-lg"] + [@class="text-gray-900 bg-gray-50 rounded-lg text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-e-none"] [not(@size)] [ ./option @@ -34,11 +34,11 @@ public function testTime(): void ] [count(./option)>23] /following-sibling::span - [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-x-0 border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600"] + [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border-y border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600"] /following-sibling::select [@name="name[minute]"] [@id="name_minute"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-r-lg"] + [@class="text-gray-900 bg-gray-50 rounded-lg text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-s-none"] [not(@size)] [ ./option @@ -67,7 +67,7 @@ public function testTimeWithSeconds(): void ./select [@name="name[hour]"] [@id="name_hour"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-l-lg"] + [@class="text-gray-900 bg-gray-50 rounded-lg text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-e-none"] [not(@size)] [ ./option @@ -77,7 +77,7 @@ public function testTimeWithSeconds(): void ] [count(./option)>23] /following-sibling::span - [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-x-0 border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600"] + [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border-y border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600"] /following-sibling::select [@name="name[minute]"] [@id="name_minute"] @@ -90,11 +90,11 @@ public function testTimeWithSeconds(): void ] [count(./option)>59] /following-sibling::span - [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-x-0 border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600"] + [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border-y border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600"] /following-sibling::select [@name="name[second]"] [@id="name_second"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-r-lg"] + [@class="text-gray-900 bg-gray-50 rounded-lg text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-s-none"] [not(@size)] [ ./option @@ -122,15 +122,15 @@ public function testTimeText(): void ./input [@name="name[hour]"] [@id="name_hour"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-l-lg"] + [@class="text-gray-900 bg-gray-50 rounded-lg text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-e-none"] [@value="04"] [@required="required"] /following-sibling::span - [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-x-0 border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600"] + [@class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border-y border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600"] /following-sibling::input [@name="name[minute]"] [@id="name_minute"] - [@class="text-gray-900 bg-gray-50 text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-none rounded-r-lg"] + [@class="text-gray-900 bg-gray-50 rounded-lg text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 rounded-s-none"] [@value="05"] [@required="required"] ]