diff --git a/components/accordion/accordion.twig b/components/accordion/accordion.twig index 4e8b4a5dfa607486982b7f6ec50588429ff6c82c..3456454d4e35219ebd2c74b2edbd29eaeca2a642 100644 --- a/components/accordion/accordion.twig +++ b/components/accordion/accordion.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set attributes = attributes.addClass('accordion-' ~ variant|lower|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set attributes = attributes.addClass('accordion-' ~ variant) %} {% endif %} {% set accordion_id = accordion_id|default("accordion-" ~ random()) %} {% set keep_open = keep_open ? 'true' : 'false' %} diff --git a/components/alert/alert.twig b/components/alert/alert.twig index 857a3ae277c0deaeb4dfc3c56eeffbf38a4b890a..4855cc6e818b6db12fffccd220a91e8a9d8b99c3 100644 --- a/components/alert/alert.twig +++ b/components/alert/alert.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set attributes = attributes.addClass('alert-' ~ variant|lower|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set attributes = attributes.addClass('alert-' ~ variant) %} {% endif %} {% if dismissible %} diff --git a/components/button/button.twig b/components/button/button.twig index 15ec8e4439349129f6cacf355ea5eb42c351f540..55e7488e1abde5e2c98aed0fcb00539b6224aa26 100644 --- a/components/button/button.twig +++ b/components/button/button.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'btn-' ~ v})|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set variants = variant|split('__')|map(v => v|replace({(v): 'btn-' ~ v})|replace({'_': '-'})) %} {% set attributes = attributes.addClass(variants) %} {% set attributes = attributes.addClass('btn') %} {% endif %} diff --git a/components/button_group/button_group.twig b/components/button_group/button_group.twig index d88c731fe3250aed9df8c02e5dfc7aeef8d78be2..d01132074b7536b166c5bf41e7ba36f97a888e47 100644 --- a/components/button_group/button_group.twig +++ b/components/button_group/button_group.twig @@ -1,8 +1,8 @@ -{% if variant and variant|lower != 'default' %} - {% set attributes = attributes.addClass('btn-group-' ~ variant|lower|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set attributes = attributes.addClass('btn-group-' ~ variant) %} {% endif %} -{% if variant and variant|lower != 'vertical' %} +{% if variant and variant != 'vertical' %} {% set attributes = attributes.addClass('btn-group') %} {% endif %} diff --git a/components/card/card.twig b/components/card/card.twig index b3745b12dc116b9f8e6a97cd22be63fd8547bb38..ba8af5d9af4b670f7cde59abdbd987a0102c4b33 100644 --- a/components/card/card.twig +++ b/components/card/card.twig @@ -1,4 +1,4 @@ -{% if variant and variant|lower == 'horizontal' %} +{% if variant and variant == 'horizontal' %} {% set row_attributes = create_attribute(row_attributes|default({})) %} {% set image_col_attributes = create_attribute(image_col_attributes|default({})) %} {% set content_col_attributes = create_attribute(content_col_attributes|default({})) %} diff --git a/components/carousel/carousel.twig b/components/carousel/carousel.twig index cab173c699a67446f9b4d05dc6fc656627390938..c1dae6d29917dffd75008db51b7c12c878ef4996 100644 --- a/components/carousel/carousel.twig +++ b/components/carousel/carousel.twig @@ -1,8 +1,8 @@ -{% if variant and variant|lower != 'default' %} - {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'carousel-' ~ v})|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set variants = variant|split('__')|map(v => v|replace({(v): 'carousel-' ~ v})) %} {% set attributes = attributes.addClass(variants) %} {% endif %} -{% set attributes = 'dark' in variant|lower ? attributes.setAttribute('data-bs-theme', 'dark') : attributes %} +{% set attributes = 'dark' in variant ? attributes.setAttribute('data-bs-theme', 'dark') : attributes %} {% if not with_touch %} {% set attributes = attributes.setAttribute('data-bs-touch', 'false') %} diff --git a/components/close_button/close_button.twig b/components/close_button/close_button.twig index d1350276f0ff9062c77de1e1946b41f74ce497ae..65c4f59901499a7b475e50aad52835fc49d080d3 100644 --- a/components/close_button/close_button.twig +++ b/components/close_button/close_button.twig @@ -1,4 +1,4 @@ -{% if variant and variant|lower != 'default' %} +{% if variant and variant != 'default' %} {% set attributes = attributes.addClass('btn-close-' ~ variant) %} {% endif %} {% set attributes = attributes.addClass('btn-close') %} diff --git a/components/list/list.twig b/components/list/list.twig index 303d2a30c066988b9da749c183d14c168fca17c7..a3c62e159080dccbd9f05da5d60dd502692b176d 100644 --- a/components/list/list.twig +++ b/components/list/list.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set attributes = attributes.addClass('list-' ~ variant|lower|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set attributes = attributes.addClass('list-' ~ variant) %} {% endif %} {% set list_type = list_type|default('ul') %} diff --git a/components/list_group/list_group.twig b/components/list_group/list_group.twig index feaa53e93945913cbc2c60667b375ade0664171c..d37459cb7e992a6aa1bf1dab5ddaccc02474a5d8 100644 --- a/components/list_group/list_group.twig +++ b/components/list_group/list_group.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'list-group-' ~ v})|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set variants = variant|split('__')|map(v => v|replace({(v): 'list-group-' ~ v})|replace({'_': '-'})) %} {% set attributes = attributes.addClass(variants) %} {% endif %} diff --git a/components/list_group_item/list_group_item.twig b/components/list_group_item/list_group_item.twig index 082d026b3cef2cf940a5f139d5d8ed2aafde3b57..fa5c2257317353564ad975afb202ecc2f51d696f 100644 --- a/components/list_group_item/list_group_item.twig +++ b/components/list_group_item/list_group_item.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set attributes = attributes.addClass('list-group-item-' ~ variant|lower|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set attributes = attributes.addClass('list-group-item-' ~ variant) %} {% endif %} {% set attributes = attributes.addClass('list-group-item') %} diff --git a/components/modal/modal.twig b/components/modal/modal.twig index 1f44db42053bbb82ab37a5c1ff8ddff6d0e0b609..dd68d280c734224cfbd07dd84dd44ad2ad002d59 100644 --- a/components/modal/modal.twig +++ b/components/modal/modal.twig @@ -1,7 +1,6 @@ {% set dialog_attributes = create_attribute({'class': 'modal-dialog'}) %} -{% if variant and variant|lower != 'default' %} - {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'modal-' ~ v})|replace({'_': '-'})) %} - {% set dialog_attributes = dialog_attributes.addClass(variants) %} +{% if variant and variant != 'default' %} + {% set dialog_attributes = dialog_attributes.addClass('modal-' ~ variant) %} {% endif %} {% set modal_id = modal_id|default("modal-" ~ random()) %} diff --git a/components/nav/nav.twig b/components/nav/nav.twig index aa9500d1bc45f16d9aca9481c60f470b5a2d1ae6..5333f0ca6dfc4bfcbc29405b337e9f2d85811726 100644 --- a/components/nav/nav.twig +++ b/components/nav/nav.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'nav-' ~ v})|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set variants = variant|split('__')|map(v => v|replace({(v): 'nav-' ~ v})) %} {% set attributes = attributes.addClass(variants) %} {% set attributes = card_header and 'tabs' in variant ? attributes.addClass('card-header-tabs') : attributes %} {% set attributes = card_header and 'pills' in variant ? attributes.addClass('card-header-pills') : attributes %} diff --git a/components/navbar/navbar.twig b/components/navbar/navbar.twig index 81012fcf5e33ec4c8c6209c6c3c768e742f0fc39..d16f711e1e67f87de5dc16adf8f8c7e8419b46ef 100644 --- a/components/navbar/navbar.twig +++ b/components/navbar/navbar.twig @@ -1,10 +1,10 @@ -{% if variant and variant|lower != 'default' %} - {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'navbar-' ~ v})|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set variants = variant|split('__')|map(v => v|replace({(v): 'navbar-' ~ v})|replace({'_': '-'})) %} {% set attributes = attributes.addClass(variants) %} {% endif %} {% set attributes = attributes.addClass('navbar') %} -{% set attributes = 'dark' in variant|lower ? attributes.setAttribute('data-bs-theme', 'dark') : attributes %} +{% set attributes = 'dark' in variant ? attributes.setAttribute('data-bs-theme', 'dark') : attributes %} {% set navbar_id = navbar_id|default("navbar-" ~ random()) %} {% set placement = placement|default('default') %} diff --git a/components/navbar_nav/navbar_nav.twig b/components/navbar_nav/navbar_nav.twig index cd73e2dc15efa020fbb3a58322470e7bd909f569..64b9ce00c20cd0219359937be73dc0389956b1cf 100644 --- a/components/navbar_nav/navbar_nav.twig +++ b/components/navbar_nav/navbar_nav.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set attributes = attributes.addClass('navbar-nav-' ~ variant|lower|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set attributes = attributes.addClass('navbar-nav-' ~ variant) %} {% endif %} {% set attributes = attributes.addClass('navbar-nav') %} diff --git a/components/offcanvas/offcanvas.twig b/components/offcanvas/offcanvas.twig index 654d8ebca0100511ba382378da72e9796d6259d7..dcacac29ff4c34a87d679e32e3df1a98895c8b52 100644 --- a/components/offcanvas/offcanvas.twig +++ b/components/offcanvas/offcanvas.twig @@ -1,4 +1,4 @@ -{% set attributes = attributes.addClass('offcanvas-' ~ variant|default('start')|lower|replace({'_': '-'})) %} +{% set attributes = attributes.addClass('offcanvas-' ~ variant|default('start')) %} {% set offcanvas_id = offcanvas_id|default("offcanvas-" ~ random()) %} {% set heading_level = heading_level|default(5) %} diff --git a/components/pagination/pagination.twig b/components/pagination/pagination.twig index 76ed316279063f151d0a58df12391d4caddd740a..896acdee481c65fa5e447976b44957798c2cd07d 100644 --- a/components/pagination/pagination.twig +++ b/components/pagination/pagination.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set attributes = attributes.addClass('pagination-' ~ variant|lower|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set attributes = attributes.addClass('pagination-' ~ variant) %} {% endif %} {% if items %} diff --git a/components/progress/progress.twig b/components/progress/progress.twig index 80c59bf5cdbfc232c8b146a5fb2e4a8580637c20..1f3495fa1f7c74d5eb9e41b70c715e6868493edc 100644 --- a/components/progress/progress.twig +++ b/components/progress/progress.twig @@ -1,5 +1,5 @@ -{% if variant and variant|lower != 'default' %} - {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'progress-bar-' ~ v})|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set variants = variant|split('__')|map(v => v|replace({(v): 'progress-bar-' ~ v})) %} {% set attributes = attributes.addClass(variants) %} {% endif %} diff --git a/components/spinner/spinner.twig b/components/spinner/spinner.twig index 84da637c5eb3fa9c674cfba20cc448a17f65ed8d..faadc4aa2b65ea1381256049f854a9a86aa701d1 100644 --- a/components/spinner/spinner.twig +++ b/components/spinner/spinner.twig @@ -1,5 +1,5 @@ {% if variant %} - {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'spinner-' ~ v})|replace({'_': '-'})) %} + {% set variants = variant|split('__')|map(v => v|replace({(v): 'spinner-' ~ v})|replace({'_': '-'})) %} {% set attributes = attributes.addClass(variants) %} {% endif %} diff --git a/components/table/table.twig b/components/table/table.twig index 234349ad48576a456c1fd22266872318dfd50b03..0e16623746d0930aae3823ad5ff18ca4dcb781cd 100644 --- a/components/table/table.twig +++ b/components/table/table.twig @@ -1,22 +1,22 @@ {% set attributes = attributes.addClass('table') %} -{% if variant and variant|lower != 'default' %} - {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'table-' ~ v})|replace({'_': '-'})) %} +{% if variant and variant != 'default' %} + {% set variants = variant|split('__')|map(v => v|replace({(v): 'table-' ~ v})) %} {% set attributes = attributes.addClass(variants) %} {% endif %} {% if stripes %} {% for stripe in stripes %} - {% set attributes = attributes.addClass('table-' ~ stripe|lower|replace({'_': '-'})) %} + {% set attributes = attributes.addClass('table-' ~ stripe) %} {% endfor %} {% endif %} -{% set attributes = borders ? attributes.addClass('table-' ~ borders|lower|replace({'_': '-'})) : attributes %} +{% set attributes = borders ? attributes.addClass('table-' ~ borders) : attributes %} {% set attributes = hover ? attributes.addClass('table-hover') : attributes %} {% set attributes = caption_top ? attributes.addClass('caption-top') : attributes %} {% set colgroups = colgroups and colgroups is not sequence ? [colgroups] : colgroups %} {% if responsive %} -<div class="{{ 'table-' ~ responsive|lower|replace({'_': '-'}) }}"> +<div class="{{ 'table-' ~ responsive }}"> {% endif %} <table{{ attributes }}> @@ -40,7 +40,7 @@ {% if header %} {% set thead_attributes = create_attribute({ 'class': [ - header_color ? 'table-' ~ header_color|lower|replace({'_': '-'}), + header_color ? 'table-' ~ header_color, divider and 'thead' in divider ? 'table-group-divider', ], }) %} @@ -83,7 +83,7 @@ {% if footer %} {% set tfoot_attributes = create_attribute({ 'class': [ - footer_color ? 'table-' ~ footer_color|lower|replace({'_': '-'}), + footer_color ? 'table-' ~ footer_color, divider and 'tfoot' in divider ? 'table-group-divider', ], }) %} diff --git a/components/table_cell/table_cell.twig b/components/table_cell/table_cell.twig index 71e4c876e85e2621af867e5573a2fc274d42ab5d..3416a0608d3169438469d9aebf901ae9d6850e65 100644 --- a/components/table_cell/table_cell.twig +++ b/components/table_cell/table_cell.twig @@ -1,6 +1,6 @@ {% set tag = tag|default('td') %} {% set attributes = active ? attributes.addClass('table-active') : attributes %} -{% set attributes = color ? attributes.addClass('table-' ~ color|lower|replace({'_': '-'})) : attributes %} +{% set attributes = color ? attributes.addClass('table-' ~ color) : attributes %} <{{ tag }}{{ attributes }}> {{- content -}} diff --git a/components/table_row/table_row.twig b/components/table_row/table_row.twig index 63c19b564fa2f7ccda3716acadc52aa2000539bd..272d2fee2e71e0e04235274583fdfa09b8b56213 100644 --- a/components/table_row/table_row.twig +++ b/components/table_row/table_row.twig @@ -1,5 +1,5 @@ {% set attributes = active ? attributes.addClass('table-active') : attributes %} -{% set attributes = color ? attributes.addClass('table-' ~ color|lower|replace({'_': '-'})) : attributes %} +{% set attributes = color ? attributes.addClass('table-' ~ color) : attributes %} <tr{{ attributes }}> {{- cells -}}