diff --git a/.gitignore b/.gitignore index 367ff1796..af0178383 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,12 @@ .idea /vendor/ /node_modules/ +**/node_modules/ +bcl/bootstrap/plugins +bcl/bootstrap/js +bcl/bootstrap/scss +bcl/bootstrap/*.svg +bcl/bootstrap/icons/*.svg /build/ /npm-debug.log /grumphp.yml @@ -11,6 +17,7 @@ /runner.yml /.idea/ /package-lock.json +**/package-lock.json /phpunit.xml /.stylelintrc.json /docker-compose.*.yml diff --git a/assets/.gitignore b/assets/.gitignore index f5c797220..dde8837e3 100644 --- a/assets/.gitignore +++ b/assets/.gitignore @@ -1,4 +1,3 @@ -/bcl/ /css/ /icons/ /js/ diff --git a/assets/bcl/bcl-accordion/bcl-accordion.html.twig b/assets/bcl/bcl-accordion/bcl-accordion.html.twig new file mode 100644 index 000000000..692f07c81 --- /dev/null +++ b/assets/bcl/bcl-accordion/bcl-accordion.html.twig @@ -0,0 +1,144 @@ +{% apply spaceless %} + +{# + Parameters: + - title (string) (default: '') + - title_tag (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes: (drupal attrs) + - id (int) (default: random(10000)) + - flush (boolean) (default: false) + - items (array) (default: []): format: [ + { + title: (string), + title_tag: (string), + content: (block), + stay_open (boolean) (default: false) + }, + ] + - expand_button: (button object) (default: {}) + - collapse_button: (button object) (default: {}) + - open_item_id (int) (default: 0) + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _id = id|default(random(10000)) %} +{% set _flush = flush ?? false %} +{% set _items = items|default([]) %} +{% set _expand_button = expand_button|default({}) %} +{% set _collapse_button = collapse_button|default({}) %} +{% set _open_item_id = open_item_id|default(0) %} +{% set _classes = ['accordion'] %} +{% if _flush %} + {% set _classes = _classes|merge(['accordion-flush']) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes).setAttribute('id', 'accordion-' ~ _id) %} + +{% if _items is not empty %} +
+ {%- if _title is not empty -%} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} + {%- endif -%} + + {% if _items|length > 1 and (_expand_button is not empty or _collapse_button is not empty) %} + {% set wrapper_attributes = create_attribute().addClass(['d-flex', 'justify-content-end', 'gap-3', 'mb-3']) %} +
+ {% if _expand_button is not empty %} + {% if _expand_button.attributes is empty %} + {% set _expand_button = _expand_button|merge({ + attributes: create_attribute() + }) + %} + {% endif %} + {% include '@oe-bcl/bcl-button/button.html.twig' with _expand_button|merge({ + attributes: _expand_button.attributes + .setAttribute('data-target', 'accordion-' ~ _id) + .setAttribute('data-action', 'expand') + }) only %} + {% endif %} + {% if _collapse_button is not empty %} + {% if _collapse_button.attributes is empty %} + {% set _collapse_button = _collapse_button|merge({ + attributes: create_attribute() + }) + %} + {% endif %} + {% include '@oe-bcl/bcl-button/button.html.twig' with _collapse_button|merge({ + attributes: _collapse_button.attributes + .setAttribute('data-target', 'accordion-' ~ _id) + .setAttribute('data-action', 'collapse') + }) only %} + {% endif %} +
+ {% endif %} +
+ {% for _item in _items %} + {% set _open_item = _open_item_id == loop.index %} + {% set _button_classes = ['accordion-button'] %} + {% if not _open_item %} + {% set _button_classes = _button_classes|merge(['collapsed']) %} + {% endif %} +
+ {%- set _item_title_tag = _item.title_tag|default('h2') %} + <{{ _item_title_tag }} + class="accordion-header" + id="heading-{{ _id }}-{{ loop.index }}" + > + {% set button_attributes = create_attribute() + .addClass(_button_classes) + .setAttribute('data-bs-toggle', 'collapse') + .setAttribute('autocomplete', 'off') + .setAttribute('data-bs-target', '#collapse-' ~ _id ~ '-' ~ loop.index) + .setAttribute('aria-controls', 'collapse-' ~ _id ~ '-' ~ loop.index) + .setAttribute('aria-expanded', open_item ? 'true' : 'false') + %} + {% set item_title %} + + {{- _item.title -}} + + {% endset %} + {% include '@oe-bcl/bcl-button/button.html.twig' with { + label: item_title, + clean_class: true, + attributes: button_attributes + } only %} + +
+
+ {%- set _content = _item.content|default('') %} + {%- block content _content -%} +
+
+
+ {% endfor %} +
+
+{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-alert/bcl-alert.html.twig b/assets/bcl/bcl-alert/bcl-alert.html.twig new file mode 100644 index 000000000..a1b0e363d --- /dev/null +++ b/assets/bcl/bcl-alert/bcl-alert.html.twig @@ -0,0 +1,83 @@ +{% apply spaceless %} + +{# Parameters: + - message (string) (default: '') + - heading (string) (default: '') + - variant (string) (default: 'primary') + - dismissible (boolean) (default: true) + - animated_dismiss (boolean) (default: true) + - icon_path (string) (default: '') + - icon_name (string) (default: '') + - attributes (drupal attrs) +#} + +{% set _message = message|default('') %} +{% set _heading = heading|default('') %} +{% set _variant = variant|default('primary') %} +{% set _dismissible = dismissible ?? true %} +{% set _animated_dismiss = animated_dismiss ?? true %} +{% set _icon_path = icon_path|default('') %} +{% set _icon_name = icon_name|default('') %} + +{% set _classes = ['alert', 'alert-' ~ _variant|e('html_attr'), 'd-flex', 'align-items-center'] %} +{% set _icon_names = { + primary: "info-circle-fill", + secondary: "info-circle-fill", + success: "check-circle-fill", + danger: "dash-circle-fill", + warning: "exclamation-triangle-fill", + light: "info-circle-fill", + info: "info-circle-fill", + dark: "info-circle-fill", + } +%} + +{% if _dismissible %} + {% set _classes = _classes|merge(['alert-dismissible']) %} +{% endif %} +{% if _animated_dismiss %} + {% set _classes = _classes|merge(['fade', 'show']) %} +{% endif %} + +{% set _classes = _classes|merge(['text-dark']) %} + +{% set _icon_classes = ['flex-shrink-0 me-3 mt-1 align-self-start' ] %} + +{% if _variant != 'light' %} + {% set _icon_classes = _icon_classes|merge(['text-' ~ _variant]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes).setAttribute('role', 'alert') %} + +
+{% if _icon_path is not empty %} + {% include '@oe-bcl/bcl-icon/icon.html.twig' with { + name: _icon_name ?: _icon_names[_variant], + size: 's', + path: _icon_path, + attributes: create_attribute().addClass(_icon_classes), + } only %} +{% endif %} +
+ {%- if _heading is not empty -%} +
{{ _heading }}
+ {%- endif -%} + {%- if _message is not empty -%} + {{- _message -}} + {%- endif -%} +
+{%- if _dismissible -%} + +{%- endif -%} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-badge/bcl-badge.html.twig b/assets/bcl/bcl-badge/bcl-badge.html.twig new file mode 100644 index 000000000..47cba476c --- /dev/null +++ b/assets/bcl/bcl-badge/bcl-badge.html.twig @@ -0,0 +1,79 @@ +{% apply spaceless %} + +{# Parameters: + - label (string) (default: '') + - background: (string) (default: 'primary') + - url (string) (default: '') + - title (string) (default: '') + - dismissible (boolean) (default: false) + - assistive_text (string) (default: '') + - rounded_pill (boolean) (default: false) + - outline (boolean) (default: false) + - icon_path (string) (default: '') + - attributes (drupal attrs) +#} + +{% set _label = label|default('') %} +{% set _background = background|default('primary') %} +{% set _url = url|default('') %} +{% set _title = title|default('') %} +{% set _dismissible = dismissible ?? false %} +{% set _assistive_text = assistive_text|default('') %} +{% set _rounded_pill = rounded_pill|default(false) %} +{% set _outline = outline|default(false) %} +{% set _icon_path = icon_path|default('') %} +{% set _classes = ['badge'] %} + +{% if _rounded_pill %} + {% set _classes = _classes|merge(['rounded-pill']) %} +{% endif %} + +{% if _outline %} + {% set _classes = _classes|merge(['badge-outline-' ~ _background]) %} +{% else %} + {% set _classes = _classes|merge(['text-bg-' ~ _background]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{%- if _title is not empty -%} + {% set attributes = attributes.setAttribute('title', _title) %} +{%- endif -%} + +{% set attributes = attributes.addClass(_classes) %} + +{% set _label %} + {%- if _assistive_text is not empty -%} + + {{- _assistive_text -}} + + {%- endif -%} + {{- _label -}} + {%- if _dismissible -%} + + {%- endif -%} +{% endset %} + +{%- if _url is not empty -%} + {% include '@oe-bcl/bcl-link/link.html.twig' with { + label: _label, + path: _url, + attributes: attributes, + } only %} +{%- else -%} + + {{- _label -}} + +{%- endif -%} + +{% endapply %} diff --git a/assets/bcl/bcl-banner/bcl-banner.html.twig b/assets/bcl/bcl-banner/bcl-banner.html.twig new file mode 100644 index 000000000..8f3012e62 --- /dev/null +++ b/assets/bcl/bcl-banner/bcl-banner.html.twig @@ -0,0 +1,96 @@ +{% apply spaceless %} + +{# Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'div') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - description: (string) (default: '') + - link: (link object) (default: {}) + - image: (string) tag + - shade: (boolean) (default: false) + - hero: (boolean) (default: false) + - full_width: (boolean) (default: false) + - fixed_height: (boolean) (default: false) + - content_classes: (string) (default: '') + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('div') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _description = description|default('') %} +{% set _link = link|default({}) %} +{% set _image = image|default('') %} +{% set _shade = shade ?? false %} +{% set _hero = hero ?? false %} +{% set _full_width = full_width ?? false %} +{% set _fixed_height = fixed_height ?? false %} +{% set _content_classes = content_classes|default('') %} + +{% set _content_class = 'bcl-banner__content' %} +{% if _content_classes is not empty %} + {% set _content_class = _content_class ~ " " ~ _content_classes %} +{% endif %} + +{% set _title_classes = ['display-6'] %} +{% if _description is not empty or _link is not empty %} + {% set _title_classes = _title_classes|merge(['mb-3']) %} +{% endif %} + +{% set _title_attributes = _title_attributes.addClass(_title_classes) %} + +{% set _classes = ['bcl-banner'] %} + +{% if _shade %} + {% set _classes = _classes|merge(['shade']) %} +{% endif %} + +{% if _image and not _shade %} + {% set _classes = _classes|merge(['overlay']) %} +{% endif %} + +{% if _hero %} + {% set _classes = _classes|merge(['hero']) %} +{% endif %} + +{% if _full_width %} + {% set _classes = _classes|merge(['full-width']) %} +{% endif %} + +{% if _fixed_height %} + {% set _classes = _classes|merge(['fixed-height']) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +
+ {% if _image is not empty %} +
+ {% endif %} +
+
+ {% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} + {% endif %} + {% if _description is not empty %} +

{{ _description }}

+ {% endif %} + {% if _link.path %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _link only %} + {% endif %} +
+
+
+ +{% endapply %} diff --git a/assets/bcl/bcl-base-templates/bcl-content-type.html.twig b/assets/bcl/bcl-base-templates/bcl-content-type.html.twig new file mode 100644 index 000000000..a6da669ff --- /dev/null +++ b/assets/bcl/bcl-base-templates/bcl-content-type.html.twig @@ -0,0 +1,139 @@ +{% apply spaceless %} + +{# + Parameters: + - with_header (boolean) (default: false) + - with_footer (boolean) (default: false) + - with_banner (boolean) (default: false) + - with_sidebar (boolean) (default: false) + - sidebar_size (string) (default: 'normal') + options: ['normal', 'large'] + - landing (boolean) (default: false) + - content_type (string) (default: '') + - attributes (drupal attrs) + + BLOCKS: + - header + - footer + - content + - content_row + - sidebar + - banner + - feedback + - share + - related + - messages_area +#} + +{% set _with_header = header ?? false %} +{% set _with_footer = footer ?? false %} +{% set _with_banner = banner ?? false %} +{% set _with_sidebar = sidebar ?? false %} +{% set _sidebar_size = sidebar_size|default('normal') %} +{% set _landing = landing ?? false %} +{% set _content_type = content_type|default('') %} +{% set _classes = ['bcl-node-type'] %} + +{% if _with_sidebar %} + {% set _col_classes = { + left: [ + 'col-12', + 'bcl-sidebar', + ], + right: [ + 'col-12', + ], + } %} + + {% if _sidebar_size == 'normal' %} + {% set _col_classes = _col_classes|merge({ + left: _col_classes.left|merge(['col-lg-3']), + right: _col_classes.right|merge(['col-lg-9', 'col-xxl-8']), + }) %} + {% endif %} + + {% if _sidebar_size == 'large' %} + {% set _col_classes = _col_classes|merge({ + left: _col_classes.left|merge(['col-lg-4']), + right: _col_classes.right|merge(['col-lg-8']), + }) %} + {% endif %} +{% endif %} + +{% if _content_type is not empty %} + {% set _classes = _classes|merge(['bcl-' ~ _content_type]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _with_header %} + {% include '@oe-bcl/bcl-header/header.html.twig' with header only %} +{% endif %} + +
+{% if messages is defined and messages is not empty %} + {% block messages_area %} +
+ {% for message in messages %} + {% set message_attributes = create_attribute().addClass(['mt-lg-5', 'mt-2']) %} + {% include '@oe-bcl/bcl-alert/alert.html.twig' with message|merge({ + attributes: message_attributes, + }) only %} + {% endfor %} +
+ {% endblock %} +{% endif %} + +{% if _with_banner %} + {% block banner %} + {% include '@oe-bcl/bcl-content-banner/content-banner.html.twig' with banner only %} + {% endblock %} +{% endif %} + +
+
+ {% block content_row %} + {{ content_row }} + {% endblock %} + {% if _with_sidebar %} +
+ {% block sidebar %}{% endblock %} +
+
+ {% else %} + {% if _landing %} +
+ {% else %} +
+ {% endif %} + {% endif %} + {% block content_top %} + {{ content_top }} + {% endblock %} + {% block content %} + {{ content }} + {% endblock %} + {% block content_bottom %} + {{ content_bottom }} + {% endblock %} + {% block related %} + {{ related }} + {% endblock %} + {% block share %} + {{ share }} + {% endblock %} +
+
+
+ +{% block feedback %} + {{ feedback }} +{% endblock %} + +{% if _with_footer %} + {% include '@oe-bcl/bcl-footer/footer.html.twig' with footer only %} +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-base-templates/bcl-listing-page.html.twig b/assets/bcl/bcl-base-templates/bcl-listing-page.html.twig new file mode 100644 index 000000000..5b6af7249 --- /dev/null +++ b/assets/bcl/bcl-base-templates/bcl-listing-page.html.twig @@ -0,0 +1,74 @@ +{# + Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - listing (object) (default: {}) + - pagination (object) (default: {}) + - sidebar (object) (default: '') +#} + +{% extends "@oe-bcl/bcl-base-templates/content-type.html.twig" %} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _listing = listing|default({}) %} +{% set _pagination = pagination|default({}) %} +{% set _sidebar = sidebar|default({}) %} + +{% set _title_attributes = _title_attributes ?: create_attribute() %} + +{% block content_top %} +{% if filter_button %} + {% include '@oe-bcl/bcl-button/button.html.twig' with filter_button only %} +{% endif %} +
+
+ {% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title ~ ' (' ~ listing.items.length ~ ')', + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes.addClass(['mb-0', 'text-capitalize']), + } only %} + {% endif %} +
+ {% if badges is not empty and badges is iterable %} +
+ {% for badge in badges %} + {% include '@oe-bcl/bcl-badge/badge.html.twig' with badge|merge({ + attributes: create_attribute().addClass(["mb-2", "me-2"]) + }) only %} + {% endfor %} +
+ {% endif %} +
+
+ {% include '@oe-bcl/bcl-select/select.html.twig' with sort_select|merge({ + attributes: create_attribute().addClass(['ms-md-2']), + }) only %} +
+
+
+
+{% endblock %} + +{% block content %} + {% if _listing is not empty %} + {% include '@oe-bcl/bcl-listing/listing.html.twig' with _listing only %} + {% endif %} +{% endblock %} + +{% block content_bottom %} + {% if _pagination is not empty %} +
+ {% include '@oe-bcl/bcl-pagination/pagination.html.twig' with _pagination only %} + {% endif %} +{% endblock %} + +{% block sidebar %} + {% include '@oe-bcl/bcl-base-templates/sidebar-search.html.twig' with _sidebar only %} +{% endblock %} diff --git a/assets/bcl/bcl-base-templates/bcl-sidebar-search.html.twig b/assets/bcl/bcl-base-templates/bcl-sidebar-search.html.twig new file mode 100644 index 000000000..019057a69 --- /dev/null +++ b/assets/bcl/bcl-base-templates/bcl-sidebar-search.html.twig @@ -0,0 +1,20 @@ +{% extends "@oe-bcl/bcl-offcanvas/offcanvas.html.twig" %} + +{% set responsiveness = 'lg' %} +{% if extra_classes_header is empty %} + {% set extra_classes_header = 'd-lg-block' %} +{% else %} + {% set extra_classes_header = extra_classes_header ~ ' d-lg-block' %} +{% endif %} + +{% block body %} + {% if search_form.attributes is empty %} + {% set attributes = search_form.create_attribute() %} + {% endif %} + +
+ {% include '@oe-bcl/bcl-form/form.html.twig' with search_form|merge({ + attributes: search_form.attributes.addClass('w-100') + }) only %} +
+{% endblock %} diff --git a/assets/bcl/bcl-blockquote/bcl-blockquote.html.twig b/assets/bcl/bcl-blockquote/bcl-blockquote.html.twig new file mode 100644 index 000000000..2c2e431cb --- /dev/null +++ b/assets/bcl/bcl-blockquote/bcl-blockquote.html.twig @@ -0,0 +1,73 @@ +{% apply spaceless %} + +{# Parameters: + - title (string) (default: '') + - title_tag (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes: (drupal attrs) + - quote (string) (default: '') + - attribution (string) (default: '') + - cite (string) (default: '') + - alignment (string) (default: 'left') + - options ['left', 'center', 'end'] + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _quote = quote|default('') %} +{% set _attribution = attribution|default('') %} +{% set _cite = cite|default('') %} +{% set _alignment = alignment|default('left') %} + +{% set _classes = [ + 'text-' ~ _alignment, + "bg-lighter", + "p-2", + "px-2-5", + "border-4", + "border-secondary" +] %} + +{% if _alignment == "center" %} + {% set _classes = _classes|merge(["border-top"]) %} +{% elseif _alignment == "end" %} + {% set _classes = _classes|merge(["border-end"]) %} +{% else %} + {% set _classes = _classes|merge(["border-start"]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +{%- if _title is not empty -%} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +{%- endif -%} + +
+
+

{{- _quote -}}

+
+{% if _attribution is not empty %} + +{% endif %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-breadcrumb/bcl-breadcrumb.html.twig b/assets/bcl/bcl-breadcrumb/bcl-breadcrumb.html.twig new file mode 100644 index 000000000..f4685526a --- /dev/null +++ b/assets/bcl/bcl-breadcrumb/bcl-breadcrumb.html.twig @@ -0,0 +1,62 @@ +{% apply spaceless %} + +{# Parameters: + - links (link[]) (default: []) + - icon_path (string) (default: '') + - attributes (drupal attrs) +#} + +{% set _links = links|default([]) %} +{% set _icon_path = icon_path|default('') %} + +{% set _classes = 'breadcrumb' %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.setAttribute('aria-label', 'breadcrumb') %} + +{% if _links is not empty %} + +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-button-group/bcl-button-group.html.twig b/assets/bcl/bcl-button-group/bcl-button-group.html.twig new file mode 100644 index 000000000..090434ccf --- /dev/null +++ b/assets/bcl/bcl-button-group/bcl-button-group.html.twig @@ -0,0 +1,67 @@ +{% apply spaceless %} + +{# Parameters: + - vertical (boolean) (default: false) + - size (string) (default: 'md') + - options ['sm', 'md', 'lg'] + - aria_label (string) (default: '') + - toolbar (boolean) (default: false) + - toolbar_aria_label (string) (default: '') + - items (button[] or input[] - if input key is present) (default: []) + - attributes (drupal attrs) +#} + +{% set _vertical = vertical ?? false %} +{% set _size = size|default('md') %} +{% set _aria_label = aria_label|default('') %} +{% set _toolbar = toolbar ?? false %} +{% set _toolbar_aria_label = toolbar_aria_label|default('') %} +{% set _items = items|default([]) %} + +{% set _classes = ['btn-group'] %} + +{% if _vertical %} + {% set _classes = ['btn-group-vertical'] %} +{% endif %} + +{% set _classes = _classes|merge(['btn-group-' ~ _size]) %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _aria_label is not empty %} + {% set attributes = attributes.setAttribute('aria-label', _aria_label) %} +{% endif %} + +{% set attributes = attributes.setAttribute('role', 'group').addClass(_classes) %} + +{% if _toolbar %} + +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-button/bcl-button.html.twig b/assets/bcl/bcl-button/bcl-button.html.twig new file mode 100644 index 000000000..547355a8c --- /dev/null +++ b/assets/bcl/bcl-button/bcl-button.html.twig @@ -0,0 +1,113 @@ +{% apply spaceless %} + +{# + Parameters: + - label (string) (default: '') + - variant (string) (default: 'primary') + - size (string) (default: 'md') + - options ['sm', 'md', 'lg'] + - type (string) (default: 'button') + - outline (boolean) (default: false) + - disabled (boolean) (default: false) + - text_nowrap (boolean) (default: false) + - assistive_text (string) (default: '') + - id (string) (default: '') + - icon (icon object) (default: {}) + - icon_position (string) (default: after) + - options ['after', 'before'] + - icon_spacing (string) (default: '') + - options ['sm', 'md', 'lg'] + - spinner (spinner object) (default: {}) + - show_spinner (boolean) (default: false) + - clean_class (boolean) (default: false) + - attributes (drupal attrs) +#} + +{% set _label = label|default('') %} +{% set _variant = variant|default('primary') %} +{% set _size = size|default('md') %} +{% set _type = type|default('button') %} +{% set _outline = outline ?? false %} +{% set _disabled = disabled ?? false %} +{% set _text_nowrap = text_nowrap ?? false %} +{% set _assistive_text = assistive_text|default('') %} +{% set _id = id|default('') %} +{% set _icon = icon|default({}) %} +{% set _icon_position = icon_position|default('after') %} +{% set _icon_spacing = icon_spacing|default('') %} +{% set _spinner = spinner|default({}) %} +{% set _show_spinner = show_spinner ?? false %} +{% set _clean_class = clean_class ?? false %} + +{% set _classes = [] %} +{% if _clean_class == false %} + {% set _classes = _classes|merge(['btn', 'btn-' ~ (_outline ? 'outline-' : '') ~ _variant|e('html_attr')]) %} + {% set _classes = _classes|merge(['btn-' ~ _size|e('html_attr')]) %} +{% endif %} +{% if _text_nowrap %} + {% set _classes = _classes|merge(['text-nowrap']) %} +{% endif %} +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} +{% if _disabled %} + {% set attributes = attributes.setAttribute('disabled', true).setAttribute('aria-disabled', 'true') %} +{% endif %} +{% if _id is not empty %} + {% set attributes = attributes.setAttribute('id', _id) %} +{% endif %} +{% if _classes is not empty %} + {% set attributes = attributes.addClass(_classes) %} +{% endif %} +{% if _icon_spacing is not empty %} + {% set _icon_spacing = _icon_spacing ~ '-' %} +{% endif %} +{% set attributes = attributes.setAttribute('type', _type) %} +{% if _icon is not empty %} + {% set _icon = _icon|merge({ + size: "fluid", + }) + %} + {% if _label is not empty %} + {% if _icon.attributes is empty %} + {% set _icon = _icon|merge({ + attributes: create_attribute() + }) + %} + {% endif %} + {% if _icon_position == 'before' %} + {% set _icon = _icon|merge({ + attributes: _icon.attributes.addClass('me-' ~ _icon_spacing ~ '2-5') + }) + %} + {% else %} + {% set _icon = _icon|merge({ + attributes: _icon.attributes.addClass('ms-' ~ _icon_spacing ~ '2-5') + }) + %} + {% endif %} + {% endif %} + {%- set _icon_markup -%} + {%- include '@oe-bcl/bcl-icon/icon.html.twig' with _icon only -%} + {%- endset -%} +{% endif %} + + + +{% endapply %} diff --git a/assets/bcl/bcl-card-layout/bcl-card-layout.html.twig b/assets/bcl/bcl-card-layout/bcl-card-layout.html.twig new file mode 100644 index 000000000..3bf50afca --- /dev/null +++ b/assets/bcl/bcl-card-layout/bcl-card-layout.html.twig @@ -0,0 +1,87 @@ +{% apply spaceless %} + +{# Parameters: + - type (string) (default: 'group') + options: ['group', 'grid', 'masonry'] + - items (card[]) (default: []) + - grid_columns (int) (default: 1) + options: ['1', '2', '3'] + - responsiveness (string) (default: '') + options: ['sm', 'md', 'lg', 'xl', 'xxl'] + - responsive_columns (int) (default: '') + options: ['1', '2', '3'] + - gutter (int) (default: '') + options: ['0', '1', '2', '3', '4', '5'] + - equal_height (boolean) (default: false) + - cols_extra_classes (string) (default: '') + - attributes (drupal attrs) + + Blocks + - card_layout_card +#} + +{% set _type = type|default('group') %} +{% set _items = items|default([]) %} +{% set _grid_columns = grid_columns|default(1) %} +{% set _responsiveness = responsiveness|default('md') %} +{% set _responsive_columns = responsive_columns|default('') %} +{% set _gutter = gutter|default('') %} +{% set _equal_height = equal_height ?? false %} +{% set _cols_extra_classes = cols_extra_classes|default('') %} + +{% set _cols_classes = 'col' %} + +{% if _cols_extra_classes is not empty %} + {% set _cols_classes = _cols_classes ~ ' ' ~ _cols_extra_classes %} +{% endif %} +{% if _type == 'group' %} + {% set _classes = ['card-group'] %} +{% elseif type == 'grid' or type == 'masonry' %} + {% set _classes = ['row', 'row-cols-' ~ _grid_columns] %} + {% if _responsive_columns is not empty %} + {% set _classes = _classes|merge(['row-cols-' ~ _responsiveness ~ '-' ~ _responsive_columns]) %} + {% endif %} + {% if _gutter is not empty %} + {% set _classes = _classes|merge(['g-' ~ _gutter]) %} + {% endif %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +
+{% if _items is not empty and _items is iterable %} + {% for _item in _items %} + {% if _item.attributes is empty %} + {% set _item = _item|merge({ + attributes: create_attribute() + }) %} + {% endif %} + {% if _equal_height %} + {% set _item = _item|merge({ + attributes: _item.attributes.addClass('h-100') + }) + %} + {% endif %} + {% if _type == 'grid' or _type == 'masonry' %} +
+ {% endif %} + {% block card_layout_card %} + {% include '@oe-bcl/bcl-card/card.html.twig' with _item only %} + {% endblock %} + {% if _type == 'grid' or _type == 'masonry' %} +
+ {% endif %} + {% endfor %} +{% endif %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-card/bcl-card.html.twig b/assets/bcl/bcl-card/bcl-card.html.twig new file mode 100644 index 000000000..9bd5ee991 --- /dev/null +++ b/assets/bcl/bcl-card/bcl-card.html.twig @@ -0,0 +1,275 @@ +{% apply spaceless %} + +{# Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h1') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - subtitle (object) (default: {}) + format: { + content: '', + tag: '', + classes: '' + } + - text (object) (default: {}) + format: { + content: '', + tag: '', + classes: '' + } + - content (string) (default: '') + - image (object) (default: {}) + format: { + path (string), + alt (string), + position (string) + } + - date (date block object) (default: {}) + - variant (string) (default: '') + - horizontal (boolean) (default: false) + - horizontal_grid (object) (default: {}) + format: { + left_col_classes (default: 'bcl-card-start-col') + right_col_classes (default: 'col') + gutter (default: '') - options: ['small', 'large'] + } + - border_variant (string) (default: '') + - text_color (string) (default: '') + options: ['dark', 'white'] + - card_header (string) (default: '') + - card_footer (string) (default: '') + - extra_classes_body (string) (default: '') + - extra_classes_header (string) (default: '') + - extra_classes_footer (string) (default: '') + - badges (badge[]) (default: []) + - links (array of link object) (default: []) + - attributes (drupal attrs) + + Blocks + - card_date + - card_badges + - card_links +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h1') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _subtitle = subtitle|default({}) %} +{% set _text = text|default({}) %} +{% set _content = content|default('') %} +{% set _image = image|default({}) %} +{% set _date = date|default({}) %} +{% set _variant = variant|default('') %} +{% set _horizontal = horizontal ?? false %} +{% set _horizontal_grid = horizontal_grid|default({ + left_col_classes: 'bcl-card-start-col', + right_col_classes: 'col', + left_col_size: '', +}) %} +{% set _border_variant = border_variant|default('') %} +{% set _text_color = text_color|default('') %} +{% set _card_header = card_header|default('') %} +{% set _card_footer = card_footer|default('') %} +{% set _extra_classes_body = extra_classes_body|default('') %} +{% set _extra_classes_header = extra_classes_header|default('') %} +{% set _extra_classes_footer = extra_classes_footer|default('') %} +{% set _badges = badges|default([]) %} +{% set _links = links|default([]) %} + +{% set _classes = ['card'] %} +{% if _text_color is not empty %} + {% set _classes = _classes|merge(['text-' ~ _text_color]) %} +{% endif %} +{% if _variant is not empty %} + {% set _classes = _classes|merge(['text-bg-' ~ _variant]) %} +{% endif %} +{% if _border_variant is not empty %} + {% set _classes = _classes|merge(['border-' ~ _border_variant]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set _body_classes = 'card-body' %} +{% if _extra_classes_body is not empty %} + {% set _body_classes = _body_classes ~ ' ' ~ _extra_classes_body %} +{% endif %} + +{% set _header_classes = 'card-header' %} +{% if _extra_classes_header is not empty %} + {% set _header_classes = _header_classes ~ ' ' ~ _extra_classes_header %} +{% endif %} + +{% set _footer_classes = 'card-footer' %} +{% if _extra_classes_footer is not empty %} + {% set _footer_classes = _footer_classes ~ ' ' ~ _extra_classes_footer %} +{% endif %} + +{% set _row_classes = 'row' %} +{% if _horizontal_grid.gutter is not empty %} + {% set _row_classes = _row_classes ~ ' g-' ~ _horizontal_grid.gutter %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +
+{% if _card_header is not empty %} +
+ {{- _card_header -}} +
+{% endif %} +{% if _horizontal %} +
+{% endif %} +{% if _image is not empty and _image.position != 'bottom' %} + {% set _img_class = 'card-img-top' %} + {% if _image.position == 'background' %} + {% set _img_class = 'card-img' %} + {% endif %} + {% if _image.rounded is not empty %} + {% set _img_class = _img_class ~ ' rounded-' ~ _image.rounded %} + {% elseif _horizontal %} + {% if attributes.hasClass('border-0') %} + {% set _img_class = _img_class ~ ' rounded-1' %} + {% else %} + {% set _img_class = _img_class ~ ' rounded-0 rounded-start' %} + {% endif %} + {% elseif _card_header is not empty %} + {% set _img_class = _img_class ~ ' rounded-0' %} + {% endif %} + {% if _image.classes is not empty %} + {% set _img_class = _img_class ~ " " ~ _image.classes %} + {% endif %} +{% endif %} +{% if _horizontal and (_image is not empty or _date is not empty) %} +
+{% endif %} + {% if _date is not empty %} + {% block card_date %} + {% include '@oe-bcl/bcl-date-block/date-block.html.twig' with _date only %} + {% endblock %} + {% elseif _image is not empty and _image.position != "bottom" %} + {{ _image.alt }} + {% endif %} +{% if _horizontal and (_image is not empty or _date is not empty) %} +
+{% endif %} +{% if _image.position == 'background' %} +
+{% endif %} +{% if _horizontal %} +
+{% endif %} +
+ {% if _title is not empty %} + {% if _title_attributes.class is empty %} + {% set _title_attributes = _title_attributes.addClass('fs-4') %} + {% endif %} + {% set _title_attributes = _title_attributes.addClass('card-title') %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} + {% endif %} + {%- if _subtitle is not empty -%} + {% set _subtitle_tag = _subtitle.tag ?? 'h6' %} + <{{ _subtitle_tag }} + class='card-subtitle{{ _subtitle.classes ? ' ' ~ _subtitle.classes }}' + > + {{- _subtitle.content -}} + + {%- endif -%} + {%- if _text is not empty -%} + {% set _text_tag = _text.tag ?? 'p' %} + <{{ _text_tag }} + class='card-text{{ _text.classes ? ' ' ~ _text.classes }}' + > + {{- _text.content -}} + + {%- endif -%} + {%- if _content is not empty -%} + {{- _content -}} + {%- endif -%} + {% block card_badges %} + {%- if _badges is not empty and _badges is iterable -%} +
+ {% for _badge in _badges %} + {% if _badge.attributes is empty %} + {% set _badge = _badge|merge({ + attributes: create_attribute() + }) %} + {% endif %} + {% set _badge = _badge|merge({ + attributes: _badge.attributes.addClass('mb-2') + }) + %} + {% if not loop.last %} + {% set _badge = _badge|merge({ + attributes: _badge.attributes.addClass('me-2') + }) + %} + {% endif %} + {% include '@oe-bcl/bcl-badge/badge.html.twig' with _badge only %} + + {% endfor %} +
+ {%- endif -%} + {% endblock %} + {% block card_links %} + {%- if _links is not empty and _links is iterable -%} +
+ {% for _link in _links %} +
+ {% include '@oe-bcl/bcl-link/link.html.twig' with _link only %} +
+ {% endfor %} +
+ {%- endif -%} + {% endblock %} +
+{% if _horizontal %} +
+{% endif %} +{% if _image is not empty %} + {% if _image.position == 'background' %} +
+ {% endif %} + {% set _img_class = "card-img-bottom" %} + {% if _image.classes is not empty %} + {% set _img_class = _img_class ~ " " ~ _image.classes %} + {% endif %} + {% if _image.position == 'bottom' %} + {% if _horizontal %} +
+ {% endif %} + {{ _image.alt }} + {% if _horizontal %} +
+ {% endif %} + {% endif %} +{% endif %} +{% if _horizontal %} +
+{% endif %} +{% if _card_footer is not empty %} + +{% endif %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-carousel/bcl-carousel.html.twig b/assets/bcl/bcl-carousel/bcl-carousel.html.twig new file mode 100644 index 000000000..39e601b00 --- /dev/null +++ b/assets/bcl/bcl-carousel/bcl-carousel.html.twig @@ -0,0 +1,180 @@ +{% apply spaceless %} + +{# Parameters: + - title (string) (default: '') + - title_tag (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes: (drupal attrs) + - id (string) (default: '') + - autoplay (boolean) (default: true) + - dark (boolean) (default: false) + - active_item (integer) (default: 1) + - items (object[]) format: [ + { + image: (string) tag + caption (string) + caption_classes (string) + caption_title (string) + interval (integer) (default: 0) + } + ], + - fade (boolean) (default: false) + - with_controls (boolean) (default: true) + - prev_label (string) (default: '') + - next_label (string) (default: '') + - with_indicators (boolean) (default: false) + - rounded_indicators (boolean) (default: false) + - disable_touch (boolean) (default: false) + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _id = id|default('') %} +{% set _autoplay = autoplay ?? true %} +{% set _dark = dark ?? false %} +{% set _active_item = active_item|default(1) %} +{% set _items = items|default([]) %} +{% set _fade = fade ?? false %} +{% set _with_controls = with_controls ?? true %} +{% set _prev_label = prev_label|default('') %} +{% set _next_label = next_label|default('') %} +{% set _with_indicators = with_indicators ?? false %} +{% set _rounded_indicators = rounded_indicators ?? false %} +{% set _disable_touch = disable_touch ?? false %} + +{% set _classes = ['carousel', 'slide'] %} + +{% if _fade %} + {% set _classes = _classes|merge(['carousel-fade']) %} +{% endif %} +{% if _dark %} + {% set _classes = _classes|merge(['carousel-dark']) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _id is not empty %} + {% set attributes = attributes.setAttribute('id', _id) %} +{% endif %} + +{% if _autoplay %} + {% set attributes = attributes.setAttribute('data-bs-ride', 'carousel') %} +{% endif %} + +{% if _disable_touch %} + {% set attributes = attributes.setAttribute('data-bs-touch', 'false') %} +{% endif %} + +{% if _rounded_indicators %} + {% set attributes = attributes.addClass('rounded-indicators') %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +{%- if _title is not empty -%} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +{%- endif -%} + +
+{% if _with_indicators %} + +{% endif %} + +{% if _with_controls %} + + +{% endif %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-contact-form/bcl-contact-form.html.twig b/assets/bcl/bcl-contact-form/bcl-contact-form.html.twig new file mode 100644 index 000000000..179e6a313 --- /dev/null +++ b/assets/bcl/bcl-contact-form/bcl-contact-form.html.twig @@ -0,0 +1,5 @@ +{% extends '@oe-bcl/bcl-base-templates/content-type.html.twig' %} + +{% block content %} + {% include '@oe-bcl/bcl-form/form.html.twig' with form only %} +{% endblock %} diff --git a/assets/bcl/bcl-content-banner/bcl-content-banner.html.twig b/assets/bcl/bcl-content-banner/bcl-content-banner.html.twig new file mode 100644 index 000000000..600531e8e --- /dev/null +++ b/assets/bcl/bcl-content-banner/bcl-content-banner.html.twig @@ -0,0 +1,136 @@ +{% apply spaceless %} + +{# + Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h1') + - title_link: (link object) (default: {}) + - title_attributes: (drupal attrs) + - background: (string) (default: 'white') + options: [ white, gray ] + - image (object) (default: {}) + - image_size: (string) (default: 'md') + options: ['md', 'lg', 'xl'] + - date: (date block object) (default: {}) + + Card inheritance + - badges (badge[]) (default: []) + - links (link[]) (default: []) + - content (string) (default: '') + - subtitle (object) (default: {}) + format: { + content: '', + tag: '', + classes: '' + } + - text (object) (default: {}) + format: { + content: '', + tag: '', + classes: '' + } + + - attributes: (drupal attrs) + + Blocks + - "action_bar" (string) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h1') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _background = background|default('white') %} +{% set _image = image|default({}) %} +{% set _image_size = image_size|default('md') %} +{% set _action_bar = action_bar|default('') %} +{% set _date = date|default({}) %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set _classes = [ + 'bcl-content-banner', +] %} + +{% if _background != 'white' %} + {% set _classes = _classes|merge([ + 'pb-md-4-75', + 'pb-4', + 'pt-4', + 'pt-md-4-75', + ]) %} +{% else %} + {% set _classes = _classes|merge([ + 'pt-4', + 'pt-md-4-75', + ]) %} +{% endif %} + +{% set _modifiers = { + 'white': 'bg-white', + 'gray': 'bg-lighter', +} %} + +{% set _body_classes = 'pt-0 px-0 pb-0' %} +{% set _right_col_classes = 'col-md col-lg-9 col-xxl-8' %} + +{% if _image is not empty %} + {% set _left_col_classes = 'bcl-card-start-col' %} + {% set _body_classes = 'pt-4 pt-md-0 px-0 px-md-1-5 pb-0' %} + {% if _image_size == 'lg' %} + {% set _left_col_classes = _left_col_classes ~ ' bcl-size-large' %} + {% set _right_col_classes = 'col-md col-xl-9 col-xxl-8' %} + {% endif %} + {% if _image_size == 'xl' %} + {% set _left_col_classes = _left_col_classes ~ ' bcl-size-extra-large' %} + {% set _body_classes = 'pt-4 pt-lg-0 px-0 px-lg-1-5 pb-0' %} + {% set _right_col_classes = 'col-lg' %} + {% endif %} +{% endif %} +{% if _date is not empty %} + {% set _left_col_classes = 'bcl-card-start-col' %} + {% set _right_col_classes = 'col-12 col-md col-xxl-9' %} +{% endif %} +{% if _image is empty and _date is empty %} + {% set _right_col_classes = 'col-lg-10 col-xl-9 col-xxl-8' %} +{% endif %} + +{% set _horizontal_classes = { + left_col_classes: _left_col_classes, + right_col_classes: _right_col_classes, +} %} + +{% set _card = { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + title_attributes: _title_attributes.addClass('fs-1'), + horizontal: true, + horizontal_grid: _horizontal_classes, + extra_classes_header: 'bg-transparent pt-0 pb-0 border-0', + extra_classes_body: _body_classes, + attributes: create_attribute().addClass(['bg-transparent', 'border-0']), +} %} + +{% set _classes = _classes|merge([_modifiers[_background]]) %} +{% set attributes = attributes.addClass(_classes) %} + +{% if _button is not empty %} + {% set _card = _card|merge({ + attributes: _card.attributes.addClass(['col-md-10']), + }) %} +{% endif %} + +
+
+ {% include '@oe-bcl/bcl-card/card.html.twig' with _card %} + + {%- block action_bar -%} + {{ _action_bar }} + {%- endblock -%} +
+
+ +{% endapply %} diff --git a/assets/bcl/bcl-date-block/bcl-date-block.html.twig b/assets/bcl/bcl-date-block/bcl-date-block.html.twig new file mode 100644 index 000000000..adc467fb6 --- /dev/null +++ b/assets/bcl/bcl-date-block/bcl-date-block.html.twig @@ -0,0 +1,80 @@ +{% apply spaceless %} + +{# + Parameters: + - day (integer) (default: '') + - month (string) (default: '') + - date_time (string) (default: '') + - year (integer) (default: '') + - end_day (integer) (default: '') + - end_month (string) (default: '') + - end_year (integer) (default: '') + - icon_path (string) (default: '') +#} + +{% set _day = day|default('') %} +{% set _month = month|default('') %} +{% set _date_time = date_time|default('') %} +{% set _year = year|default('') %} +{% set _end_day = end_day|default('') %} +{% set _end_month = end_month|default('') %} +{% set _end_year = end_year|default('') %} +{% set _icon_path = icon_path|default('') %} + +{% set _classes = [ + 'bcl-date-block', + 'bg-date', + 'rounded', + 'mw-date', + 'text-center', + 'd-flex', + 'flex-column', + 'ratio', + 'ratio-1x1' +] %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +{% if _date_time is not empty %} + {% set attributes = attributes.setAttribute('datetime', _date_time) %} +{% endif %} + + + +{% endapply %} diff --git a/assets/bcl/bcl-description-list/bcl-description-list-details.html.twig b/assets/bcl/bcl-description-list/bcl-description-list-details.html.twig new file mode 100644 index 000000000..05fb37120 --- /dev/null +++ b/assets/bcl/bcl-description-list/bcl-description-list-details.html.twig @@ -0,0 +1,44 @@ +{% apply spaceless %} + +{# + Parameters: + - button: (button object) (default: {}) + - link: (link object) (default: {}) + - icon: (icon object) (default: {}) + - label: (string) (default: '') + + BLOCKS: + - definition +#} + +{% set _button = button|default({}) %} +{% set _link = link|default({}) %} +{% set _icon = icon|default({}) %} +{% set _label = label|default('') %} + + +
+{%- block definition -%} + {%- if _button is not empty -%} + {% include '@oe-bcl/bcl-button/button.html.twig' with _button only %} + {%- elseif _link is not empty %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _link only -%} + {%- else -%} + {%- if _icon is not empty -%} + {%- set _icon_classes = ["me-2", "align-self-center", "flex-shrink-0"] -%} + {% set _icon_attributes = _icon.attributes ?: create_attribute() %} + {% set _icon_attributes = _icon_attributes.addClass(_icon_classes) %} + {%- include '@oe-bcl/bcl-icon/icon.html.twig' with _icon|merge({ + attributes: _icon_attributes, + }) only -%} +
+ {{- _label -}} +
+ {%- else -%} +
{{- _label -}}
+ {%- endif -%} + {%- endif -%} +{% endblock %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-description-list/bcl-description-list-title.html.twig b/assets/bcl/bcl-description-list/bcl-description-list-title.html.twig new file mode 100644 index 000000000..1a8c3a7ba --- /dev/null +++ b/assets/bcl/bcl-description-list/bcl-description-list-title.html.twig @@ -0,0 +1,33 @@ +{% apply spaceless %} + +{# + Parameters: + - icon: (icon object) (default: {}) + - color: (string) (default: '') + - options: ['bg-primary', 'bg-secondary', 'bg-success', 'bg-warning', 'bg-info', 'bg-light', 'bg-dark', 'bg-lighter', 'bg-gray-200', 'bg-gray-400'] + - label: (string) (default: '') +#} + +{% set _icon = icon|default({}) %} +{% set _color = color|default('') %} +{% set _label = label|default('') %} + +
+
+ {%- if _icon is not empty -%} + {% set _icon_classes = ["me-2", "align-self-center", "flex-shrink-0"] %} + {% set _icon_attributes = _icon.attributes ?: create_attribute() %} + {% set _icon_attributes = _icon_attributes.addClass(_icon_classes) %} + {% include '@oe-bcl/bcl-icon/icon.html.twig' with _icon|merge({ + attributes: _icon_attributes, + }) only %} + {%- elseif _color is not empty -%} +
+ +
+ {%- endif -%} +
{{- _label -}}
+
+
+ +{% endapply %} diff --git a/assets/bcl/bcl-description-list/bcl-description-list.html.twig b/assets/bcl/bcl-description-list/bcl-description-list.html.twig new file mode 100644 index 000000000..09a83159a --- /dev/null +++ b/assets/bcl/bcl-description-list/bcl-description-list.html.twig @@ -0,0 +1,121 @@ +{% apply spaceless %} + +{# + Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - bordered (boolean) (default: false) + - col_classes (string) (default: 'col-3') + - items (array) (default: []): format: [ + { + term (string or description list title []) + definition (string or description list details []) + }, + ... + ] + - variant (string) (default: '') + - option: ['horizontal'] +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _bordered = bordered ?? false %} +{% set _col_classes = col_classes|default('col-md-3') %} +{% set _items = items|default([]) %} +{% set _variant = variant|default('') %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set _item_classes = ['mb-3'] %} + +{% if _bordered %} + {% set _item_classes = ['border-bottom', 'pb-2-5', 'mb-2-5'] %} +{% endif %} + +{% if _variant == 'horizontal' %} + {% set _item_classes = _item_classes|merge(['row']) %} +{% endif %} + +{% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +{% endif %} + +{% set attributes = attributes.addClass(['bcl-description-list']) %} + +{% if _variant != 'horizontal' %} +
+{% else %} +
+{% endif %} + {% for _item in _items %} + {% if _variant == 'horizontal' %} +
+ {% else %} +
+ {% endif %} + {% if _item.term is not empty %} + {% if _variant == 'horizontal' %} +
+ {% endif %} + {% if _item.term is iterable %} + {% for _term in _item.term %} + {%- include '@oe-bcl/bcl-description-list/description-list-title.html.twig' with _term only -%} + {% endfor %} + {% else %} + {%- include '@oe-bcl/bcl-description-list/description-list-title.html.twig' with { + label: _item.term + } only -%} + {% endif %} + {% if _variant == 'horizontal' %} +
+ {% endif %} + {% endif %} + {% if _item.definition is not empty %} + {% if _variant == 'horizontal' %} +
+ {% endif %} + {% if _item.definition is iterable %} + {% for _definition in _item.definition %} + {%- include '@oe-bcl/bcl-description-list/description-list-details.html.twig' with _definition only -%} + {% endfor %} + {% else %} + {%- include '@oe-bcl/bcl-description-list/description-list-details.html.twig' with { + label: _item.definition + } only -%} + {% endif %} + {% if _variant == 'horizontal' %} +
+ {% endif %} + {% endif %} + {% if _variant == 'horizontal' %} +
+ {% else %} +
+ {% endif %} + {% endfor %} +{% if _variant != 'horizontal' %} +
+{% else %} + +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-dropdown/bcl-dropdown.html.twig b/assets/bcl/bcl-dropdown/bcl-dropdown.html.twig new file mode 100644 index 000000000..cc641c4e3 --- /dev/null +++ b/assets/bcl/bcl-dropdown/bcl-dropdown.html.twig @@ -0,0 +1,130 @@ +{% apply spaceless %} + +{# Parameters: + - id (string) (default: dropdown-random(10000)) + - trigger (link or button) + - link (boolean) (default: false) + - direction (string) (default: '') + - options ['dropup', 'dropend', 'dropstart'] + - alignment (string) (default: '') + - options [ + 'dropdown-menu-end', + 'dropdown-menu-sm-end', + 'dropdown-menu-md-end', + 'dropdown-menu-lg-end', + 'dropdown-menu-xl-end', + 'dropdown-menu-xxl-end', + 'dropdown-menu-start', + 'dropdown-menu-sm-start', + 'dropdown-menu-md-start', + 'dropdown-menu-lg-start', + 'dropdown-menu-xl-start', + 'dropdown-menu-xxl-start' + ] + - dark (boolean) (default: false) + - remove_wrapper (boolean) (default: false) + - items (object[]) + format: [ + { + - link or button object + - active (boolean) + - divider (bolean) - show divider + - button (boolean) - set to button + } + ] + - attributes (drupal attrs) +#} + +{% set _id = id|default('dropdown-' ~ random(1000)) %} +{% set _trigger = trigger|default({}) %} +{% set _link = link ?? false %} +{% set _direction = direction|default('') %} +{% set _alignment = alignment|default('') %} +{% set _dark = dark ?? false %} +{% set _remove_wrapper = remove_wrapper ?? false %} +{% set _items = items|default([]) %} + +{% set _class = 'dropdown' %} +{% set _dropdown_classes = ['dropdown-menu'] %} + +{% if _dark %} + {% set _dropdown_classes = _dropdown_classes|merge(['dropdown-menu-dark']) %} +{% endif %} +{% if _alignment %} + {% set _dropdown_classes = _dropdown_classes|merge([_alignment]) %} +{% endif %} +{% if _direction %} + {% set _class = _class ~ ' ' ~ _direction %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.setAttribute('aria-labelledby', _id).addClass(_dropdown_classes) %} + +{% if _trigger.attributes is empty %} + {% set _trigger = _trigger|merge({ + attributes: create_attribute() + }) %} +{% endif %} +{% set _trigger = _trigger|merge({ + attributes: _trigger.attributes.addClass(['dropdown-toggle']) + .setAttribute('aria-expanded', 'false') + .setAttribute('data-bs-toggle', 'dropdown') + .setAttribute('id', _id) +}) %} + +{% if _link %} + {% set _trigger = _trigger|merge({ + attributes: _trigger.attributes.setAttribute('role', 'button') + }) %} +{% else %} + {% set _trigger = _trigger|merge({ + attributes: _trigger.attributes.setAttribute('autocomplete', 'off') + }) %} +{% endif %} + +{% if not _remove_wrapper %} +
+{% endif %} + {% if _link %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _trigger only %} + {% else %} + {% include '@oe-bcl/bcl-button/button.html.twig' with _trigger only %} + {% endif %} + +{% if not _remove_wrapper %} +
+{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-event/bcl-event.html.twig b/assets/bcl/bcl-event/bcl-event.html.twig new file mode 100644 index 000000000..bd12b6eea --- /dev/null +++ b/assets/bcl/bcl-event/bcl-event.html.twig @@ -0,0 +1,24 @@ +{% extends '@oe-bcl/bcl-base-templates/content-type.html.twig' %} + +{% block sidebar %} + {% include '@oe-bcl/bcl-inpage-navigation/inpage-navigation.html.twig' with sidebar only %} +{% endblock %} + +{% block content %} + {% include '@oe-bcl/bcl-description-list/description-list.html.twig' with details_list only %} + +

Description

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sit amet eleifend tortor. In facilisis eros vitae turpis ullamcorper, + a euismod dolor lacinia. Nam facilisis ipsum et sollicitudin imperdiet. Curabitur a efficitur ante. Phasellus non felis laoreet, + posuere ante ut, rhoncus tortor. Proin sed erat vel nisl luctus vulputate. Nunc tristique ultricies turpis, eu dictum enim ultrices vel. + Sed posuere at leo sit amet placerat. Sed dapibus viverra urna ac pretium. Praesent et laoreet erat, eget volutpat metus. Duis ac augue + sed tortor elementum dignissim in sit amet velit. Nullam nec viverra mi. +

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sit amet eleifend tortor. In facilisis eros vitae turpis ullamcorper, + a euismod dolor lacinia. Nam facilisis ipsum et sollicitudin imperdiet. +

+ +

Related documents

+ {% include '@oe-bcl/bcl-file/file.html.twig' with files[0] only %} + {% include '@oe-bcl/bcl-file/file.html.twig' with files[1] only %} +{% endblock %} diff --git a/assets/bcl/bcl-fact-figures/bcl-fact-figures.html.twig b/assets/bcl/bcl-fact-figures/bcl-fact-figures.html.twig new file mode 100644 index 000000000..eed41cef9 --- /dev/null +++ b/assets/bcl/bcl-fact-figures/bcl-fact-figures.html.twig @@ -0,0 +1,128 @@ +{% apply spaceless %} + +{# + Parameters: + - title (string) (default: '') + - title_tag (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - variant (string) (default: 'default') + options: default, block ] + - display_icons (boolean) (default: true) + - items (array) (default: []): + - icon (associate array) (default: { size: 'm' }) + - subtitle (string) (default: '') + - title (string) (default: '') + - description (string) (default:'') + - grid_columns (int) (default: 1) + - responsiveness (string) (default: 'md') + - responsive_columns (integer) (default: 3) + - gutter (int) (default: 4) + - equal_height (boolean) (default: false) + - cols_extra_classes (string) (default: '') + - icon_path (string) (default: '') + - link_more (object of type link) (default {}) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _variant = variant|default('default') %} +{% set _display_icons = display_icons ?? true %} +{% set _items = items|default([]) %} +{% set _grid_columns = grid_columns|default(1) %} +{% set _responsiveness = responsiveness|default('md') %} +{% set _responsive_columns = responsive_columns|default(3) %} +{% set _gutter = gutter|default(4) %} +{% set _equal_height = equal_height ?? false %} +{% set _cols_extra_classes = cols_extra_classes|default('') %} +{% set _icon_path = icon_path|default('') %} +{% set _link_more = link_more|default({}) %} + +{% set _cols_classes = 'col' %} +{% set _classes = ['bcl-fact-figures', 'bcl-fact-figures--' ~ _variant] %} +{% set _wrapper_classes = [] %} + +{% set _grid_classes = [ + 'row-cols-' ~ _responsiveness ~ '-' ~ _responsive_columns, + 'row', 'row-cols-' ~ _grid_columns +] %} +{% if _responsive_columns == 3 %} + {% set _grid_classes = _grid_classes|merge(['row-cols-sm-2']) %} +{% endif %} +{% if _variant == 'block' or _variant == 'block-primary' %} + {% set _wrapper_classes = _wrapper_classes|merge(['bg-light p-3-5 pt-0']) %} +{% endif %} +{% if _gutter is not empty %} + {% set _grid_classes = _grid_classes|merge(['g-' ~ _gutter]) %} +{% endif %} +{% if _title is not empty %} + {% set _grid_classes = _grid_classes|merge(['mt-3']) %} +{% endif %} +{% if _equal_height %} + {% set _cols_classes = _cols_classes ~ ' h-100' %} +{% endif %} +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +
+{% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +{% endif %} +
+
+ {% if _items is defined and _items is not empty and _items is iterable %} + {% for _item in _items %} +
+ {% if _item.icon is defined and _item.icon is not empty and _display_icons %} + {% set _icon_attributes = _item.icon.attributes ?: create_attribute() %} + {% set _item = _item|merge({ + icon: _item.icon|merge({ + path: _icon_path, + size: 'l', + attributes: _icon_attributes.addClass(['mb-2', 'icon--primary']), + }) + }) %} + {% include '@oe-bcl/bcl-icon/icon.html.twig' with _item.icon only %} + {% endif %} + {% if _item.title is defined and _item.title is not empty %} +
+ {{- _item.title -}} +
+ {% endif %} + {% if _item.subtitle is defined and _item.subtitle is not empty %} +
+ {{- _item.subtitle -}} +
+ {% endif %} + {% if _item.description is defined and _item.description is not empty %} +

+ {{- _item.description -}} +

+ {% endif %} +
+ {% endfor %} + {% endif %} +
+ {% if _link_more is defined and _link_more is not empty %} +
+ {% include '@oe-bcl/bcl-link/link.html.twig' with _link_more only %} +
+ {% endif %} +
+
+ +{% endapply %} diff --git a/assets/bcl/bcl-featured-media/bcl-featured-media.html.twig b/assets/bcl/bcl-featured-media/bcl-featured-media.html.twig new file mode 100644 index 000000000..6ec3205cd --- /dev/null +++ b/assets/bcl/bcl-featured-media/bcl-featured-media.html.twig @@ -0,0 +1,172 @@ +{% apply spaceless %} + +{# Parameters: + - title (string) (default: '') + - title_tag (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes: (drupal attrs) + - with_text (boolean) (default: false) + - alignment: (string) (default: 'right') + - options ['left', 'right'] + - image: (string) (default: '') + - poster_image: (string) (default: '') + - content: (string) (default: '') + - wrapper_classes: (default: '') + - force_wrapper (boolean) (default: false) - always render wrapper element + - content_classes: (string) (default: '') + - read_more (object) (default: {}) + - description_title (string) (default: '') + - description_title_tag (string) (default: 'h3') + - description_title_attributes (drupal attrs) + - description (string) (default: '') + - ratio: (string) (default: '16x9') + - options ['1x1', '4x3', '16x9', '21x9'] + - sources: (object[]) (default: []) format: [ + { + type: '', + src: '' + } + ] + - tracks: (object[]) (default: []) format: [ + { + kind: '', + label: '', + src: '', + src_lang: '' + } + ] + + Blocks: + - "embedded_media" +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _force_wrapper = force_wrapper ?? false %} +{% set _with_text = with_text ?? false %} +{% set _alignment = alignment|default('right') %} +{% set _image = image|default('') %} +{% set _poster_image = poster_image|default('') %} +{% set _content = content|default('') %} +{% set _wrapper_classes = wrapper_classes|default('') %} +{% set _content_classes = content_classes|default('') %} +{% set _read_more = read_more|default({}) %} +{% set _description_title = description_title|default('') %} +{% set _description_title_tag = description_title_tag|default('h3') %} +{% set _description_title_attributes = description_title_attributes ?: create_attribute() %} +{% set _description = description|default('') %} +{% set _ratio = ratio|default('16x9') %} +{% set _sources = sources|default([]) %} +{% set _tracks = tracks|default([]) %} +{% set _embedded_media = embedded_media|default('') %} + +{% set _classes = 'bcl-featured-item' %} +{% set _col_classes = 'col-12 col-md-6' %} + +{% if _wrapper_classes is not empty %} + {% set _classes = _classes ~ ' ' ~ wrapper_classes %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(["rounded", "overflow-hidden"]) %} + +{% if _image is not empty %} + {% set attributes = attributes.addClass(["d-inline-flex", "flex-wrap"]) %} + {% if _content_classes is not empty %} + {% set _content_classes = _content_classes ~ ' flex-1 w-min-content' %} + {% else %} + {% set _content_classes = 'flex-1 w-min-content' %} + {% endif %} +{% endif %} + +{% if _with_text or _force_wrapper %} +
+{% endif %} +{% if _with_text %} +
+{% endif %} + +{%- if _title is not empty -%} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +{%- endif -%} + +{% if _with_text %} +
+ {%- if _description_title is not empty -%} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _description_title, + title_tag: _description_title_tag, + attributes: _description_title_attributes, + } only %} + {%- endif -%} + {{- _description|default('') -}} + + {% if _read_more is not empty %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _read_more only %} + {% endif %} +
+
+{% endif %} + +
+{% if _embedded_media is not empty %} + {% set _video_classes = "ratio ratio-" ~ _ratio %} +
+ {%- block embedded_media _embedded_media -%} +
+{% elseif _sources is not empty and _sources is iterable %} + +{% else %} + {{ _image }} +{% endif %} + +{% if _content is not empty %} +
+ {{- _content -}} +
+{% endif %} +
+ +{% if _with_text %} +
+
+{% endif %} +{% if _with_text or _force_wrapper %} +
+{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-file/bcl-file-translations.html.twig b/assets/bcl/bcl-file/bcl-file-translations.html.twig new file mode 100644 index 000000000..af1d29bf3 --- /dev/null +++ b/assets/bcl/bcl-file/bcl-file-translations.html.twig @@ -0,0 +1,96 @@ +{% apply spaceless %} + +{# Parameters: + - id (string) (default: language-dropdown-random(10000)) + - label (string) (default: '') + - icon_path (string) (default: '') + - items (string) (default: []) + format: [ + { + extension: '', + language: '', + size: '', + download: {}, - link Object + }, + ] +#} + +{% set _id = id|default('language-dropdown' ~ random(10000)) %} +{% set _label = label|default('') %} +{% set _icon_path = icon_path|default('') %} +{% set _items = items|default([]) %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(['bg-lighter', 'py-3', 'px-4', 'border-top']) %} + +
+
+ {% include '@oe-bcl/bcl-link/link.html.twig' with _label|merge({ + path: '#' ~ _id, + attributes: create_attribute() + .addClass(['standalone']) + .setAttribute('aria-controls', _id) + .setAttribute('data-bs-toggle', 'collapse') + .setAttribute('aria-expanded', 'false') + .setAttribute('role', 'button'), + }) only %} +
+ {% if _items is not empty and _items is iterable %} +
+ {% for _item in _items %} + {% set _item_classes = loop.last ? 'pt-3' : 'py-3 border-bottom' %} +
+ {% if _item.type == 'content' %} + {{ _item.content }} + {% else %} +
+
+ {% if _item.title is not empty %} +

{{ _item.title }}

+ {% endif %} + {% if _item.description is not empty %} +

{{ _item.description }}

+ {% endif %} + {% if _item.language is not empty or _item.meta is not empty %} + + {%- if _item.language is not empty -%} + {{- _item.language -}} + {%- endif -%} + {%- if _item.meta is not empty -%} + + {{- ' ' ~ _item.meta -}} + + {%- endif -%} + + {% endif %} +
+
+ {% set download_attributes = create_attribute() + .setAttribute('download', true) + .setAttribute('target', '_blank') + .addClass(['d-block', 'standalone', 'mt-1']) + %} + {% set _download_item = _item.download|merge({ + icon_position: "after", + icon: { + name: "download", + size: "fluid", + path: _icon_path, + }|merge(_item.download.icon|default({})), + attributes: download_attributes.merge(_item.download.attributes|default(create_attribute())) + }) %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _download_item only %} +
+
+ {% endif %} +
+ {% endfor %} +
+ {% endif %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-file/bcl-file.html.twig b/assets/bcl/bcl-file/bcl-file.html.twig new file mode 100644 index 000000000..1af0a7fd2 --- /dev/null +++ b/assets/bcl/bcl-file/bcl-file.html.twig @@ -0,0 +1,165 @@ +{% apply spaceless %} + +{# + Parameters: + - title (string) (default: '') + - title_tag (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - item_title (string) (default: '') + - icon (icon Object) (default: {}) + - icon_inline (boolean) (deafult: true) + - text (string) (default: '') + - content (string) (default: '') + - image (object) (default: {}) - format: { + path: '', + alt: '', + } + - badges (badge[]) (default: []) + - meta (string) (default: '') + - language (string) (default: '') + - variant (string) (default: 'default') + - options: ['default', 'card'] + - download (link Object) (default: {}) + - translation (file translation Object) (default: {}) format: { + id: '', + label: {}, - link Object + items: [ + { + extension: '', + language: '', + size: '', + download: {}, - link Object + }, + } + - icon_path (string) (default: '') + - attributes (drupal attrs) +#} + +{# Internal properties #} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _item_title = item_title|default('') %} +{% set _icon = icon|default({}) %} +{% set _icon_inline = icon_inline ?? true %} +{% set _text = text|default('') %} +{% set _content = content|default('') %} +{% set _image = image|default({}) %} +{% set _badges = badges|default([]) %} +{% set _meta = meta|default('') %} +{% set _language = language|default('') %} +{% set _variant = variant|default('default') %} +{% set _download = download|default({}) %} +{% set _translation = translation|default({}) %} +{% set _icon_path = icon_path|default('') %} + +{% set _classes = ['bcl-file'] %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +{% if _icon is not empty %} + {% set _container_classes = _container_classes ~ ' ms-2-5' %} + {% set _icon = _icon|merge({ + attributes: create_attribute().addClass(['mt-1', 'icon--file']) + }) %} +{% endif %} + +{% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +{% endif %} + +{% set attributes = attributes.addClass(['border', 'rounded']) %} + +{% set _container_classes = 'd-md-flex flex-grow-1' %} + +
+ {% if _variant == 'card' %} +
+
+ {% if _icon is not empty %} + {%- include '@oe-bcl/bcl-icon/icon.html.twig' with _icon|merge({ + path: _icon_path, + }) only -%} + {% endif %} +
+
+ {% if _item_title is not empty %} +

{{ _item_title }}

+ {% endif %} + {% if _text is not empty %} +

{{ _text }}

+ {% endif %} + {% if _content is not empty %} + {{ _content }} + {% endif %} +
+
+ {% endif %} +
+
+ {% if _icon is not empty and _variant == 'default' %} +
+ {% if _icon is not empty %} + {%- include '@oe-bcl/bcl-icon/icon.html.twig' with _icon|merge({ + path: _icon_path, + }) only -%} + {% endif %} +
+ {% endif %} +
+
+ {% if _item_title is not empty and _variant == 'default' %} +

{{ _item_title }}

+ {% endif %} + {% if _language is not empty or _meta is not empty %} + + {%- if _language is not empty -%} + {{- _language -}} + {%- endif -%} + {%- if _meta is not empty -%} + + {{- ' ' ~ _meta -}} + + {%- endif -%} + + {% endif %} +
+ {% set download_attributes = create_attribute() + .setAttribute('download', 'true') + .setAttribute('target', '_blank') + .addClass(['standalone', 'align-self-center', 'd-inline-block', 'mt-1', 'mt-md-0', 'flex-shrink-0']) %} + {% set _download = _download|merge({ + icon_position: "after", + icon: { + name: "download", + size: "fluid", + path: _icon_path, + }|merge(_download.icon|default({})), + attributes: download_attributes.merge(_download.attributes|default(create_attribute())) + }) %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _download only %} +
+
+
+ {% if _translation is not empty %} + {% include '@oe-bcl/bcl-file/file-translations.html.twig' with _translation|merge({ + icon_path: _icon_path + }) only %} + {% endif %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-footer/bcl-footer.html.twig b/assets/bcl/bcl-footer/bcl-footer.html.twig new file mode 100644 index 000000000..57f0d8961 --- /dev/null +++ b/assets/bcl/bcl-footer/bcl-footer.html.twig @@ -0,0 +1,90 @@ +{% apply spaceless %} + +{# Parameters: + - variant (string) (default: 'neutral') + - options: ['eu', 'ec', 'neutral'] + - rows (object[]) (default: []) - format: + [ + { + extra_classes: "" + cols: [ + { + classes: "", + items: [ + { + type: "links" or "content" or "image", + -- for type "links" -- + links: (link[]), + + -- for type "image" -- + path: "", + alt: "", + classes: "" + + -- for type "content" -- + content: "", + }, + ] + } + ] + } + ] + - attributes (drupal attrs) +#} + +{% set _variant = variant|default('neutral') %} +{% set _rows = rows|default([]) %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(['bcl-footer', 'bcl-footer--' ~ _variant]) %} + + + +{% endapply %} diff --git a/assets/bcl/bcl-form-input/bcl-form-input.html.twig b/assets/bcl/bcl-form-input/bcl-form-input.html.twig new file mode 100644 index 000000000..559a1f73b --- /dev/null +++ b/assets/bcl/bcl-form-input/bcl-form-input.html.twig @@ -0,0 +1,183 @@ +{% apply spaceless %} + +{# + Parameters: + - id (string) (default: '') + - input_type (string) (default: 'text') + - label (string) (default: '') + - required (boolean) (default: false) + - checked (boolean) (default: false) + - hidden_label (boolean) (default: false) + - disabled (boolean) (default: false) + - readonly (boolean) (default: false) + - invalid (boolean) (default: false) + - valid (boolean) (default: false) + - invalid_feedback (string) (default: '') + - valid_feedback (string) (default: '') + - floating (boolean) (default: false) + - helper_text (string) (default: '') + - helper_text_id (string) (default: '') + - placeholder (string) (default: '') + - horizontal (boolean) (default: false) + - horizontal_class (string) (default: col-sm-10) + - horizontal_label_class (string) (default: col-sm-2) + - switch (boolean) (default: false) + - toggle (boolean) (default: false) + - toggle_variant (string) (default: 'primary') + - remove_wrapper (boolean) (default: false) + - attributes (drupal attrs) +#} + +{% set _id = id|default('') %} +{% set _input_type = input_type|default('text') %} +{% set _label = label|default('') %} +{% set _required = required ?? false %} +{% set _checked = checked ?? false %} +{% set _hidden_label = hidden_label ?? false %} +{% set _disabled = disabled ?? false %} +{% set _readonly = readonly ?? false %} +{% set _invalid = invalid ?? false %} +{% set _valid = valid ?? false %} +{% set _invalid_feedback = invalid_feedback|default('') %} +{% set _valid_feedback = valid_feedback|default('') %} +{% set _floating = floating ?? false %} +{% set _helper_text = helper_text|default('') %} +{% set _helper_text_id = helper_text_id|default('') %} +{% set _placeholder = placeholder|default('') %} +{% set _horizontal = horizontal ?? false %} +{% set _horizontal_class = horizontal_class|default('col-sm-10') %} +{% set _horizontal_label_class = horizontal_label_class|default('col-sm-2') %} +{% set _switch = switch ?? false %} +{% set _toggle = toggle ?? false %} +{% set _toggle_variant = toggle_variant|default('primary') %} +{% set _remove_wrapper = remove_wrapper ?? false %} + +{% set _label_block = false %} +{% set _label_class = 'form-label' %} +{% set _classes = ['form-control'] %} + +{% if input_type == 'range' %} + {% set _classes = ['form-range'] %} +{% endif %} +{% if _input_type == 'checkbox' or _input_type == 'radio' %} + {% set _classes = ['form-check-input'] %} + {% set _label_class = 'form-check-label' %} +{% endif %} +{% if _invalid is not empty %} + {% set _classes = _classes|merge(['is-invalid']) %} +{% endif %} +{% if _valid is not empty %} + {% set _classes = _classes|merge(['is-valid']) %} +{% endif %} +{% if _horizontal %} + {% set _label_class = 'col-form-label ' ~ _horizontal_label_class %} +{% endif %} +{% if _hidden_label %} + {% set _label_class = _label_class ~ ' visually-hidden' %} +{% endif %} +{% if _toggle %} + {% set _label_class = _label_class ~ ' btn btn-' ~ _toggle_variant %} + {% set _classes = _classes|merge(['btn-check']) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes).setAttribute('type', _input_type) %} + +{% if _id %} + {% set attributes = attributes.setAttribute('id', _id) %} +{% endif %} + +{% if _required %} + {% set attributes = attributes.setAttribute('required', true) %} +{% endif %} + +{% if _disabled %} + {% set attributes = attributes.setAttribute('disabled', true) %} +{% endif %} + +{% if _readonly %} + {% set attributes = attributes.setAttribute('readonly', true) %} +{% endif %} + +{% if _checked %} + {% set attributes = attributes.setAttribute('checked', true) %} +{% endif %} + +{% if _placeholder is not empty %} + {% set attributes = attributes.setAttribute('placeholder', _placeholder) %} +{% endif %} + +{% if _helper_text_id is not empty %} + {% set attributes = attributes.setAttribute('aria-describedby', _helper_text_id) %} +{% endif %} + +{% if _label is not empty %} + {% set _label_block %} + + {% endset %} +{% endif %} + +{% if (_floating or _horizontal or _input_type == 'checkbox' or _input_type == 'radio') and + not _toggle and + not _remove_wrapper +%} + {% set _wrapper_class = _floating ? 'form-floating' : '' %} +{% if (_input_type == 'checkbox' or _input_type == 'radio') %} + {% set _wrapper_class = 'form-check' %} + {% if _switch %} + {% set _wrapper_class = _wrapper_class ~ ' form-switch' %} + {% endif %} +{% endif %} +{% if _wrapper_class is not empty %} +
+{% endif %} +{% endif %} +{% if _label_block and _floating == false and _input_type != 'checkbox' and _input_type != 'radio' %} + {{ _label_block|raw }} +{% endif %} +{% if _horizontal and floating == false %} +
+{% endif %} + +{% if _horizontal and floating == false %} +
+{% endif %} +{% if _label_block and (_floating or _input_type == 'checkbox' or _input_type == 'radio') %} + {{ _label_block|raw }} +{% endif %} +{% if _invalid_feedback is not empty %} +
+ {{- _invalid_feedback -}} +
+{% endif %} +{% if _valid_feedback is not empty %} +
+ {{- _valid_feedback -}} +
+{% endif %} +{% if _helper_text is not empty %} +
+ {{- _helper_text -}} +
+{% endif %} +{% if _wrapper_class is not empty %} +
+{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-form/bcl-form.html.twig b/assets/bcl/bcl-form/bcl-form.html.twig new file mode 100644 index 000000000..c3e4b51df --- /dev/null +++ b/assets/bcl/bcl-form/bcl-form.html.twig @@ -0,0 +1,150 @@ +{% apply spaceless %} + +{# Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - helper_text (string) (default: '') + - antispam (string) (default: '') + - items (object[ object[] ]) (default: []) format: [ + [ + { + ...object of type form-Input + wrapper_classes: (string) (default: '') OR + type: fieldset (must be the first element of the array, it will group all + the inputs in the array in a fieldset element) + classes: (string) (default: ''), + legend: (string) (default: ''), + fieldset_classes: (string) (default: ''), + legend_classes: (string) (default: ''), + }, + ], + - submit (object) (default: {}) button or button[] + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _helper_text = helper_text|default('') %} +{% set _antispam = antispam|default('') %} +{% set _items = items|default([]) %} +{% set _submit = submit|default({}) %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +{% endif %} + +{% if _helper_text is not empty %} +

{{ _helper_text }}

+{% endif %} + +
+{% if _items is not empty and _items is iterable %} +{% for _item_group in _items %} + {% set _group_classes = '' %} + {% set _legend_classes = '' %} + {% set _fieldset_classes = '' %} + {% if _item_group is not empty and _item_group is iterable %} + {% if _item_group[0].classes is defined and _item_group[0].classes is not empty %} + {% set _group_classes = _item_group[0].classes %} + {% endif %} + {# fieldset #} + {% if _item_group[0].type == 'fieldset' %} + {% if _item_group[0].fieldset_classes is defined and _item_group[0].fieldset_classes is not empty %} + {% set _fieldset_classes = _item_group[0].fieldset_classes %} + {% endif %} +
+ {% if _item_group[0].legend is defined and _item_group[0].legend is not empty %} + {% if _item_group[0].legend_classes is defined and _item_group[0].legend_classes is not empty %} + {% set _legend_classes = _item_group[0].legend_classes %} + {% endif %} + + {{- _item_group[0].legend -}} + + {% endif %} + {% endif %} + {% if _group_classes is not empty %} +
+ {% endif %} + {% for _item in _item_group %} + {% if _item.type != 'fieldset' %} + {# grouping input fields wrapper #} + {% if _item.wrapper_classes is defined and _item.wrapper_classes is not empty %} +
+ {% endif %} + {# textarea #} + {% if _item.type == 'textarea' %} + {% include '@oe-bcl/bcl-textarea/textarea.html.twig' with _item only %} + {# select #} + {% elseif _item.type == 'select' %} + {% include '@oe-bcl/bcl-select/select.html.twig' with _item only %} + {% else %} + {# any other input type #} + {% include '@oe-bcl/bcl-form-input/form-input.html.twig' with _item only %} + {% endif %} + {% if _item.wrapper_classes is defined and _item.wrapper_classes is not empty %} +
+ {% endif %} + {% endif %} + {% endfor %} + {% if _group_classes is not empty %} +
+ {% endif %} + {% if _item_group[0].type == 'fieldset' %} +
+ {% endif %} + {% endif %} +{% endfor %} +{% endif %} +{% if _antispam is not empty %} +
+
+ {{ _antispam }} +
+
+{% endif %} +{# submit #} +{% if _submit is not empty %} + {% if _submit.items is empty %} + {% set _submit = _submit|merge({ + items: [_submit] + }) %} + {% endif %} + {% if _submit.wrapper is defined and _submit.wrapper is not empty %} +
+ {% endif %} + {% for _item in _submit.items %} + {% include '@oe-bcl/bcl-button/button.html.twig' with _item only %} + {% endfor %} + {% if _submit.wrapper is defined and _submit.wrapper is not empty %} +
+ {% endif %} +{% endif %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-gallery/bcl-gallery-item.html.twig b/assets/bcl/bcl-gallery/bcl-gallery-item.html.twig new file mode 100644 index 000000000..53274fbd5 --- /dev/null +++ b/assets/bcl/bcl-gallery/bcl-gallery-item.html.twig @@ -0,0 +1,65 @@ +{% apply spaceless %} + +{# +Parameters: + - item (object) (default: {}) + format: { + thumbnail (string) img path + media: (string) tag + caption (string) + caption_title (string) + is_playable (boolean) + } + - carousel_id (string) (default: '') + - modal_id (string) (default: '') + - carousel_anchor (string) (default: '') + - icon_path (string) (default: '') + - attributes (drupal attrs) +#} + +{% set _item = item|default({}) %} +{% set _carousel_id = carousel_id|default('') %} +{% set _modal_id = modal_id|default('') %} +{% set _icon_path = icon_path|default('') %} +{% set _carousel_anchor = carousel_anchor|default('') %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(['bcl-gallery__item', 'd-block', 'w-100', 'img-fluid']) + .setAttribute('data-bs-target', '#' ~ _carousel_id) + .setAttribute('data-bs-slide-to', _carousel_anchor) + .setAttribute('tabindex', '0') +%} + + + + {{ _item.thumbnail }} + + +{% endapply %} diff --git a/assets/bcl/bcl-gallery/bcl-gallery.html.twig b/assets/bcl/bcl-gallery/bcl-gallery.html.twig new file mode 100644 index 000000000..02dacb5dd --- /dev/null +++ b/assets/bcl/bcl-gallery/bcl-gallery.html.twig @@ -0,0 +1,195 @@ +{% apply spaceless %} + +{# +Parameters: + - id (string) (default: gallery-random(10000)) + - title (string) (default: '') + - title_tag (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - counter (string) (default: '') + - toggle_collapsed (string) (default: '') + - toggle_expanded (string) (default: '') + - next_label (string) (default: 'Next') + - prev_label (string) (default: 'Previous') + - max_visible_thumbnails (int) (default: 5) + - items (object[]) format: [ + { + thumbnail (string) img path + media: (string) tag + caption (string) + caption_title (string) + } + ] + - icon_path (string) (default: '') + - attributes (drupal attrs) + + Blocks: + carousel +#} + +{% set _id = id|default('gallery-' ~ random(10000)) %} +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _counter = counter|default('') %} +{% set _toggle_collapsed = toggle_collapsed|default('') %} +{% set _toggle_expanded = toggle_expanded|default('') %} +{% set _next_label = next_label|default('Next') %} +{% set _prev_label = prev_label|default('Previous') %} +{% set _max_visible_thumbnails = max_visible_thumbnails|default(5) %} +{% set _items = items|default([]) %} +{% set _icon_path = icon_path|default('') %} +{% set _carousel_id = "carousel" ~ _id|capitalize %} +{% set _modal_id = "modal" ~ _id|capitalize %} +{% set _collapse_id = "collapse" ~ _id|capitalize %} +{% set _carousel_items = [] %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass('bcl-gallery') %} + +{% if _items is not empty and _items is iterable %} +
+ {% if _title is not empty or _counter is not empty %} +
+ {% if _title is not empty %} +
+ {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +
+ {% endif %} + {%- if _counter is not empty -%} +
+ {{- _counter|replace({'%d': _items|length}) -}} +
+ {%- endif -%} +
+ {% endif %} + + +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-glossary/bcl-glossary-detail.html.twig b/assets/bcl/bcl-glossary/bcl-glossary-detail.html.twig new file mode 100644 index 000000000..2c717db5f --- /dev/null +++ b/assets/bcl/bcl-glossary/bcl-glossary-detail.html.twig @@ -0,0 +1,43 @@ +{% extends '@oe-bcl/bcl-base-templates/content-type.html.twig' %} + +{% block content %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: 'Description', + title_tag: 'h2', + } only %} + +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse + volutpat ultricies massa, a dapibus libero porta nec. Sed facilisis dictum vestibulum. + Fusce commodo hendrerit diam, pretium tempus leo varius sit amet. + Etiam interdum, orci at sagittis luctus, lorem libero tempus mauris, a fermentum libero + orci semper lacus. Duis tristique fringilla magna, eu egestas dolor molestie non. + Fusce commodo hendrerit diam, pretium tempus leo varius sit amet. + Etiam interdum, orci at sagittis luctus, lorem libero tempus mauris, a fermentum libero orci semper lacus. + Duis tristique fringilla magna, eu egestas dolor molestie non.

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse volutpat ultricies massa, + a dapibus libero porta nec. Sed facilisis dictum vestibulum. Fusce commodo hendrerit diam, pretium tempus + leo varius sit amet. Etiam interdum, orci at sagittis luctus, lorem libero tempus mauris, a fermentum libero + orci semper lacus. Duis tristique fringilla magna, eu egestas dolor molestie non.

+

Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Suspendisse volutpat ultricies massa, a dapibus libero porta nec. + Sed facilisis dictum vestibulum. + Fusce commodo hendrerit diam, pretium tempus leo varius sit amet. Etiam interdum, orci at sagittis luctus, + lorem libero tempus mauris, a fermentum libero orci semper lacus. Duis tristique fringilla magna, + eu egestas dolor molestie non.

+ + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: 'File Downloads', + title_tag: 'h2', + attributes: create_attribute().addClass('mt-5', 'mb-4'), + } only %} + + {% for file in files %} + {% if loop.last %} + {% set file_classes = 'mt-4' %} + {% endif %} +
+ {% include '@oe-bcl/bcl-file/file.html.twig' with file only %} +
+ {% endfor %} + +{% endblock %} diff --git a/assets/bcl/bcl-glossary/bcl-glossary-listing.html.twig b/assets/bcl/bcl-glossary/bcl-glossary-listing.html.twig new file mode 100644 index 000000000..f67f470cb --- /dev/null +++ b/assets/bcl/bcl-glossary/bcl-glossary-listing.html.twig @@ -0,0 +1,19 @@ +{% extends '@oe-bcl/bcl-base-templates/listing-page.html.twig' %} + +{% block content_row %} + {% include '@oe-bcl/bcl-pagination/pagination.html.twig' with glossary only %} +
+
+ {% include '@oe-bcl/bcl-select/select.html.twig' with sortBy only %} + {% include '@oe-bcl/bcl-select/select.html.twig' with itemsPerPage only %} +
+
+{% endblock %} + +{% block content_top %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: 'Starting with "A" (48)', + title_tag: 'h2', + } only %} + +{% endblock %} \ No newline at end of file diff --git a/assets/bcl/bcl-group/bcl-group-landing.html.twig b/assets/bcl/bcl-group/bcl-group-landing.html.twig new file mode 100644 index 000000000..34a1bceca --- /dev/null +++ b/assets/bcl/bcl-group/bcl-group-landing.html.twig @@ -0,0 +1,101 @@ +{% extends "@oe-bcl/bcl-base-templates/content-type.html.twig" %} + +{% block banner %} +
+ {% if banner is not empty %} +
+ {% if banner.image is not empty %} + {{ banner.image.alt }} + {% endif %} + {% if banner.title is not empty %} +
+

{{ banner.title }}

+ {% if banner.actions is not empty and banner.actions is iterable %} +
+ {% for _action in banner.actions %} + {% if _action.type == "link" %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _action only %} + {% elseif _action.type == "button" %} + {% include '@oe-bcl/bcl-button/button.html.twig' with _action only %} + {% elseif _action.type == "dropdown" %} + {% include '@oe-bcl/bcl-dropdown/dropdown.html.twig' with _action only %} + {% endif %} + {% endfor %} +
+ {% endif %} +
+ {% endif %} +
+ {% endif %} + {% include '@oe-bcl/bcl-navigation/navigation.html.twig' with navigation only %} + {% if banner_description is not empty and contact is not empty %} + {% include '@oe-bcl/bcl-link/link.html.twig' with banner_description.collapse_trigger only %} + + {% endif %} +
+{% endblock %} + +{% block content %} + {% if recent is not empty and members is not empty %} +
+
+

{{ recent.title }}

+ {% include '@oe-bcl/bcl-recent-activities/recent-activities.html.twig' with recent.block_data only %} +
+
+

{{ members.title}}

+ {% if members.profiles is not empty and members.profiles is iterable %} + {% for _profile in members.profiles %} + {% include '@oe-bcl/bcl-user/user-compact.html.twig' with _profile only %} + {% endfor %} + {% endif %} + {% if members.more_link is not empty %} + {% include '@oe-bcl/bcl-link/link.html.twig' with members.more_link only %} + {% endif %} +
+
+ {% endif %} + {% if contributions is not empty %} +

{{ contributions.title}}

+ {% if contributions.listing is not empty %} + {% include '@oe-bcl/bcl-listing/listing.html.twig' with contributions.listing only %} + {% endif %} + {% endif %} +{% endblock %} diff --git a/assets/bcl/bcl-group/bcl-group.html.twig b/assets/bcl/bcl-group/bcl-group.html.twig new file mode 100644 index 000000000..4fd1086ee --- /dev/null +++ b/assets/bcl/bcl-group/bcl-group.html.twig @@ -0,0 +1,27 @@ +{% extends "@oe-bcl/bcl-base-templates/listing-page.html.twig" %} + +{% block banner %} +
+
+
+

{{ banner.main_title }}

+ {% if banner.actions is not empty and banner.actions is iterable %} +
+ {% for _action in banner.actions %} + {% if _action.type == "link" %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _action only %} + {% elseif _action.type == "button" %} + {% include '@oe-bcl/bcl-button/button.html.twig' with _action only %} + {% elseif _action.type == "dropdown" %} + {% include '@oe-bcl/bcl-dropdown/dropdown.html.twig' with _action only %} + {% endif %} + {% endfor %} +
+ {% endif %} +
+ {% if navigation is not empty %} + {% include '@oe-bcl/bcl-navigation/navigation.html.twig' with navigation only %} + {% endif %} +
+
+{% endblock %} diff --git a/assets/bcl/bcl-header/bcl-header.html.twig b/assets/bcl/bcl-header/bcl-header.html.twig new file mode 100644 index 000000000..d61f729e7 --- /dev/null +++ b/assets/bcl/bcl-header/bcl-header.html.twig @@ -0,0 +1,115 @@ +{% apply spaceless %} + +{# Parameters: + - variant (string) (default: 'neutral') + - options: ['ec', 'eu', 'neutral'] + - navbar (Navbar object) (default: {}) + - project_logo (object) (default: {}) + format: { + path: '', + alt: '', + classes: '' + } + - site_name (string) (default: '') + - project_link (string) (default: '') + - head (Navbar object) (default: {}) + - breadcrumbs (Breadcrumbs object) (default: {}) + - language_modal (object) (default: {}) + - light (boolean) (default: false) + - modals (modal[]) (default: []) + - attributes (drupal attrs) +#} + +{% set _variant = variant|default('neutral') %} +{% set _navbar = navbar|default({}) %} +{% set _project_logo = project_logo|default({}) %} +{% set _site_name = site_name|default('') %} +{% set _project_link = project_link|default('') %} +{% set _head = head|default({}) %} +{% set _breadcrumbs = breadcrumbs|default({}) %} +{% set _language_modal = language_modal|default({}) %} +{% set _light = light ?? false %} +{% set _modals = modals|default([]) %} + +{% set _site_name_classes = 'bcl-header__site-name' %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(['bcl-header', 'bcl-header--' ~ _variant]) %} + +{% if site_name_classes is not empty %} + {% set _site_name_classes = _site_name_classes ~ ' ' ~ site_name_classes %} +{% endif %} + +{% set _project_classes = 'bcl-header__project' %} +{% if _light is not empty %} + {% set _project_classes = _project_classes ~ ' light' %} +{% endif %} + +
+ + {% if _head is not empty %} + {% include '@oe-bcl/bcl-navbar/navbar.html.twig' with _head only %} + {% endif %} + + + {% if _project_logo is not empty or _site_name is not empty %} + + {% endif %} + + + {% if _navbar is not empty %} + {% include '@oe-bcl/bcl-navbar/navbar.html.twig' with _navbar only %} + {% endif %} + + + {% if _breadcrumbs is not empty %} +
+ {% include '@oe-bcl/bcl-breadcrumb/breadcrumb.html.twig' with _breadcrumbs only %} +
+ {% endif %} +
+ +{% for modal in _modals %} + {% include '@oe-bcl/bcl-modal/modal.html.twig' with modal only %} +{% endfor %} + +{% if _language_modal is not empty %} + {% include '@oe-bcl/bcl-language-list/language-list.html.twig' with _language_modal only %} +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-heading/bcl-heading.html.twig b/assets/bcl/bcl-heading/bcl-heading.html.twig new file mode 100644 index 000000000..94e382b27 --- /dev/null +++ b/assets/bcl/bcl-heading/bcl-heading.html.twig @@ -0,0 +1,40 @@ +{% apply spaceless %} + +{# Parameters: + - title (string) (default: '') + - title_tag (string) (default: 'h2') + - title_link: (link object) (default: {}) + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if attributes.class is empty %} + {% set attributes = attributes.addClass(['mb-4']) %} +{% endif %} + +{% set attributes = attributes.addClass(['bcl-heading']) %} + +{% if _title_link is not empty and _title is not empty and _title_link.label is empty %} + {% set _title_link = _title_link|merge({ label: _title }) %} +{% endif %} + +{% if _title is not empty or _title_link is not empty %} +<{{ _title_tag }} + {{- attributes -}} +> +{%- if _title_link is not empty -%} + {% include '@oe-bcl/bcl-link/link.html.twig' with _title_link|merge({ standalone: true }) only %} +{%- else -%} + {{- _title -}} +{%- endif %} + +{% endif -%} + +{% endapply %} diff --git a/assets/bcl/bcl-icon/bcl-icon.html.twig b/assets/bcl/bcl-icon/bcl-icon.html.twig new file mode 100644 index 000000000..cf5c7e24d --- /dev/null +++ b/assets/bcl/bcl-icon/bcl-icon.html.twig @@ -0,0 +1,36 @@ +{% apply spaceless %} + +{# Parameters: + - name (string) (default: '') + - path (string) (default: '') + - size (string) (default: 's') + - options ['2xs', 'xs', 's', 'm', 'l', 'xl', '2xl', 'fluid'] + - transformation (string) (default: '') + - options ['rotate-90', 'rotate-180', 'rotate-270', 'flip-horizontal', 'flip-vertical'] + - attributes (drupal attrs) +#} + +{% set _name = name|default('') %} +{% set _path = path|default('') %} +{% set _size = size|default('s') %} +{% set _transformation = transformation|default('') %} + +{% set _classes = ['bi', 'icon--' ~ _size] %} + +{% if _transformation is not empty %} + {% set _classes = _classes|merge(['icon--' ~ _transformation]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + + + + + +{% endapply %} diff --git a/assets/bcl/bcl-inpage-navigation/bcl-inpage-navigation.html.twig b/assets/bcl/bcl-inpage-navigation/bcl-inpage-navigation.html.twig new file mode 100644 index 000000000..943f4fd92 --- /dev/null +++ b/assets/bcl/bcl-inpage-navigation/bcl-inpage-navigation.html.twig @@ -0,0 +1,80 @@ +{% apply spaceless %} + +{# +Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - links: (link[]) (default: []) + - id (string) (default: bcl-inpage-navigation-random(10000)) + - dropdown_id (string) (default: bcl-inpage-navigation-dropdown-random(10000)) + - dynamic_active: (boolean) (default: false) + - icon_path (string) (default: '') + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _links = links|default([]) %} +{% set _id = id|default('bcl-inpage-navigation-' ~ random(10000)) %} +{% set _icon_path = icon_path|default('') %} +{% set _dropdown_id = dropdown_id|default('bcl-inpage-navigation-dropdown' ~ random(10000)) %} +{% set _dyanmic_active = dynamic_active|default(false) %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(['bcl-inpage-navigation', 'position-sticky']).setAttribute('id', _id) %} + +{% if not attributes.hasAttribute('aria-label') and not attributes.hasAttribute('aria-labelledby') %} + {% set attributes = attributes.setAttribute('aria-labelledby', _dropdown_id) %} +{% endif %} + +{% set title_attributes = _title_attributes.addClass(['mb-0', 'd-none', 'd-md-block']) %} +{% set _button_content %} + {{ _title }} + {%- include '@oe-bcl/bcl-icon/icon.html.twig' with { + name: 'chevron-down', + size: 's', + path: _icon_path, + } only -%} +{% endset %} + +{% set _classes = [] %} + +{% if _dyanmic_active %} + {% set _classes = _classes|merge(['dynamic-active']) %} +{% endif %} + + + {% set trigger_attributes = create_attribute() + .setAttribute('aria-expanded', 'false') + .setAttribute('type', 'button') + .setAttribute('id', _dropdown_id) + .setAttribute('data-bs-toggle', 'dropdown') + .addClass(['dropdown-toggle', 'h2', 'd-md-none']) %} + {% include '@oe-bcl/bcl-button/button.html.twig' with { + label: _button_content, + clean_class: true, + attributes: trigger_attributes, + } only %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} + + + +{% endapply %} diff --git a/assets/bcl/bcl-landing-page/bcl-landing-page.html.twig b/assets/bcl/bcl-landing-page/bcl-landing-page.html.twig new file mode 100644 index 000000000..63f81ac33 --- /dev/null +++ b/assets/bcl/bcl-landing-page/bcl-landing-page.html.twig @@ -0,0 +1,59 @@ +{% extends "@oe-bcl/bcl-base-templates/content-type.html.twig" %} + +{% block banner %} + {% if banner is defined %} + {% include '@oe-bcl/bcl-banner/banner.html.twig' with banner only %} + {% endif %} +{% endblock %} + +{% block content %} + +
+ {% if featured_section is defined %} +
+

{{ featured_section.title }}

+
+
+ {{ featured_section.content }} +
+
+ {% include '@oe-bcl/bcl-featured-media/featured-media.html.twig' with featured_section.featured_media only %} +
+
+
+ {% endif %} + + {% if listing_section is defined %} +
+ {% include '@oe-bcl/bcl-listing/listing.html.twig' with listing_section only %} +
+ {% endif %} + + {% if inpage_banner is defined %} +
+ {% include '@oe-bcl/bcl-banner/banner.html.twig' with inpage_banner only %} +
+ {% endif %} + + {% if activity_featured is defined %} +
+

{{ activity_featured.title }}

+
+
+ {{ activity_featured.content }} +
+
+ {% include '@oe-bcl/bcl-featured-media/featured-media.html.twig' with activity_featured.featured_media only %} +
+
+
+ {% endif %} + + {% if activity_listing is defined %} +
+ {% include '@oe-bcl/bcl-listing/listing.html.twig' with activity_listing only %} +
+ {% endif %} +
+ +{% endblock %} diff --git a/assets/bcl/bcl-language-list/bcl-language-list-grid.html.twig b/assets/bcl/bcl-language-list/bcl-language-list-grid.html.twig new file mode 100644 index 000000000..acf3bb3bb --- /dev/null +++ b/assets/bcl/bcl-language-list/bcl-language-list-grid.html.twig @@ -0,0 +1,68 @@ +{% apply spaceless %} + +{# + Parameters: + - items (array) (default: []) format: [ + { + lang (string) + label (string) + path (string) + active (boolean) + } + ] + - category (string) (default: '') + - icon_path (string) (default: '') +#} + +{% set _items = items|default([]) %} +{% set _category = category|default('') %} +{% set _icon_path = icon_path|default('') %} + +{% set _columns = [] %} +{% set _columns = _columns|merge([_items|slice(0, (items|length / 2)|round(0, 'ceil'))]) %} +{% set _columns = _columns|merge([_items|slice((items|length / 2)|round(0, 'ceil'), items|length)]) %} + +
+ {% if _category is not empty %} +
{{ _category }}
+ {% endif %} + {% if _columns is not empty and _columns is iterable %} +
+ {% for _column in _columns %} +
+ {% for _item in _column %} + {% if _item.attributes is empty %} + {% set _item = _item|merge({ + attributes: create_attribute() + }) %} + {% endif %} + {% set _item = _item|merge({ + attributes: _item.attributes.addClass(['w-100', 'mb-2-5', 'btn', 'w-100']) + }) %} + {% if _item.active %} + {% set _item = _item|merge({ + icon: { + name: "check2", + path: _icon_path, + }, + attributes: _item.attributes.addClass(['selected', 'justify-content-between']) + }) %} + {% else %} + {% set _item = _item|merge({ + attributes: _item.attributes.addClass('justify-content-start') + }) %} + {% endif %} + {% if _item.lang is not empty %} + {% set _item = _item|merge({ + attributes: _item.attributes.setAttribute('lang', _item.lang).setAttribute('hreflang', _item.lang) + }) %} + {% endif %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _item only %} + {% endfor %} +
+ {% endfor %} +
+ {% endif %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-language-list/bcl-language-list-modal.html.twig b/assets/bcl/bcl-language-list/bcl-language-list-modal.html.twig new file mode 100644 index 000000000..728f35c34 --- /dev/null +++ b/assets/bcl/bcl-language-list/bcl-language-list-modal.html.twig @@ -0,0 +1,58 @@ +{% extends "@oe-bcl/bcl-modal/modal.html.twig" %} + +{% if _title is not empty %} + {% set header = true %} +{% endif %} + +{% if _variant == 'neutral' %} + {% set size = "xl" %} + {% set fullscreen_responsive = "md" %} +{% else %} + {% set size = "fullscreen" %} +{% endif %} + +{% set overlay = false %} +{% set inside_container = true %} + +{% set attributes = attributes.addClass(['bcl-language-list-modal', 'bcl-language-list-modal--' ~ _variant]) %} + +{% block header %} + {% if size == 'fullscreen' %} +
+ {% if variant == 'eu' or variant == 'ec' %} +
+
+ {% endif %} +
+ {% endif %} +
+ {% set _title_classes = 'modal-title mb-0' %} + {% if _icon_path is not empty %} + {% set _title_classes = _title_classes ~ ' ms-2' %} + {% include '@oe-bcl/bcl-icon/icon.html.twig' with { + name: 'globe2', + path: _icon_path + } only %} + {% endif %} +
{{ _title }}
+
+ + {% if size == 'fullscreen' %} +
+ {% if variant == 'eu' or variant == 'ec' %} +
+
+ {% endif %} +
+ {% endif %} +{% endblock %} + +{% block body %} + {% include '@oe-bcl/bcl-language-list/language-list.html.twig' with { + attributes: create_attribute() + } %} +{% endblock %} diff --git a/assets/bcl/bcl-language-list/bcl-language-list.html.twig b/assets/bcl/bcl-language-list/bcl-language-list.html.twig new file mode 100644 index 000000000..df790ef6c --- /dev/null +++ b/assets/bcl/bcl-language-list/bcl-language-list.html.twig @@ -0,0 +1,111 @@ +{% apply spaceless %} + +{# Parameters: + - overlay (boolean) (default: false) + - inside_container (boolean) (default: false) + - variant (string) (default: 'neutral') + - title (string) (default: '') + - logo (object) (default: {}) format: { + path (string), + alt (string), + class (string), + } + - icon_path (string) (default: '') + - eu_category (string) (default: ''); + - non_eu_category (string) (default: '') + - items (array) (default: []) + - "lang" (string) (default: '') + - "label" (string) (default: '') + - "path" (string) (default: '') + - "active (boolean) (default: false) + - non_eu_items (array) (default: []) + - "lang" (string) (default: '') + - "label" (string) (default: '') + - "path" (string) (default: '') + - "active (boolean) (default: false) + - close_label (string) (default: '') +#} + +{% set _overlay = overlay ?? false %} +{% set _inside_container = inside_container ?? false %} +{% set _variant = variant|default('neutral') %} +{% set _title = title|default('') %} +{% set _logo = logo|default({}) %} +{% set _icon_path = icon_path|default('') %} +{% set _eu_category = eu_category|default('') %} +{% set _non_eu_category = non_eu_category|default('') %} +{% set _items = items|default([]) %} +{% set _non_eu_items = non_eu_items|default([]) %} +{% set _close_label = close_label|default('') %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _overlay %} + {% include '@oe-bcl/bcl-language-list/language-list-modal.html.twig' %} +{% else %} + {% set attributes = attributes.addClass(['bcl-language-list', 'bcl-language-list--' ~ _variant]) %} + + {% if not _inside_container %} + {% set attributes = attributes.addClass(['pt-5']) %} + {% endif %} + +
+ {% if _logo is not empty %} +
+ {% if _title is empty %} +
+ {% endif %} +
+ {{ _logo.alt }} + {% if _title is not empty %} +
{{ _title }}
+ {% endif %} +
+ {% if _title is empty %} +
+ {% endif %} +
+ {% endif %} + + {% if _items is not empty or _non_eu_items is not empty %} +
+ {% if not (_variant == 'neutral' and _inside_container) %} +
+ {% endif %} + {% if _items is not empty and _items is iterable %} + {% include '@oe-bcl/bcl-language-list/language-list-grid.html.twig' with { + items: _items, + icon_path: _icon_path, + category: eu_category, + } only %} + {% endif %} + {% if _non_eu_items is not empty and _non_eu_items is iterable %} + {% include '@oe-bcl/bcl-language-list/language-list-grid.html.twig' with { + items: _non_eu_items, + icon_path: _icon_path, + category: non_eu_category, + } only %} + {% endif %} + {% if not (_variant == 'neutral' and _inside_container) %} +
+ {% endif %} +
+ {% endif %} +
+{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-language-switcher/bcl-language-switcher.html.twig b/assets/bcl/bcl-language-switcher/bcl-language-switcher.html.twig new file mode 100644 index 000000000..aef75910a --- /dev/null +++ b/assets/bcl/bcl-language-switcher/bcl-language-switcher.html.twig @@ -0,0 +1,50 @@ +{% apply spaceless %} + +{# Parameters: + - id (string) (default: collapse-random(10000), optional) + - message (alert object) (default: {}) + - expandable (button object) (default: {}) + - languages (link[]) (default: []) +#} + +{% set _id = id|default('collapse-' ~ random(10000)) %} +{% set _message = message|default({}) %} +{% set _expandable = expandable|default({}) %} +{% set _languages = languages|default([]) %} + +{% set _expandable_attributes = _expandable.attributes ?: create_attribute() %} + +{% set _expandable_attributes = _expandable_attributes + .setAttribute('data-bs-toggle', 'collapse') + .setAttribute('autocomplete', 'off') + .setAttribute('aria-expanded', 'false') + .setAttribute('aria-controls', _id) + .setAttribute('data-bs-target', '#' ~ _id) +%} + +{% include '@oe-bcl/bcl-alert/alert.html.twig' with _message only %} + +{% include '@oe-bcl/bcl-button/button.html.twig' with _expandable|merge({ + attributes: _expandable_attributes +}) only %} + +
+
+ {% for language in languages %} + {% include '@oe-bcl/bcl-link/link.html.twig' with language|merge({ + attributes: create_attribute().addClass( + [ "btn", + "btn-link", + "d-block", + "ps-0", + "text-start" + ]) + }) only %} + {% endfor %} +
+
+ +{% endapply %} diff --git a/assets/bcl/bcl-link/bcl-link.html.twig b/assets/bcl/bcl-link/bcl-link.html.twig new file mode 100644 index 000000000..aa94eb3a9 --- /dev/null +++ b/assets/bcl/bcl-link/bcl-link.html.twig @@ -0,0 +1,90 @@ +{% apply spaceless %} + +{# Parameters: + - label (string) (default: '') + - path (string) (default: '#') + - variant (string) (default: '') + - options ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'] + - id (string) (default: '') + - disabled (boolean) (default: false) + - standalone (boolean) (default: false) + - icon (icon object) (default: {}) + - icon_position (string) (default: after) + - options ['after', 'before'] + - remove_icon_spacers (boolean) (default: false) + - attributes (drupal attrs) +#} + +{% set _label = label|default('') %} +{% set _path = path|default('#') %} +{% set _variant = variant|default('') %} +{% set _id = id|default('') %} +{% set _disabled = disabled ?? false %} +{% set _standalone = standalone ?? false %} +{% set _icon = icon|default({}) %} +{% set _icon_position = icon_position|default('after') %} +{% set _remove_icon_spacers = remove_icon_spacers ?? false %} + +{% set _classes = [] %} + +{% if _icon is not empty %} + {% if _label is not empty and not _remove_icon_spacers %} + {% if _icon.attributes is empty %} + {% set _icon = _icon|merge({ + attributes: create_attribute() + }) + %} + {% endif %} + {% if _icon_position == 'before' %} + {% set _icon = _icon|merge({ + attributes: _icon.attributes.addClass('me-2-5') + }) + %} + {% else %} + {% set _icon = _icon|merge({ + attributes: _icon.attributes.addClass('ms-2-5') + }) + %} + {% endif %} + {% endif %} + {%- set _icon_markup -%} + {%- include '@oe-bcl/bcl-icon/icon.html.twig' with _icon only -%} + {%- endset -%} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _disabled %} + {% set _classes = _classes|merge(['disabled']) %} + {% set attributes = attributes.setAttribute('aria-disabled', 'true').setAttribute('tabindex', '-1') %} +{% endif %} +{% if _variant is not empty %} + {% set _classes = _classes|merge(['link-' ~ _variant]) %} +{% endif %} +{% if _id is not empty %} + {% set attributes = attributes.setAttribute('id', _id) %} +{% endif %} +{% if _standalone %} + {% set _classes = _classes|merge(['standalone']) %} +{% endif %} +{% if _classes is not empty %} + {% set attributes = attributes.addClass(_classes) %} +{% endif %} + +{% if _icon_markup is defined %} + {%- set _label -%} + {%- if _icon_position == 'before' -%} + {{ _icon_markup }} + {%- endif -%} + {{- _label -}} + {%- if _icon_position == 'after' -%} + {{ _icon_markup }} + {%- endif -%} + {%- endset -%} +{%- endif -%} + +{{ bcl_link(_label, _path, attributes) }} + +{% endapply %} diff --git a/assets/bcl/bcl-links-block/bcl-links-block.html.twig b/assets/bcl/bcl-links-block/bcl-links-block.html.twig new file mode 100644 index 000000000..fd94602f8 --- /dev/null +++ b/assets/bcl/bcl-links-block/bcl-links-block.html.twig @@ -0,0 +1,76 @@ +{% apply spaceless %} + +{# Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - background: (string) (default: 'gray') + - options ['gray', 'transparent'] + - variant: (string) (default: 'vertical') + - options ['vertical', 'horizontal'] + - links (link[]) (default: []) + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _background = background|default('gray') %} +{% set _variant = variant|default('vertical') %} +{% set _links = links|default([])%} + +{% set _classes = ['bcl-links-block'] %} + +{% set _title_classes = ['pb-3', 'mb-3', 'border-bottom'] %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _background == 'gray' %} + {% set attributes = attributes.addClass(['bg-light', 'px-4', 'py-3', 'rounded-2']) %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +{% if _links is not empty and _links is iterable %} +
+ {% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes.addClass(_title_classes), + } only %} + {% endif %} +
    + {% for _link in _links %} + {% if _link.attributes is empty %} + {% set _link = _link|merge({ + attributes: create_attribute() + }) %} + {% endif %} + {% set _link = _link|merge({ + clean_class: true, + attributes: _link.attributes.addClass(['pb-3', 'd-inline-block', 'standalone']) + }) %} + {% set _list_item_classes = 'list-unstyled' %} + {% if _variant == 'horizontal' %} + {% set _list_item_classes = _list_item_classes ~ ' d-inline' %} + {% endif %} + {% if loop.last == false %} + {% set _list_item_classes = _list_item_classes ~ ' me-4-5' %} + {% endif %} +
  • + {% include '@oe-bcl/bcl-link/link.html.twig' with _link only %} +
  • + {% endfor %} +
+
+{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-list-group/bcl-list-group.html.twig b/assets/bcl/bcl-list-group/bcl-list-group.html.twig new file mode 100644 index 000000000..39c1dade3 --- /dev/null +++ b/assets/bcl/bcl-list-group/bcl-list-group.html.twig @@ -0,0 +1,120 @@ +{% apply spaceless %} + +{# Parameters: + - flush (boolean) (default: false) + - horizontal (string) (default: '') + - options ['none', 'horizontal', 'horizontal-sm', 'horizontal-md', 'horizontal-lg', 'horizontal-xl', 'horizontal-xxl'] + - id (string) (default: '') + - type (string) (default: 'unordered') + - options ['unordered', 'ordered', 'actionable'] + - items (badge or link or button []) + format: [ + { + - html (string) + - variant (string) + ...badge + } + { + ...Link + - button (boolean) (default: false) + }, + { + ...Button + - button (boolean) (default: false) + }, + ... + ] + - attributes (drupal attrs) +#} + +{% set _flush = flush ?? false %} +{% set _horizontal = horizontal|default('') %} +{% set _id = id|default('') %} +{% set _type = type|default('unordered') %} +{% set _items = items|default([]) %} + +{% set _classes = ['list-group'] %} + +{% if _flush %} + {% set _classes = _classes|merge(['list-group-flush']) %} +{% endif %} +{% if _type == 'ordered' %} + {% set _classes = _classes|merge(['list-group-numbered']) %} +{% endif %} +{% if _horizontal is not empty %} + {% set _classes = _classes|merge(['list-group-' ~ _horizontal]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _id is not empty %} + {% set attributes = attributes.setAttribute('id', _id) %} +{% endif %} +{% set attributes = attributes.addClass(_classes) %} + +{% if _type == 'unordered' %} + +{% endif %} +{% if _type == 'ordered' %} + +{% endif %} +{% if _type == 'actionable' %} +
+{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-listing/bcl-listing.html.twig b/assets/bcl/bcl-listing/bcl-listing.html.twig new file mode 100644 index 000000000..a2900fd71 --- /dev/null +++ b/assets/bcl/bcl-listing/bcl-listing.html.twig @@ -0,0 +1,199 @@ +{% apply spaceless %} + +{# Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - items: (card[]) + - variant: (string) (default: 'default-1-col') + options [ default-1-col, highlight-1-col, default-2-col, default-3-col, highlight-2-col, highlight-3-col ] + - link: (object of type link) + - alignment: (string) (default: '') + options ['start', 'end', 'center', 'baseline', 'stretch'] + - image_size: (string) (default: '') + options ['small', 'large', 'extra-large'] + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _items = items|default([]) %} +{% set _variant = variant|default('default-1-col') %} +{% set _link = link|default({}) %} +{% set _alignment = alignment|default('') %} +{% set _image_size = image_size|default('') %} + +{% set _classes = ['bcl-listing', 'bcl-listing--' ~ _variant] %} +{% set _cards = [] %} +{% set _card_layout = { + type: 'grid', + responsiveness: 'md', + gutter: '4', + attributes: create_attribute(), +} %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +
+ +{% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + title_attributes: _title_attributes, + } only %} +{% endif %} + +{% if _items is not empty %} + {% for _card in _items %} + {% set _alignment_class = '' %} + {% set _image_classes = _card.image.classes ?: '' %} + {% set _start_col_classes = 'bcl-card-start-col mb-3 mb-lg-0' %} + {% set _end_col_classes = 'col-12 col-md' %} + {% if _image_size is not empty %} + {% set _start_col_classes = _start_col_classes ~ ' bcl-size-' ~ _image_size %} + {% endif %} + {% if 'd-none' in _image_classes %} + {% set _start_col_classes = _start_col_classes ~ ' d-none d-md-block' %} + {% endif %} + {% if _alignment is not empty %} + {% set _alignment_class = ' align-self-' ~ _alignment %} + {% endif %} + {% set _card_classes = [] %} + {% set _card_attributes = card.attributes ? card.attributes : create_attribute() %} + {% set _card_title_attributes = card.title_attributes ? card.title_attributes : create_attribute() %} + {% set _card = _card|merge({ + title_attributes: _card_title_attributes.addClass(['fs-5']) + }) %} + + {% if _variant == 'default-1-col' or _variant == 'default-2-col' or _variant == 'default-3-col' %} + {% set _card_classes = [ + 'listing-item', + 'border-bottom', + 'border-md-0', + 'border-0', + ] %} + {% set _card_attributes = _card_attributes.addClass(_card_classes) %} + {% set _card = _card|merge({ + horizontal: true, + extra_classes_body: 'p-0 pb-md-0 pb-3', + attributes: _card_attributes, + horizontal_grid: { + left_col_classes: _start_col_classes ~ _alignment_class, + right_col_classes: _end_col_classes ~ _alignment_class, + } + }) %} + + {% if _variant == 'default-2-col' %} + {% set _card_layout = _card_layout|merge({ + responsive_columns: 2, + }) %} + {% elseif _variant == 'default-3-col' %} + {% set _card_layout = _card_layout|merge({ + attributes: _card_layout.attributes.addClass(['row-cols-md-2']), + responsive_columns: 3, + responsiveness: 'xl', + }) %} + {% endif %} + {% endif %} + + {% if _variant == 'highlight-1-col' %} + {% set _card_classes = [ + 'listing-item--highlight', + 'border-0', + 'bg-lighter' + ] %} + {% set _card_attributes = _card_attributes.addClass(_card_classes) %} + {% set _card = _card|merge({ + wrapper_class: 'col', + attributes: _card_attributes, + }) %} + {% if _card.image is defined and _card.image is not empty %} + {% set _card = _card|merge({ + extra_classes_body: "pt-0", + }) %} + {% endif %} + {% set _card_layout = _card_layout|merge({ + cols_extra_classes: 'mt-4-5', + }) %} + {% if _card.image is not empty %} + {% set _image_classes = _card.image.classes ?: '' %} + {% if not _alignment == 'center' %} + {% set _image_classes = _image_classes ? _image_classes ~ ' mb-3' : 'mb-3' %} + {% endif %} + {% set _card = _card|merge({image: _card.image|merge({ + classes: _image_classes, + })}) %} + {% endif %} + + {% endif %} + + {% if _variant == 'highlight-2-col' or variant == 'highlight-3-col' %} + {% set _card_classes = [ + 'listing-item--highlight', + 'border-0', + 'bg-lighter', + 'h-100', + 'rounded-2' + ] %} + {% set _card_attributes = _card_attributes.addClass(_card_classes) %} + {% set _card = _card|merge({ + wrapper_class: 'col', + attributes: _card_attributes, + }) %} + {% if _card.image is defined and _card.image is not empty %} + {% set _card = _card|merge({ + extra_classes_body: 'pt-0', + }) %} + {% endif %} + {% if _card.image is not empty %} + {% set _image_classes = _card.image.classes ?: '' %} + {% if not _alignment == 'center' %} + {% set _image_classes = _image_classes ? _image_classes ~ ' mb-3' : 'mb-3' %} + {% endif %} + {% set _card = _card|merge({image: _card.image|merge({ + classes: _image_classes, + })}) %} + {% endif %} + {% set _card_layout = _card_layout|merge({ gutter: '4' }) %} + {% if variant == 'highlight-2-col' %} + {% set _card_layout = _card_layout|merge({ responsive_columns: 2 }) %} + {% else %} + {% set _card_layout = _card_layout|merge({ responsive_columns: 3 }) %} + {% endif %} + {% endif %} + + {% if _card.image is empty and _card.date is empty %} + {% set _card = _card|merge({ + horizontal: false, + }) %} + {% endif %} + + {% set _cards = _cards|merge([_card]) %} + {% endfor %} +{% endif %} + + {% include "@oe-bcl/bcl-card-layout/card-layout.html.twig" with _card_layout|merge({ items: _cards }) only %} + +{% if _link is not empty %} + {% set _link_attributes = _link.attributes ? _link.attributes : create_attribute() %} + {% set _link_attributes = _link_attributes.addClass(['mt-3-5', 'd-inline-block']) %} + {% include '@oe-bcl/bcl-link/link.html.twig' with _link|merge({ + attributes: _link_attributes, + icon: _link.icon|merge({ + name: 'chevron-right', + size: 'xs', + }), + }) only %} +{% endif %} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-modal/bcl-modal.html.twig b/assets/bcl/bcl-modal/bcl-modal.html.twig new file mode 100644 index 000000000..78eb3f529 --- /dev/null +++ b/assets/bcl/bcl-modal/bcl-modal.html.twig @@ -0,0 +1,82 @@ +{% apply spaceless %} + +{# Parameters: + - size (string) default('') + options: sm, lg, xl, fullscreen + - id (boolean) (default: modal-random(10000)) + - fullscreen_responsive (string) (default: '') + options: sm, md, lg, xl, xxl + - static_backdrop (boolean) (default: false) + - verticaly_centered (boolean) (default: false) + - scrollable (boolean) (default: false) + - header (block) (default: '') + - messages (block) (default: '') + - body (block) (default: '') + - footer (block) (default: '') + - attributes (drupal attrs) + + Blocks + - header + - messages + - body + - footer +#} + +{% set _size = size|default('') %} +{% set _id = id|default('modal-' ~ random(10000)) %} +{% set _fullscreen_responsive = fullscreen_responsive|default('') %} +{% set _static_backdrop = static_backdrop ?? false %} +{% set _verticaly_centered = verticaly_centered ?? false %} +{% set _scrollable = scrollable ?? false %} +{% set _header = header|default('') %} +{% set _messages = messages|default('') %} +{% set _body = body|default('') %} +{% set _footer = footer|default('') %} + +{% set _classes = ['modal', 'fade'] %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes + .setAttribute('id', _id) + .setAttribute('tabindex', '-1') + .setAttribute('aria-hidden', 'true') + .setAttribute('aria-label', _id ~ 'Label') + .addClass(_classes) +%} + +{% if _static_backdrop %} + {% set attributes = attributes.setAttribute('data-bs-backdrop', 'static') %} +{% endif %} + +
+ +
+ +{% endapply %} diff --git a/assets/bcl/bcl-navbar/bcl-navbar.html.twig b/assets/bcl/bcl-navbar/bcl-navbar.html.twig new file mode 100644 index 000000000..0e46f65cc --- /dev/null +++ b/assets/bcl/bcl-navbar/bcl-navbar.html.twig @@ -0,0 +1,109 @@ +{% apply spaceless %} + +{# Parameters: + - collapse_id (string) (default: '') + - background (string) (default: '') + - brand (object) (default: {}) + format: { + src: '', + alt: '', + class: '', + label: '', (optional: only for string label) + link: '', + } + - navigation (object Navigation) (default: {}) + - form (object Form) (default: {}) + - expand (string) (default: 'lg') + options: ['sm', 'md', 'lg'] + - color_set (string) (default: 'light') + options ['light', 'dark'] + - disable_collapse (boolean) (default: false) + - attributes (drupal attrs) + + Blocks + - branding + - navigation + - right +#} + +{% set _collapse_id = collapse_id|default('') %} +{% set _background = background|default('') %} +{% set _brand = brand|default({}) %} +{% set _navigation = navigation|default({}) %} +{% set _form = form|default({}) %} +{% set _expand = expand|default('lg') %} +{% set _color_set = color_set|default('light') %} +{% set _disable_collapse = disable_collapse ?? false %} + +{% set _classes = ['navbar', 'navbar-expand-' ~ _expand] %} +{% if _background is not empty %} + {% set _classes = _classes|merge(['bg-' ~ _background]) %} +{% endif %} +{% if _color_set is not empty %} + {% set _classes = _classes|merge(['navbar-' ~ _color_set]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + + + +{% endapply %} diff --git a/assets/bcl/bcl-navigation/bcl-navigation.html.twig b/assets/bcl/bcl-navigation/bcl-navigation.html.twig new file mode 100644 index 000000000..84a2cc4b6 --- /dev/null +++ b/assets/bcl/bcl-navigation/bcl-navigation.html.twig @@ -0,0 +1,179 @@ +{% import _self as navigation %} +{% apply spaceless %} + +{# Parameters: + - id (string) (default: '') + - pills (boolean) (default: false) + - tabs (boolean) (default: false) - If tabs is set to true, the nav should also be set to true for accessibility reasons + - vertical (boolean) (default: false) + - full_width (boolean) (default: false) + - alignment (string) (default: '') + - options ['start', 'center', 'end'] + - tabs_content (boolean) (default: false) + - nav (boolean) (default: false) + - navbar (boolean) (default: false) + - items (object[]) + format: [ + { + - link or button + - active (boolean) + - button (boolean) - set to button + - content (string) - content for tab + - navigation (navigation Object) + } + ] + - attributes (drupal attrs) +#} + +{# Define main macro #} +{% macro render(items, pills, tabs, tabs_content, vertical, full_width, alignment, id, nav, navbar, attributes) %} +{% apply spaceless %} + {% import _self as navigation %} + + {% set _id = id|default('') %} + {% set _pills = pills ?? false %} + {% set _tabs = tabs ?? false %} + {% set _vertical = vertical ?? false %} + {% set _full_width = full_width ?? false %} + {% set _alignment = alignment|default('') %} + {% set _tabs_content = tabs_content ?? false %} + {% set _nav = nav ?? false %} + {% set _navbar = navbar ?? false %} + {% set _items = items|default([]) %} + + {% if _navbar %} + {% set _classes = ['navbar-nav'] %} + {% else %} + {% set _classes = ['nav'] %} + {% endif %} + {% if _pills %} + {% set _classes = _classes|merge(['nav-pills']) %} + {% endif %} + {% if _tabs %} + {% set _classes = _classes|merge(['nav-tabs']) %} + {% endif %} + {% if _vertical %} + {% set _classes = _classes|merge(['flex-column']) %} + {% endif %} + {% if _full_width %} + {% set _classes = _classes|merge(['nav-fill']) %} + {% endif %} + {% if _alignment is not empty %} + {% set _classes = _classes|merge(['justify-content-' ~ _alignment]) %} + {% endif %} + + {% if attributes is empty %} + {% set attributes = create_attribute() %} + {% endif %} + + {% if _id is not empty %} + {% set attributes = attributes.setAttribute('id', _id) %} + {% endif %} + + {% if _tabs %} + {% set attributes = attributes.setAttribute('role', 'tablist') %} + {% endif %} + {% set attributes = attributes.addClass(_classes) %} + + {% if _nav %} + + {% else %} + + {% endif %} + {% if _tabs_content %} +
+ {%- block contents -%} + {% if _items is not empty and _items is iterable %} + {% for _item in _items %} + {% if _item.content is not empty %} + {% set _content_class = 'tab-pane fade' %} + {% if _item.active %} + {% set _content_class = _content_class ~ ' show active' %} + {% endif %} +
+ {{- _item.content -}} +
+ {% endif %} + {% endfor %} + {% endif %} + {%- endblock -%} +
+ {% endif %} +{% endapply %} +{% endmacro %} + +{{ navigation.render(items, pills, tabs, tabs_content, vertical, full_width, alignment, id, nav, navbar, attributes) }} + +{% endapply %} diff --git a/assets/bcl/bcl-offcanvas/bcl-offcanvas.html.twig b/assets/bcl/bcl-offcanvas/bcl-offcanvas.html.twig new file mode 100644 index 000000000..0b657ad05 --- /dev/null +++ b/assets/bcl/bcl-offcanvas/bcl-offcanvas.html.twig @@ -0,0 +1,119 @@ +{% apply spaceless %} + +{# Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - placement (string) (default: '') (start, end, top, bottom) + - id (string) (default: '') + - body (string) (default: '') + - with_body_scroll (boolean) (default: false) + - with_backdrop (boolean) (default: true) + - with_close (boolean) (default: true) + - close_aria_label (default: '') + - extra_classes_body (string) (default: '') + - extra_classes_header (string) (default: '') + - extra_classes_close (string) (default: '') + - responsiveness (string) (default: '') + options: ['sm', 'md', 'lg', 'xl', 'xxl'] + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _placement = placement|default('') %} +{% set _id = id|default('') %} +{% set _body = body|default('') %} +{% set _with_body_scroll = with_body_scroll ?? false %} +{% set _with_backdrop = with_backdrop ?? true %} +{% set _with_close = with_close ?? true %} +{% set _close_aria_label = close_aria_label|default('') %} +{% set _extra_classes_body = extra_classes_body|default('') %} +{% set _extra_classes_header = extra_classes_header|default('') %} +{% set _extra_classes_close = extra_classes_close|default('') %} +{% set _responsiveness = responsiveness|default('') %} + +{% if _responsiveness is not empty %} + {% set _classes = ['offcanvas-' ~ _responsiveness] %} +{% else %} + {% set _classes = ['offcanvas'] %} +{% endif %} + +{% set _class_body = 'offcanvas-body' ~ (_extra_classes_body ? ' ' ~ _extra_classes_body : '') %} +{% set _class_header = 'offcanvas-header' ~ (_extra_classes_header ? ' ' ~ _extra_classes_header : '') %} + +{% if _placement is not empty %} + {% set _classes = _classes|merge(['offcanvas-' ~ _placement]) %} +{% endif %} + +{% if _title is not empty %} + {% set _aria_labelled = _title.id|default('') %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _aria_labelled is defined and _aria_labelled is not empty %} + {% set attributes = attributes.setAttribute('aria-labelledby', _aria_labelled) %} +{% endif %} + +{% if _id is not empty %} + {% set attributes = attributes.setAttribute('id', _id) %} +{% endif %} + +{% if _with_body_scroll %} + {% set attributes = attributes.setAttribute('data-bs-scroll', 'true') %} +{% endif %} + +{% if not _with_backdrop %} + {% set attributes = attributes.setAttribute('data-bs-backdrop', 'false') %} +{% endif %} + +{% set attributes = attributes.setAttribute('tabindex', '-1').addClass(_classes) %} + +
+{% if _with_close or _title is not empty %} +
+ {% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes.addClass(['offcanvas-title']), + } only %} + {% endif %} + {% if _with_close %} + {% set button_attributes = create_attribute() + .addClass(['btn-close', 'text-reset']) + .setAttribute('data-bs-dismiss', 'offcanvas') + .setAttribute('data-bs-target', '#' ~ _id) + .setAttribute('aria-label', _close_aria_label) + %} + {% if _extra_classes_close is not empty %} + {% set button_attributes = button_attributes.addClass(_extra_classes_close) %} + {% endif %} + {%- include '@oe-bcl/bcl-button/button.html.twig' with { + attributes: button_attributes, + clean_class: true + } only -%} + {% endif %} +
+{% endif %} +{%- if _body is not empty -%} +
+{%- endif -%} + {%- block body -%} + {{ _body }} + {%- endblock -%} +{%- if _body is not empty -%} +
+{%- endif -%} +
+ +{% endapply %} diff --git a/assets/bcl/bcl-page/bcl-page.html.twig b/assets/bcl/bcl-page/bcl-page.html.twig new file mode 100644 index 000000000..adb9041b7 --- /dev/null +++ b/assets/bcl/bcl-page/bcl-page.html.twig @@ -0,0 +1,45 @@ +{% extends '@oe-bcl/bcl-base-templates/content-type.html.twig' %} + +{% block sidebar %} + {% include '@oe-bcl/bcl-inpage-navigation/inpage-navigation.html.twig' with sidebar only %} +{% endblock %} + +{% block content %} +

{{ get_dummy_text(6) }} +

+

Section 1

+ {% if featured_item %} + {% include '@oe-bcl/bcl-featured-media/featured-media.html.twig' with featured_item only %} + {% endif %} + + {% if page_banner %} + {% include '@oe-bcl/bcl-banner/banner.html.twig' with page_banner only %} + {% endif %} + + {% if listing %} + {% include '@oe-bcl/bcl-listing/listing.html.twig' with listing only %} + {% endif %} + +

Section 2

+ + {{ get_dummy_text(6, true) }} + + {% if blockquote %} + {% include '@oe-bcl/bcl-blockquote/blockquote.html.twig' with blockquote only %} + {% endif %} + {% if accordion %} + {% include '@oe-bcl/bcl-accordion/accordion.html.twig' with accordion only %} + {% endif %} + {% if timeline %} + {% include '@oe-bcl/bcl-timeline/timeline.html.twig' with timeline only %} + {% endif %} + + {{ get_dummy_text(8, true) }} + +

Section 3

+ + {{ get_dummy_text(4, true) }} + + {% include '@oe-bcl/bcl-file/file.html.twig' with files[0] only %} + {% include '@oe-bcl/bcl-file/file.html.twig' with files[1] only %} +{% endblock %} diff --git a/assets/bcl/bcl-pagination/bcl-pagination-item.html.twig b/assets/bcl/bcl-pagination/bcl-pagination-item.html.twig new file mode 100644 index 000000000..76e6ec9d9 --- /dev/null +++ b/assets/bcl/bcl-pagination/bcl-pagination-item.html.twig @@ -0,0 +1,73 @@ +{% apply spaceless %} + +{# Parameters: + - path (string) (default: '') + - label (string) (default: '') + - disabled (boolean) (default: false) + - active (boolean) (default: false) + - aria_label (string) (default: '') - deprecated, use attributes + - icon (icon object) (default: {}) + - attributes (drupal attrs) +#} + +{% set _path = path|default('') %} +{% set _label = label|default('') %} +{% set _disabled = disabled ?? false %} +{% set _active = active ?? false %} +{% set _aria_label = aria_label|default('') %} +{% set _icon = icon|default({}) %} +{% set _icon_path = icon_path|default('') %} +{% set _icon_name = icon_name|default('') %} +{% set _icon_html = icon_html|default('') %} +{% set _classes = ['page-link'] %} + +{% if _icon_path is not empty and _icon is empty %} + {% if _icon_name is not empty %} + {% set _icon = _icon|merge({ + name: _icon_name, + path: _icon_path, + size: "fluid" + }) %} + {% set _label = "" %} + {% endif %} +{% else %} + {% if _icon_html is not empty %} + {% set _label %} + + {% endset %} + {% endif %} +{% endif %} + +{% if _icon is not empty %} + {% set _icon = _icon|merge({ + path: _icon_path, + }) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _aria_label is not empty %} + {% set attributes = attributes.setAttribute('aria-label', _aria_label ) %} +{% endif %} + +{% if _active %} + {% set attributes = attributes.setAttribute('aria-current', 'page' ) %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +{% if _path %} + {%- include '@oe-bcl/bcl-link/link.html.twig' with { + label: _label, + path: _path, + disabled: _disabled, + icon: _icon, + attributes: attributes, + } only -%} +{% else %} +
{{- _label -}}
+{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-pagination/bcl-pagination.html.twig b/assets/bcl/bcl-pagination/bcl-pagination.html.twig new file mode 100644 index 000000000..9a3117cde --- /dev/null +++ b/assets/bcl/bcl-pagination/bcl-pagination.html.twig @@ -0,0 +1,161 @@ +{% apply spaceless %} + +{# Parameters: + - size (string) (default: '') + - options ['sm', 'lg'] + - alignment (string) (default: '') + - options ['end', 'center'] + - variant: (string) (default: '') + - options: ['glossary'] + - aria_label (string) (default: '') - deprecated, use attributes + - enable_prev_next_icon (boolean) (default: false) + - enable_first_last_icon (boolean) (default: true) + - ellipsis_before (boolean) (default: false) + - ellipsis_after (boolean) (default: false) + - first (pagination Item object) (default: {}) + - prev (pagination Item object) (default: {}) + - next (pagination Item object) (default: {}) + - last (pagination Item object) (default: {}) + - items (pagination item[]) (default: []) + format: [ + { + - path (string) (default: '') + - label (string) (default: '') + - disabled (boolean) (default: false) + - active (boolean) (default: false) + - aria_label (string) (default: '') - deprecated, use attributes + - icon (Icon component) (default: {}) + - attributes (drupal attrs) + } + - icon_path (string) (default: '') + - attributes (drupal attrs) + - list_attributes (drupal attrs) +#} + +{% set _size = size|default('') %} +{% set _alignment = alignment|default('') %} +{% set _variant = variant|default('') %} +{% set _aria_label = aria_label|default('') %} +{% set _enable_prev_next_icon = enable_prev_next_icon ?? false %} +{% set _enable_first_last_icon = enable_first_last_icon ?? true %} +{% set _ellipsis_before = ellipsis_before ?? false %} +{% set _ellipsis_after = ellipsis_after ?? false %} +{% set _first = first|default({}) %} +{% set _prev = prev|default({}) %} +{% set _next = next|default({}) %} +{% set _last = last|default({}) %} +{% set _items = items|default([]) %} +{% set _icon_path = icon_path|default('') %} +{% set _internal_items = [] %} + +{% if _enable_first_last_icon %} + {% if _first is not empty %} + {% set _first = _first|merge({ + icon_html: "«", + icon_name: "chevron-double-left", + }) %} + {% endif %} + {% if _last is not empty %} + {% set _last = _last|merge({ + icon_html: '»', + icon_name: "chevron-double-right", + }) %} + {% endif %} +{% endif %} + +{% if _enable_prev_next_icon %} + {% if _prev is not empty %} + {% set _prev = _prev|merge({ + icon_html: "‹", + icon_name: "chevron-left", + }) %} + {% endif %} + {% if _next is not empty %} + {% set _next = _next|merge({ + icon_html: "›", + icon_name: "chevron-right", + }) %} + {% endif %} +{% endif %} + + +{% set _internal_items = _internal_items|merge([_first, _prev]) %} + +{% set _ellipsis_markup %} … {% endset %} + +{% if _ellipsis_before %} + {% set _ellipsis_before_item = { + icon_html: _ellipsis_markup, + icon_path: "", + } %} + {% set _internal_items = _internal_items|merge([_ellipsis_before_item]) %} +{% endif %} + +{% set _internal_items = _internal_items|merge(_items) %} + +{% if _ellipsis_after %} + {% set _ellipsis_after_item = { + icon_html: _ellipsis_markup, + icon_path: "", + } %} + {% set _internal_items = _internal_items|merge([_ellipsis_after_item]) %} +{% endif %} + +{% set _internal_items = _internal_items|merge([_next, _last]) %} + +{% if list_attributes is empty %} + {% set list_attributes = create_attribute() %} +{% endif %} + +{% set list_attributes = list_attributes.addClass('pagination') %} +{% if _size is not empty %} + {% set list_attributes = list_attributes.addClass('pagination-' ~ _size) %} +{% endif %} +{% if _variant is not empty %} + {% set list_attributes = list_attributes.addClass('pagination--' ~ _variant) %} +{% endif %} +{% if _alignment is not empty %} + {% set list_attributes = list_attributes.addClass('justify-content-' ~ _alignment) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.setAttribute('role', 'navigation') %} + +{% if _variant == 'glossary' %} + {% set attributes = attributes.addClass(['bcl-glossary']) %} +{% endif %} + +{% if _aria_label is not empty %} + {% set attributes = attributes.setAttribute('aria-label', aria_label) %} +{% endif %} + + + +{% if _internal_items is not empty and _internal_items is iterable %} + {% for _item in _internal_items %} + {% if _item is not empty %} + {% set _item_class = ['page-item'] %} + {% if _item.disabled %} + {% set _item_class = _item_class|merge(['disabled']) %} + {% endif %} + {% if _item.active %} + {% set _item_class = _item_class|merge(['active']) %} + {% endif %} +
  • + {% if _item.icon_path is not defined %} + {% set _item = _item|merge({ + icon_path: _icon_path, + }) %} + {% endif %} + {% include '@oe-bcl/bcl-pagination/pagination-item.html.twig' with _item only %} +
  • + {% endif %} + {% endfor %} +{% endif %} + + + +{% endapply %} diff --git a/assets/bcl/bcl-person/bcl-person.html.twig b/assets/bcl/bcl-person/bcl-person.html.twig new file mode 100644 index 000000000..17c0462ac --- /dev/null +++ b/assets/bcl/bcl-person/bcl-person.html.twig @@ -0,0 +1,29 @@ +{% extends '@oe-bcl/bcl-base-templates/content-type.html.twig' %} + +{% block sidebar %} + {% include '@oe-bcl/bcl-inpage-navigation/inpage-navigation.html.twig' with sidebar only %} +{% endblock %} + +{% block content %} + {% if information.main_title is not empty %} +

    {{- information.main_title -}}

    + {% endif %} + {% if information.content is not empty %} +
    + {{- information.content -}} +
    + {% endif %} + + {% if files.main_title is not empty %} +

    {{- files.main_title -}}

    + {% endif %} + {% if files.listing is defined and files.listing is not empty %} + {% for file in files.listing %} + {% include '@oe-bcl/bcl-file/file.html.twig' with file only %} + {% endfor %} + {% endif %} +{% endblock %} diff --git a/assets/bcl/bcl-placeholder/bcl-placeholder.html.twig b/assets/bcl/bcl-placeholder/bcl-placeholder.html.twig new file mode 100644 index 000000000..d299ac654 --- /dev/null +++ b/assets/bcl/bcl-placeholder/bcl-placeholder.html.twig @@ -0,0 +1,45 @@ +{% apply spaceless %} + +{# Parameters: + - width (int) (default: 0) - between 0-100 + - variant (string) (default: '') + - options ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'] + - size (string) (default: '') + - options ['xs', 'lg'] + - animation (string) (default: '') + - options ['glow', 'wave'] + - attributes (drupal attrs) +#} + +{% set _width = width|default(0) %} +{% set _variant = variant|default('') %} +{% set _size = size|default('') %} +{% set _animation = animation|default('') %} + +{% set _classes = ['placeholder'] %} + +{% if _size is not empty %} + {% set _classes = _classes|merge(['placeholder-' ~ _size]) %} +{% endif %} + +{% if _variant is not empty %} + {% set _classes = _classes|merge(['text-bg-' ~ _variant]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} +{% set attributes = attributes.setAttribute('style', 'width: ' ~ _width ~ '%;') %} + +{% if _animation is not empty %} +

    +{% endif %} + + +{% if _animation is not empty %} +

    +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-progress/bcl-progress.html.twig b/assets/bcl/bcl-progress/bcl-progress.html.twig new file mode 100644 index 000000000..3e1ec2011 --- /dev/null +++ b/assets/bcl/bcl-progress/bcl-progress.html.twig @@ -0,0 +1,73 @@ +{% apply spaceless %} + +{# Parameters: + - progress (int) (default: 0) + - min (int) (default: 0) + - max (int) (default: 100) + - striped (boolean) (default: false) + - animated (boolean) (default: false) + - hidden_label (boolean) (default: false) + - label (string) (default: '') + - bar_label (string) (default: '') + - variant (string) (default: '') + - message (string) (default: '') + - attributes (drupal attrs) +#} + +{% set _progress = progress|default(0) %} +{% set _min = min|default(0) %} +{% set _max = max|default(100) %} +{% set _striped = striped ?? false %} +{% set _animated = animated ?? false %} +{% set _hidden_label = hidden_label ?? false %} +{% set _label = label|default('') %} +{% set _bar_label = bar_label|default('') %} +{% set _variant = variant|default('') %} +{% set _message = message|default('') %} + +{% set _classes = 'progress-bar' %} +{% if _striped is not empty %} + {% set _classes = _classes ~ ' progress-bar-striped' %} +{% endif %} +{% if _animated is not empty %} + {% set _classes = _classes ~ ' progress-bar-animated' %} +{% endif %} +{% if _variant is not empty %} + {% set _classes = _classes ~ ' text-bg-' ~ _variant %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(['progress']) %} + +{% if _bar_label is empty %} + {% set _bar_label = _progress ~ '%' %} +{% endif %} + +{% if _label is not empty %} + +{% endif %} +
    +
    + {%- if not _hidden_label -%} + {{- _bar_label -}} + {%- endif -%} +
    +
    +{% if _message is not empty %} + {{ _message }} +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-project-status/bcl-project-contributions.html.twig b/assets/bcl/bcl-project-status/bcl-project-contributions.html.twig new file mode 100644 index 000000000..362a4c3cb --- /dev/null +++ b/assets/bcl/bcl-project-status/bcl-project-contributions.html.twig @@ -0,0 +1,56 @@ +{% apply spaceless %} + +{# Parameters: + - corporate_contributions (string) (default: '') // value every 5 percent + - legend (description list object) (default: {}) + - chart (boolean) (default: false) + + Blocks - + project_status_contrib_chart + project_status_contrib_legend +#} + +{% set _corporate_contributions = corporate_contributions|default('') %} +{% set _legend = legend|default({}) %} +{% set _chart = chart ?? false %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass([ + 'bcl-project-contributions', + 'border-bottom', + 'pb-4', + 'mb-4' +]) %} + +
    +
    + + {% if _chart is not empty %} +
    + {% block project_status_contrib_chart %} +
    + + + + + + +
    + {% endblock %} +
    + {% endif %} + + {% if _legend is not empty %} +
    + {% block project_status_contrib_legend %} + {% include '@oe-bcl/bcl-description-list/description-list.html.twig' with _legend only %} + {% endblock %} +
    + {% endif %} +
    +
    + +{% endapply %} diff --git a/assets/bcl/bcl-project-status/bcl-project-status.html.twig b/assets/bcl/bcl-project-status/bcl-project-status.html.twig new file mode 100644 index 000000000..ed48ff127 --- /dev/null +++ b/assets/bcl/bcl-project-status/bcl-project-status.html.twig @@ -0,0 +1,99 @@ +{% apply spaceless %} + +{# Parameters: + - label (string) (default: '') + - status (string) (default: 'planned') + - badge (string) (default: '') + - start_date (string) (default: '') + - start_label (string) (default: '') + - end_date (string) (default: '') + - end_label (string) (default: '') + - progress (string) (default: '') + - attributes (drupal attrs) +#} + +{% set _label = label|default('') %} +{% set _status = status|default('planned') %} +{% set _badge = badge|default('') %} +{% set _start_date = start_date|default('') %} +{% set _start_label = start_label|default('') %} +{% set _end_date = end_date|default('') %} +{% set _end_label = end_label|default('') %} +{% set _progress = progress|default('') %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass([ + 'bcl-project-status', + 'border-bottom', + 'pb-4', + 'mb-4' +]) %} + +{% set _bgs = { + ongoing: 'info', + closed: 'dark', + planned: 'secondary', + } %} +{% set _bg = _bgs[_status]|default('secondary') %} + +
    +
    +
    + {% if _label is not empty %} +

    {{ _label }}

    + {% endif %} + + {% if _badge is not empty %} + {% include '@oe-bcl/bcl-badge/badge.html.twig' with { + label: _badge, + rounded_pill: true, + background: _bg, + attributes: create_attribute().addClass(['mb-3', 'mb-md-0']), + } only %} + {% endif %} + +
    + +
    +
    + + {% if _start_date is not empty and _start_label is not empty %} +

    + {{- _start_label -}}
    + + {{- _start_date -}} + +

    + {% endif %} + + {% if _end_date is not empty and _end_label is not empty %} +

    + {{- _end_label -}}
    + + {{- _end_date -}} + +

    + {% endif %} +
    + + {% if _progress is not empty or _status != 'ongoing' %} + {% if _progress is empty %} + {% set _progress = _status == 'closed' ? 100 : 0 %} + {% endif %} + {% include '@oe-bcl/bcl-progress/progress.html.twig' with { + variant: _bg, + hidden_label: true, + progress: _progress, + } only %} + {% endif %} + +
    +
    +
    + + + +{% endapply %} diff --git a/assets/bcl/bcl-project/bcl-project-lists.html.twig b/assets/bcl/bcl-project/bcl-project-lists.html.twig new file mode 100644 index 000000000..1e8e3cfb1 --- /dev/null +++ b/assets/bcl/bcl-project/bcl-project-lists.html.twig @@ -0,0 +1,73 @@ +{% apply spaceless %} + + +{# + Parameters: + - title: (string) (default: '') + - title_tag: (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - items (array) (default: []) + { + title: (heading object), + content: [ + description list object + ] + } +#} + +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _items = items|default([]) %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set _title_classes = ['my-4-5'] %} +{% set _title_attributes = _title_attributes.addClass(_title_classes) %} + +
    +{% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +{% endif %} +{% if _items is defined and _items is not empty %} + {% for _item in _items %} + {% if _item.title is not empty %} + {% set _item_title_attributes = _item.title_attributes ?: create_attribute() %} + {% set _item_title_attributes = _item_title_attributes.addClass(['mb-3']) %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _item.title, + title_tag: _item.title_tag|default('h3'), + title_link: _item.title_link|default({}), + attributes: _item_title_attributes, + } only %} + {% endif %} + {% for _list in _item.content %} + {% if _list.attributes is empty %} + {% set _list = _list|merge({ + attributes: create_attribute() + }) %} + {% endif %} + {% if not loop.last %} + {% set _list = _list|merge({ + attributes: _list.attributes.addClass(['border-bottom', 'mb-3']) + }) + %} + {% endif %} + {% include '@oe-bcl/bcl-description-list/description-list.html.twig' with _list only %} + {% endfor %} + {% endfor %} +{% endif %} +
    + +{% endapply %} diff --git a/assets/bcl/bcl-project/bcl-project.html.twig b/assets/bcl/bcl-project/bcl-project.html.twig new file mode 100644 index 000000000..6284657dc --- /dev/null +++ b/assets/bcl/bcl-project/bcl-project.html.twig @@ -0,0 +1,72 @@ +{% extends '@oe-bcl/bcl-base-templates/content-type.html.twig' %} + +{% block sidebar %} + {% include '@oe-bcl/bcl-inpage-navigation/inpage-navigation.html.twig' with sidebar only %} +{% endblock %} + +{% block content %} + {% if project_status is not empty %} + {% if project_status_title is not empty %} + {% set _project_title_attributes = create_attribute().addClass(['mb-4']) %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: project_status_title, + title_tag: 'h2', + attributes: create_attribute().setAttribute('id', project_status_id), + } only %} + {% endif %} + {% include '@oe-bcl/bcl-project-status/project-status.html.twig' with project_status %} + {% if project_contributions is not empty %} + {% include '@oe-bcl/bcl-project-status/project-contributions.html.twig' with project_contributions %} + {% endif %} + {% if status_lists is not empty %} + {% include '@oe-bcl/bcl-project/project-lists.html.twig' with status_lists only %} + {% endif %} + {% endif %} + + {% if first_paragraphs is defined and first_paragraphs is not empty %} + {% for _paragraph in first_paragraphs %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _paragraph.title, + title_tag: 'h2', + attributes: create_attribute().addClass(['mb-4', 'pt-3']) + .setAttribute('id', _paragraph.title_id), + } only %} + {{- _paragraph.content -}} + {% endfor %} + {% endif %} + + {% if featured_lists is not empty %} + {% include '@oe-bcl/bcl-project/project-lists.html.twig' with featured_lists only %} + {% endif %} + + {% if content_lists is not empty %} + {% include '@oe-bcl/bcl-project/project-lists.html.twig' with content_lists only %} + {% endif %} + + {% if second_paragraphs is defined and second_paragraphs is not empty %} + {% for _paragraph in second_paragraphs %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _paragraph.title, + title_tag: 'h2', + attributes: create_attribute().addClass(['mb-4', 'pt-3']) + .setAttribute('id', _paragraph.title_id), + } only %} + {{- _paragraph.content -}} + {% endfor %} + {% endif %} + + {% if gallery is not empty %} +
    + {% include '@oe-bcl/bcl-gallery/gallery.html.twig' with gallery only %} +
    + {% endif %} + + {% if social_block is not empty %} + {% block social_block %} + {{ social_buttons }} + {% include '@oe-bcl/bcl-button/button.html.twig' with button_social_modal only %} + {% include '@oe-bcl/bcl-modal/modal.html.twig' with social_modal only %} + {% endblock %} + {% endif %} + +{% endblock %} diff --git a/assets/bcl/bcl-recent-activities/bcl-recent-activities.html.twig b/assets/bcl/bcl-recent-activities/bcl-recent-activities.html.twig new file mode 100644 index 000000000..bc6873c46 --- /dev/null +++ b/assets/bcl/bcl-recent-activities/bcl-recent-activities.html.twig @@ -0,0 +1,63 @@ +{% apply spaceless %} + +{# Parameters: + - activities (object[]) (default: []) + format: [ + { + image: { + path: "", + alt: "", + class: "", + }, + content: "", + meta: [ + { + icon (icon object): {}, + label: "" + } + ] + }, + ... + ] +#} + +{% set _activities = activities|default([]) %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +
    +{% if _activities is not empty and _activities is iterable %} + {% for _activity in _activities %} +
    + {% if _activity.image is not empty %} +
    + {{- _activity.image -}} +
    + {% endif %} + {% if _activity.content is not empty and _activity.meta is not empty %} +
    + {%- if _activity.content is not empty -%} +

    {{- _activity.content -}}

    + {%- endif -%} + {%- if _activity.meta is not empty and _activity.meta is iterable -%} + {%- for _meta in _activity.meta -%} +

    + {%- if _meta.icon is not empty -%} + {% include '@oe-bcl/bcl-icon/icon.html.twig' with _meta.icon only %} + {%- endif -%} + {{- _meta.label -}} +

    + {%- endfor -%} + {%- endif -%} +
    + {%- endif -%} +
    + {% endfor %} +{% endif %} +
    + +{% endapply %} diff --git a/assets/bcl/bcl-search-form/bcl-search-form.html.twig b/assets/bcl/bcl-search-form/bcl-search-form.html.twig new file mode 100644 index 000000000..b28acb98c --- /dev/null +++ b/assets/bcl/bcl-search-form/bcl-search-form.html.twig @@ -0,0 +1,53 @@ +{% apply spaceless %} + +{# Parameters: + - pill (boolean) (default: false) + - icon (icon Object) (default: {}) + - submit (button Object) (default: {}) + - input (form input Object) (default: {}) + - attributes (drupal attrs) + ] +#} + +{% set _pill = pill ?? false %} +{% set _icon = icon|default({}) %} +{% set _submit = submit|default({}) %} +{% set _input = input|default({}) %} + +{% set _classes = ['bcl-search-form'] %} + +{% if _pill %} + {% set _classes = _classes|merge(['rounded']) %} +{% endif %} + +{% if _submit is not empty %} + {% set _classes = _classes|merge(['submittable']) %} +{% endif %} + +{% if _icon is not empty %} + {% set _input = _input|merge({ + attributes: _input.attributes.addClass("ps-5") + }) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass( _classes ) %} + +
    +
    + {% if _icon is not empty %} + {% include '@oe-bcl/bcl-icon/icon.html.twig' with _icon only %} + {% endif %} + {% include '@oe-bcl/bcl-form-input/form-input.html.twig' with _input only %} + {% if _submit is not empty %} + {% include '@oe-bcl/bcl-button/button.html.twig' with _submit only %} + {% endif %} +
    +
    + +{% endapply %} diff --git a/assets/bcl/bcl-search/bcl-search.html.twig b/assets/bcl/bcl-search/bcl-search.html.twig new file mode 100644 index 000000000..6301860cc --- /dev/null +++ b/assets/bcl/bcl-search/bcl-search.html.twig @@ -0,0 +1,22 @@ +{% extends "@oe-bcl/bcl-base-templates/listing-page.html.twig" %} + +{% block banner %} +{% if banner.search_bar is defined %} +
    +
    +
    +
    + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: main_title, + title_tag: "h1", + attributes: create_attribute().addClass(['mb-3', 'mb-lg-0']), + } only %} +
    +
    + {% include '@oe-bcl/bcl-search-form/search-form.html.twig' with banner.search_bar only %} +
    +
    +
    +
    +{% endif %} +{% endblock %} diff --git a/assets/bcl/bcl-select/bcl-select.html.twig b/assets/bcl/bcl-select/bcl-select.html.twig new file mode 100644 index 000000000..636f482d2 --- /dev/null +++ b/assets/bcl/bcl-select/bcl-select.html.twig @@ -0,0 +1,184 @@ +{% apply spaceless %} + +{# + Parameters: + - id (string) (default: '') + - label (string) (default: '') + - label_extra_classes (string) (default: '') + - hidden_label (boolean) (default: false) + - helper_text (string) (default: '') + - helper_text_id (string) (default: '') + - disabled (boolean) (default: false) + - invalid (boolean) (default: false) + - valid (boolean) (default: false) + - invalid_feedback (string) (default: '') + - valid_feedback (string) (default: '') + - required (boolean) (default: false) + - multiple (boolean) (default: false) + - options (object[]) (default: []) + format: [ + { + selected (boolean, optional) + disabled (boolean, optional) + label (string) + hidden (boolean, optional) + options (object[], optional) + format: [{ + selected (boolean, optional) + disabled (boolean, optional) + label (string) + }] + } + ] + - aria_label (string) (default: '') + - clean_class (boolean) (default: false) - removes 'form-select' class + - attributes (drupal attrs) +#} + +{% set _id = id|default('') %} +{% set _label = label|default('') %} +{% set _label_extra_classes = label_extra_classes|default('') %} +{% set _hidden_label = hidden_label ?? false %} +{% set _helper_text = helper_text|default('') %} +{% set _helper_text_id = helper_text_id|default('') %} +{% set _disabled = disabled ?? false %} +{% set _invalid = invalid ?? false %} +{% set _valid = valid ?? false %} +{% set _invalid_feedback = invalid_feedback|default('') %} +{% set _valid_feedback = valid_feedback|default('') %} +{% set _required = required ?? false %} +{% set _multiple = multiple ?? false %} +{% set _options = options|default([]) %} +{% set _aria_label = aria_label|default('') %} +{% set _clean_class = clean_class ?? false %} + +{% set _classes = ['form-select'] %} +{% set _label_class = 'form-label' %} + +{% if _clean_class %} + {% set _classes = [] %} +{% endif %} + +{% if _invalid %} + {% set _classes = _classes|merge(['is-invalid']) %} +{% endif %} + +{% if _valid %} + {% set _classes = _classes|merge(['is-valid']) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _label_extra_classes is not empty %} + {% set _label_class = _label_class ~ ' ' ~ _label_extra_classes %} +{% endif %} + +{% if _aria_label is not empty %} + {% set attributes = attributes.setAttribute('aria-label', _aria_label) %} +{% endif %} + +{% if _id is not empty %} + {% set attributes = attributes.setAttribute('id', _id) %} +{% endif %} + +{% if _disabled %} + {% set attributes = attributes.setAttribute('disabled', true) %} +{% endif %} + +{% if _multiple %} + {% set attributes = attributes.setAttribute('multiple', true) %} +{% endif %} + +{% if _required %} + {% set attributes = attributes.setAttribute('required', true) %} +{% endif %} + +{% if _hidden_label %} + {% set _label_class = _label_class ~ ' visually-hidden' %} +{% endif %} + +{% if _classes is not empty %} + {% set attributes = attributes.addClass(_classes) %} +{% endif %} + +{% if _label is not empty %} + {% set _label_block %} + + {% endset %} +{% endif %} + +{% if _label_block is defined %} + {{ _label_block|raw }} +{% endif %} + +{% if _invalid_feedback is not empty %} +
    + {{- _invalid_feedback -}} +
    +{% endif %} +{% if _valid_feedback is not empty %} +
    + {{- _valid_feedback -}} +
    +{% endif %} +{% if _helper_text is not empty %} +
    + {{- _helper_text -}} +
    +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-spinner/bcl-spinner.html.twig b/assets/bcl/bcl-spinner/bcl-spinner.html.twig new file mode 100644 index 000000000..9ec2e32cb --- /dev/null +++ b/assets/bcl/bcl-spinner/bcl-spinner.html.twig @@ -0,0 +1,40 @@ +{% apply spaceless %} + +{# Parameters: + - type (string) (default: 'border') + - options ['border', 'grow'] + - variant (string) (default: '') + - size (string) (default: '') + - options ['sm', 'lg'] + - assistive_text (string) (default: '') + - attributes (drupal attrs) +#} + +{% set _type = type|default('border') %} +{% set _variant = variant|default('') %} +{% set _size = size|default('') %} +{% set _assistive_text = assistive_text|default('') %} + +{% set _classes = ['spinner-' ~ _type] %} +{% if _size is not empty %} + {% set _classes = _classes|merge(['spinner-' ~ _type ~ '-' ~ _size]) %} +{% endif %} +{% if _variant is not empty %} + {% set _classes = _classes|merge(['text-' ~ _variant]) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes).setAttribute('role', 'status') %} + +
    +{% if _assistive_text is not empty %} + {{ _assistive_text }} +{% endif %} +
    + +{% endapply %} diff --git a/assets/bcl/bcl-subscription-block/bcl-subscription-block.html.twig b/assets/bcl/bcl-subscription-block/bcl-subscription-block.html.twig new file mode 100644 index 000000000..8138ffd94 --- /dev/null +++ b/assets/bcl/bcl-subscription-block/bcl-subscription-block.html.twig @@ -0,0 +1,38 @@ +{% apply spaceless %} + +{# Parameters: + - title: (string) (default: '') + - content: (string) (default: '') + - button: (button Object) (default: {}) + - attributes (drupal attrs) +#} + +{% set _title = title|default('') %} +{% set _content = content|default('') %} +{% set _button = button|default({}) %} + +{% set _classes = ['bcl-subscription-block', 'text-bg-light', 'px-4-5', 'pt-4', 'pb-4-5'] %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +
    + {% if _title is not empty %} +
    {{ _title }}
    + {% endif %} + {% if _content is not empty %} + {{ _content }} + {% endif %} + {% if _button is not empty %} +
    + {% include '@oe-bcl/bcl-button/button.html.twig' with _button only %} +
    + {% endif %} +
    + +{% endapply %} diff --git a/assets/bcl/bcl-subscription/bcl-subscription-modal.html.twig b/assets/bcl/bcl-subscription/bcl-subscription-modal.html.twig new file mode 100644 index 000000000..7a8cd3dd6 --- /dev/null +++ b/assets/bcl/bcl-subscription/bcl-subscription-modal.html.twig @@ -0,0 +1,24 @@ +{% extends "@oe-bcl/bcl-modal/modal.html.twig" %} + +{# Parameters: + - form: (form object) (default: {}) + - success_alert: (alert object) (default: {}) + - error_alert: (alert Object) (default: {}) + + Blocks: + - body + - messages +#} + +{% set _form = form|default({}) %} +{% set _success_alert = success_alert|default({}) %} +{% set _error_alert = error_alert|default({}) %} + +{% block body %} + {% include '@oe-bcl/bcl-form/form.html.twig' with _form only %} +{% endblock %} + +{% block messages %} + {% include '@oe-bcl/bcl-alert/alert.html.twig' with _success_alert only %} + {% include '@oe-bcl/bcl-alert/alert.html.twig' with _error_alert only %} +{% endblock %} diff --git a/assets/bcl/bcl-subscription/bcl-subscription.html.twig b/assets/bcl/bcl-subscription/bcl-subscription.html.twig new file mode 100644 index 000000000..e6b401a91 --- /dev/null +++ b/assets/bcl/bcl-subscription/bcl-subscription.html.twig @@ -0,0 +1,10 @@ +{% extends '@oe-bcl/bcl-base-templates/content-type.html.twig' %} + +{% block sidebar %} + {% include '@oe-bcl/bcl-inpage-navigation/inpage-navigation.html.twig' with sidebar only %} +{% endblock %} + +{% block content_bottom %} + {% include '@oe-bcl/bcl-subscription-block/subscription-block.html.twig' with subscription only %} + {% include '@oe-bcl/bcl-subscription/subscription-modal.html.twig' with modal only %} +{% endblock %} diff --git a/assets/bcl/bcl-table/bcl-table.html.twig b/assets/bcl/bcl-table/bcl-table.html.twig new file mode 100644 index 000000000..d2b9efa0f --- /dev/null +++ b/assets/bcl/bcl-table/bcl-table.html.twig @@ -0,0 +1,195 @@ +{% apply spaceless %} + +{# Parameters: + - striped (boolean) (default: false) + - hoverable (boolean) (default: false) + - table_responsive (string) (default: '') + - options ['all', 'sm', 'md', 'lg', 'xl', 'xxl'] + - variant (string) (default: '') + - options ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'] + - small (boolean) (default: false) + - alignment (string) (default: '') + - options ['bottom', 'middle', 'top'] + - caption (string) (default: '') + - caption_top (boolean) (default: false) + - border (string) (default: '') + - options ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'] + - borderless (boolean) (default: false) + - table_footer (object[]) (default: {}) + format: [ + { + - col_span + - content + } + ] + - table_head (object[]) (default: {}) + format: [ + { + - col_span + - content + } + ] + - rows (object[]) (default: []) + format: [ + { + - active + - alignment + - variant + - cells: [ + { + - col_span + - content + } + ] + } + ] + - attributes (drupal attrs) +#} + +{% set _striped = striped ?? false %} +{% set _hoverable = hoverable ?? false %} +{% set _table_responsive = table_responsive|default('') %} +{% set _variant = variant|default('') %} +{% set _small = small ?? false %} +{% set _alignment = alignment|default('') %} +{% set _caption = caption|default('') %} +{% set _caption_top = caption_top ?? false %} +{% set _border = border|default('') %} +{% set _borderless = borderless ?? false %} +{% set _table_footer = table_footer|default({}) %} +{% set _table_head = table_head|default({}) %} +{% set _rows = rows|default([]) %} + +{% set _classes = ['table'] %} +{% if _striped %} + {% set _classes = _classes|merge(['table-striped']) %} +{% endif %} +{% if _hoverable %} + {% set _classes = _classes|merge(['table-hover']) %} +{% endif %} +{% if _alignment is not empty %} + {% set _classes = _classes|merge(['align-' ~ _alignment]) %} +{% endif %} +{% if _variant is not empty %} + {% set _classes = _classes|merge(['table-' ~ _variant]) %} +{% endif %} +{% if _small %} + {% set _classes = _classes|merge(['table-sm']) %} +{% endif %} +{% if _border is not empty %} + {% set _classes = _classes|merge(['table-bordered', 'border-' ~ _border]) %} +{% endif %} +{% if _borderless %} + {% set _classes = _classes|merge(['table-borderless']) %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +{% if _table_responsive is not empty %} + {% set _responsive_class = 'table-responsive' %} + {% if _table_responsive != 'all' %} + {% set _responsive_class = _responsive_class ~ '-' ~ _table_responsive %} + {% endif %} +
    +{% endif %} + + +{%- if _caption is not empty -%} + +{%- endif -%} +{% if _table_head is not empty %} + + {% if _table_head.cells is not empty and _table_head.cells is iterable %} + + {% for _cell in _table_head.cells %} + + {% endfor %} + + {% endif %} + +{% endif %} + +{% if _rows is not empty and _rows is iterable %} + + {% for _row in _rows %} + {% set _row_class = '' %} + {% if _row.active %} + {% set _row_class = 'table-active' %} + {% endif %} + {% if _row.alignment is not empty %} + {% if _row_class is not empty %} + {% set _row_class = _row_class ~ ' align-' ~ _row.alignment %} + {% else %} + {% set _row_class = 'align-' ~ _row.alignment %} + {% endif %} + {% endif %} + {% if _row.variant is not empty %} + {% if _row_class is not empty %} + {% set _row_class = _row_class ~ ' table-' ~ _row.variant %} + {% else %} + {% set _row_class = 'table-' ~ _row.variant %} + {% endif %} + {% endif %} + + {% if _row.cells is defined and _row.cells is not empty and _row.cells is iterable %} + {% for _cell in _row.cells %} + + {% endfor %} + {% endif %} + + {% endfor %} + +{% endif %} + +{% if _table_footer is not empty %} + + {% if _table_footer.cells is not empty and _table_footer.cells is iterable %} + + {% for _cell in _table_footer.cells %} + + {% endfor %} + + {% endif %} + +{% endif %} +
    + {{- _caption -}} +
    + {{- _cell.content -}} +
    + {{- _cell.content -}} +
    + {{- _cell.content -}} +
    + +{% if _table_responsive is not empty %} +
    +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-textarea/bcl-textarea.html.twig b/assets/bcl/bcl-textarea/bcl-textarea.html.twig new file mode 100644 index 000000000..b9816700a --- /dev/null +++ b/assets/bcl/bcl-textarea/bcl-textarea.html.twig @@ -0,0 +1,149 @@ +{% apply spaceless %} + +{# + Parameters: + - id (string) (default: '') + - label (string) (default: '') + - required (boolean) (default: false) + - disabled (boolean) (default: false) + - readonly (boolean) (default: false) + - invalid (boolean) (default: false) + - valid (boolean) (default: false) + - invalid_feedback (string) (default: '') + - valid_feedback (string) (default: '') + - helper_text (string) (default: '') + - helper_text_id (string) (default: '') + - hidden_label (boolean) (default: false) + - text (string) (default: '') + - rows (int) (default: 4) + - floating (boolean) (default: false) + - horizontal (boolean) (default: false) + - horizontal_class (string) (default: col-sm-10) + - horizontal_label_class (string) (default: col-sm-2) + - attributes (drupal attrs) +#} + +{% set _id = id|default('') %} +{% set _label = label|default('') %} +{% set _required = required ?? false %} +{% set _disabled = disabled ?? false %} +{% set _readonly = readonly ?? false %} +{% set _invalid = invalid ?? false %} +{% set _valid = valid ?? false %} +{% set _invalid_feedback = invalid_feedback|default('') %} +{% set _valid_feedback = valid_feedback|default('') %} +{% set _helper_text = helper_text|default('') %} +{% set _helper_text_id = helper_text_id|default('') %} +{% set _hidden_label = hidden_label ?? false %} +{% set _text = text|default('') %} +{% set _rows = rows|default('4') %} +{% set _floating = floating ?? false %} +{% set _horizontal = horizontal ?? false %} +{% set _horizontal_class = horizontal_class|default('col-sm-10') %} +{% set _horizontal_label_class = horizontal_label_class|default('col-sm-2') %} + +{% set _label_block = false %} +{% set _label_class = 'form-label' %} +{% set _classes = ['form-control'] %} + +{% if _invalid is not empty %} + {% set _classes = _classes|merge(['is-invalid']) %} +{% endif %} +{% if _valid is not empty %} + {% set _classes = _classes|merge(['is-valid']) %} +{% endif %} +{% set _placeholder = placeholder|default('') %} +{% if _horizontal %} + {% set _label_class = 'col-form-label ' ~ _horizontal_label_class %} +{% endif %} +{% if _hidden_label %} + {% set _label_class = _label_class ~ ' visually-hidden' %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes).setAttribute('rows', _rows) %} + +{% if _id %} + {% set attributes = attributes.setAttribute('id', _id) %} +{% endif %} + +{% if _required %} + {% set attributes = attributes.setAttribute('required', true) %} +{% endif %} + +{% if _disabled %} + {% set attributes = attributes.setAttribute('disabled', true) %} +{% endif %} + +{% if _readonly %} + {% set attributes = attributes.setAttribute('readonly', true) %} +{% endif %} + +{% if _placeholder is not empty %} + {% set attributes = attributes.setAttribute('placeholder', _placeholder) %} +{% endif %} + +{% if _helper_text_id is not empty %} + {% set attributes = attributes.setAttribute('aria-describedby', _helper_text_id) %} +{% endif %} + +{% if _floating or _horizontal %} +{% set _wrapper_class = _floating ? 'form-floating' : 'row' %} +
    +{% endif %} +{% if _label is not empty %} + {% set _label_block %} + + {% endset %} +{% endif %} + +{% if _label_block and _floating == false %} + {{ _label_block|raw }} +{% endif %} +{% if _horizontal and floating == false %} +
    +{% endif %} + +{% if _horizontal and floating == false %} +
    +{% endif %} +{% if _label_block and _floating %} + {{ _label_block|raw }} +{% endif %} +{% if _invalid_feedback is not empty %} +
    + {{- _invalid_feedback -}} +
    +{% endif %} +{% if _valid_feedback is not empty %} +
    + {{- _valid_feedback -}} +
    +{% endif %} +{% if _helper_text is not empty %} +
    + {{- _helper_text -}} +
    +{% endif %} +{% if _floating or _horizontal %} +
    +{% endif %} +{% endapply %} diff --git a/assets/bcl/bcl-timeline/bcl-timeline-item.html.twig b/assets/bcl/bcl-timeline/bcl-timeline-item.html.twig new file mode 100644 index 000000000..40596e814 --- /dev/null +++ b/assets/bcl/bcl-timeline/bcl-timeline-item.html.twig @@ -0,0 +1,34 @@ +{% apply spaceless %} + +{# Parameters: + - id (string) (default: '') + - label (string) (default: '') + - title (string) (default: '') + - content (string) (default: '') +#} + +{% set _id = id|default('') %} +{% set _label = label|default('') %} +{% set _title = title|default('') %} +{% set _content = content|default('') %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% if _id is not empty %} + {% set attributes = attributes.setAttribute('id', _id) %} +{% endif %} + +
  • +

    {{ _label }}

    + {% if _title is not empty %} +

    {{ _title }}

    + {% endif %} + {% if _content is not empty %} +
    {{ _content }}
    + {% endif %} +
  • + +{% endapply %} diff --git a/assets/bcl/bcl-timeline/bcl-timeline.html.twig b/assets/bcl/bcl-timeline/bcl-timeline.html.twig new file mode 100644 index 000000000..cab57aea3 --- /dev/null +++ b/assets/bcl/bcl-timeline/bcl-timeline.html.twig @@ -0,0 +1,115 @@ +{% apply spaceless %} + +{# +Parameters: + - id: (integer) (default: random(10000)) + - title: (string) (default: '') + - title_tag: (string) (default: 'h2') + - title_link: (link object) (default: {}) + - title_attributes (drupal attrs) + - toggle_collapsed: (string) (default: '') + - toggle_expanded: (string) (default: '') + - items (array) (default: []): [ + { + id: (string) (default: '') + label: (string) (default: '') + title: (string) (default: '') + content: (block) (default: '') + } + ] + - hide: (object) + format: { + from (integer) (default: items.length) + to (integer) (default: items.length) + } + - icon_path (string) (default: ''): file containing the svg icons +#} + +{% set _id = id|default(random(10000)) %} +{% set _title = title|default('') %} +{% set _title_tag = title_tag|default('h2') %} +{% set _title_link = title_link|default({}) %} +{% set _title_attributes = title_attributes ?: create_attribute() %} +{% set _toggle_collapsed = toggle_collapsed|default('') %} +{% set _toggle_expanded = toggle_expanded|default('') %} +{% set _items = items|default([]) %} +{% set _hide_from = hide.from|default(items|length) %} +{% set _hide_to = hide.to|default(items|length) %} +{% set _icon_path = icon_path|default('') %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass('bcl-timeline') %} + +{# Internal logic - Process properties #} + +{% set _display_amount = items|length %} +{% set _hide_amount = 0 %} +{% set _bottom_amount = 0 %} + +{% if _hide_from > 0 %} + {% if _hide_to > 0 %} + {% set _bottom_amount = _display_amount - _hide_to %} + {% else %} + {% set _bottom_amount = _hide_to|abs %} + {% endif %} + {% set _countbase = items|length - _bottom_amount %} + {% set _display_amount = _hide_from %} + {% set _hide_amount = _countbase - _display_amount %} + {% set _toggle_collapsed = _toggle_collapsed|replace({'%d': _hide_amount}) %} + {% set _toggle_expanded = _toggle_expanded|replace({'%d': _hide_amount}) %} +{% endif %} + +{% if _title is not empty %} + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: _title, + title_tag: _title_tag, + title_link: _title_link, + attributes: _title_attributes, + } only %} +{% endif %} + +{# Print the result #} +
      + {% if _items is not empty %} + {% for _item in _items %} + {# Decide on per item if it should display. #} + {% if _item.attributes is empty %} + {% set _item = _item|merge({ + attributes: create_attribute() + }) %} + {% endif %} + {% if loop.index > _display_amount and loop.revindex > _bottom_amount %} + {% set _item = _item|merge({ + attributes: _item.attributes.addClass('collapse', 'collapse-' ~ _id) + }) %} + {% endif %} + {% include '@oe-bcl/bcl-timeline/timeline-item.html.twig' with _item only %} + {# Display the show more button if required. #} + {% if (_hide_amount > 0 and loop.revindex == _bottom_amount + 1) or (_hide_amount > 0 and _hide_to == 0 and loop.revindex == 1) %} +
    1. + +
    2. + {% endif %} + {% endfor %} + {% endif %} +
    + +{% endapply %} diff --git a/assets/bcl/bcl-toast/bcl-toasts.html.twig b/assets/bcl/bcl-toast/bcl-toasts.html.twig new file mode 100644 index 000000000..63a4bc9a0 --- /dev/null +++ b/assets/bcl/bcl-toast/bcl-toasts.html.twig @@ -0,0 +1,123 @@ +{% apply spaceless %} + +{# + Parameters: + - with_wrapper (boolean) (default: false) + - wrapper_classes (string) (default: '') + - wrapper_aria_live (string) (default: '') + - with_container (boolean) (default: false) + - container_classes (string) (default: '') + - toasts (object[]) format: [ + { + - body (string) (default: '') + - role (string) (default: 'alert') + - with_close (boolean) (default: true) + - autohide (boolean) (default: false) + - with_body_wrapper (boolean) (default: false) + - body_wrapper_classes (string) (default: '') + - attributes (drupal object) (default: undefined) + } + ] + - attributes (drupal attrs) +#} + +{% set _with_wrapper = with_wrapper ?? false %} +{% set _wrapper_classes = wrapper_classes|default('') %} +{% set _wrapper_aria_live = wrapper_aria_live|default('') %} +{% set _with_container = with_container ?? false %} +{% set _toasts = toasts|default([]) %} + +{% set _container_classes = 'toast-container' %} + +{% if container_classes %} + {% set _container_classes = _container_classes ~ ' ' ~ container_classes %} +{% endif %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{# wrapper #} +{% if _with_wrapper %} + {% set attributes = attributes.setAttribute('aria-atomic', "true") %} + {% if _wrapper_aria_live %} + {% set attributes = attributes.setAttribute('aria-live', _wrapper_aria_live) %} + {% endif %} + {% if _wrapper_classes %} + {% set attributes = attributes.addClass(_wrapper_classes|split(' ')) %} + {% endif %} + +
    + +{% endif %} +{# container #} +{% if _with_container %} +
    +{% endif %} +{# toasts #} +{% if _toasts is not empty %} + {% for _toast in _toasts %} + {% set _classes = ['toast'] %} + {% set _body = _toast.body|default('') %} + {% set _role = _toast.role|default('') %} + {% set _with_close = _toast.with_close ?? true %} + {% set _aria_live = _toast.aria_live|default('') %} + {% set _autohide = _toast.autohide ?? true %} + {% set _with_body_wrapper = _toast.with_body_wrapper ?? false %} + {% set _body_wrapper_classes = _toast.body_wrapper_classes|default('') %} + {% set _toast_attributes = _toast.attributes ?: create_attribute() %} + {% set _toast_attributes = _toast_attributes.addClass(_classes).setAttribute('aria-atomic', 'true') %} + {% if _aria_live is not empty %} + {% set _toast_attributes = _toast_attributes.setAttribute('aria-live', _aria_live) %} + {% endif %} + {% if _role is not empty %} + {% set _toast_attributes = _toast_attributes.setAttribute('role', _role) %} + {% endif %} + {% if not _autohide %} + {% set _toast_attributes = _toast_attributes.setAttribute('data-bs-autohide', 'false') %} + {% endif %} +
    + {% if _with_close or + (_toast.header is defined and _toast.header is not empty) + %} +
    + {{- _toast.header|default('') -}} + {% if _with_close %} + {% set button_attributes = create_attribute() + .addClass(['btn-close']) + .setAttribute('aria-label', 'close') + .setAttribute('data-bs-dismiss', 'toast') + %} + {%- include '@oe-bcl/bcl-button/button.html.twig' with { + attributes: button_attributes, + clean_class: true + } only -%} + {% endif %} +
    + {% endif %} + {% if _with_body_wrapper %} +
    + {% endif %} +
    + {{- _body -}} +
    + {% if _with_body_wrapper %} +
    + {% endif %} +
    + {% endfor %} +{% endif %} +{% if _with_container %} +
    +{% endif %} +{% if _with_wrapper %} +
    +{% endif %} + +{% endapply %} diff --git a/assets/bcl/bcl-user/bcl-user-compact.html.twig b/assets/bcl/bcl-user/bcl-user-compact.html.twig new file mode 100644 index 000000000..3aee6364d --- /dev/null +++ b/assets/bcl/bcl-user/bcl-user-compact.html.twig @@ -0,0 +1,64 @@ +{% apply spaceless %} + +{# Parameters: + - picture (object) (default: {}) + format: { + - path (string) (default: '') + - alt (string) (default: '') + - classes (string) (default: '') + } + - name (object) (default: {}) + format: { + - text (string) (default: '') + - link (string) (default: '') + } + - infos (string[]) (default: []) +#} + +{% set _picture = picture|default({}) %} +{% set _name = name|default({}) %} +{% set _infos = infos|default([]) %} + +{% set _picture_classes = 'rounded-pill' %} +{% set _classes = ['bcl-user-compact', 'd-flex', 'mb-3'] %} + +{% if attributes is empty %} + {% set attributes = create_attribute() %} +{% endif %} + +{% set attributes = attributes.addClass(_classes) %} + +{% if _picture is not empty and _picture.classes is not empty %} + {% set _picture_classes = _picture_classes ~ ' ' ~ _picture.classes %} +{% endif %} + +
    +
    + {{ _picture.alt }} +
    +
    + {% if _name.link is not empty %} + {{ _name.text }} + {% else %} +

    {{ _name.text }}

    + {% endif %} + + {% if _infos is not empty %} +
    + {% for _info in _infos %} + {% if _info is not empty %} + {{ _info }} + {% endif %} + {% endfor %} +
    + {% endif %} +
    +
    + +{% endapply %} diff --git a/assets/bcl/bcl-user/bcl-user-terms.html.twig b/assets/bcl/bcl-user/bcl-user-terms.html.twig new file mode 100644 index 000000000..0905d60a3 --- /dev/null +++ b/assets/bcl/bcl-user/bcl-user-terms.html.twig @@ -0,0 +1,11 @@ +{% extends "@oe-bcl/bcl-base-templates/content-type.html.twig" %} + +{% block content %} + {{ get_dummy_text(4, true) }} + + {% include '@oe-bcl/bcl-form/form.html.twig' with terms_form only %} +{% endblock %} diff --git a/assets/bcl/bcl-user/bcl-user.html.twig b/assets/bcl/bcl-user/bcl-user.html.twig new file mode 100644 index 000000000..112ea4c29 --- /dev/null +++ b/assets/bcl/bcl-user/bcl-user.html.twig @@ -0,0 +1,137 @@ +{% extends "@oe-bcl/bcl-base-templates/content-type.html.twig" %} + +{% block content %} + {% include "@oe-bcl/bcl-navigation/navigation.html.twig" with navigation only %} +
    +
    + {% include '@oe-bcl/bcl-content-banner/content-banner.html.twig' with view.banner only %} +
    + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: 'Personal information', + title_tag: 'h2', + attributes: create_attribute().addClass(['mb-4']), + } only %} +
    +
    +
    +
    +

    Gender:

    +
    +
    +

    Male

    +
    +
    +
    +
    +

    Nationality:

    +
    +
    +

    German

    +
    +
    +
    +
    +

    Date of birth:

    +
    +
    +

    22/01/1972

    +
    +
    +
    +
    +
    +
    +

    Country:

    +
    +
    +

    Germany

    +
    +
    +
    +
    +

    City:

    +
    +
    +

    Düsseldorf

    +
    +
    +
    +
    +
    +
    + {% include '@oe-bcl/bcl-heading/heading.html.twig' with { + title: 'Professional information', + title_tag: 'h2', + attributes: create_attribute().addClass(['mb-4']), + } only %} +
    +
    +
    +
    +

    Organisation:

    +
    +
    +

    DG Test

    +
    +
    +
    +
    +

    Position:

    +
    +
    +

    Director

    +
    +
    +
    +
    +
    +
    +

    Working languages:

    +
    +
    +

    English, German

    +
    +
    +
    +
    +
    +
    +
    +

    Edit my profile

    +

    Profile image

    +
    +
    + profile-image +
    +
    +
    + {% include '@oe-bcl/bcl-form-input/form-input.html.twig' with edit.image_upload_input only %} +
    + {% include '@oe-bcl/bcl-button/button.html.twig' with edit.remove_image_button only %} +
    +
    +
    +
    +
    +
    + {% include '@oe-bcl/bcl-form/form.html.twig' with edit.profile_information only %} +
    +
    +
    +
    +

    Privacy settings

    +

    Who can consult my data

    + {% include '@oe-bcl/bcl-form/form.html.twig' with privacy.settings only %} +
    +
    +

    Visibility settings

    +

    Select what information should be displayed to your profile.

    + {% include '@oe-bcl/bcl-form/form.html.twig' with privacy.public_profile_content only %} +
    +
    +

    Are you sure you want to cancel your account?

    +

    When cancelling your account

    + {% include '@oe-bcl/bcl-form/form.html.twig' with cancel.form only %} +
    +
    +{% endblock %} diff --git a/bcl-builder.config.js b/bcl-builder.config.js index bb760d9e4..a934d5361 100644 --- a/bcl-builder.config.js +++ b/bcl-builder.config.js @@ -39,35 +39,5 @@ module.exports = { to: path.resolve(outputFolder, "assets/icons"), options: { up: true }, }, - { - from: ["node_modules/@openeuropa/bcl-theme-default/templates/**/*.twig"], - to: path.resolve(outputFolder, "assets/bcl"), - options: { up: 4 }, - }, - { - from: ["node_modules/@openeuropa/bcl-theme-default/logos/ec/positive/*.svg"], - to: path.resolve(outputFolder, "assets/logos/ec"), - options: { up: true }, - }, - { - from: ["node_modules/@openeuropa/bcl-theme-default/logos/eu/standard-version/**"], - to: path.resolve(outputFolder, "assets/logos/eu"), - options: { up: true }, - }, - { - from: ["node_modules/@openeuropa/bcl-theme-default/logos/eu/condensed-version/**"], - to: path.resolve(outputFolder, "assets/logos/eu/mobile"), - options: { up: true }, - }, - ], - "rename": [ - { - from: path.resolve(outputFolder, "assets/bcl/**/*"), - to: "bcl-", - options: { - search: "!(bcl-)*.html.twig", - operation: "prefix", - }, - }, ], }; diff --git a/bcl/bcl-builder.config.js b/bcl/bcl-builder.config.js new file mode 100644 index 000000000..0ed626ebf --- /dev/null +++ b/bcl/bcl-builder.config.js @@ -0,0 +1,188 @@ +const path = require("path"); +const replace = require("@rollup/plugin-replace"); +const iconList = require("./src/icons/icons"); +const customIconList = require("./src/icons/custom-icons"); + +const outputFolder = '../assets'; +const nodeModules = "../node_modules"; + +// SCSS includePaths +const includePaths = [ + path.resolve(__dirname, 'src/scss'), + path.resolve(__dirname, '../node_modules'), +]; + +module.exports = { + scripts: [ + { + entry: path.resolve(__dirname, "src/js/index.esm.js"), + dest: path.resolve(outputFolder, "js/oe-bcl-default.esm.js"), + options: { + format: "esm", + globals: { "@popperjs/core": "Popper" }, + minify: true, + sourceMap: true, + minifyOptions: { + mangle: true, + format: { + comments: /^!/, + }, + compress: { + passes: 2, + }, + }, + external: ["@popperjs/core"], + }, + }, + { + entry: path.resolve(__dirname, "src/js/index.umd.js"), + dest: path.resolve(outputFolder, "js/oe-bcl-default.umd.js"), + options: { + name: "bootstrap", + minify: true, + sourceMap: true, + minifyOptions: { + mangle: true, + format: { + comments: /^!/, + }, + compress: { + passes: 2, + }, + }, + }, + }, + { + entry: path.resolve(__dirname, "src/js/index.umd.js"), + dest: path.resolve(outputFolder, "js/oe-bcl-default.bundle.js"), + options: { + name: "bootstrap", + minify: true, + sourceMap: true, + minifyOptions: { + mangle: true, + format: { + comments: /^!/, + }, + compress: { + passes: 2, + }, + }, + plugins: [ + replace({ + "process.env.NODE_ENV": '"production"', + preventAssignment: true, + }), + ], + }, + }, + ], + colorScheme: [ + { + entry: path.resolve(__dirname, "src/scss/color-scheme-variables.scss"), + dest: path.resolve(outputFolder, "css/color-scheme.min.css"), + options: { + includePaths, + minify: true, + sourceMap: "file", + importsFile: path.resolve(__dirname, "src/scss/color-scheme.scss"), + generatorFile: path.resolve(__dirname, "src/scss/color_scheme/generator.scss"), + }, + }, + ], + styles: [ + { + entry: path.resolve(__dirname, "src/scss/oe-bcl-default.scss"), + dest: path.resolve(outputFolder, "css/oe-bcl-default.css"), + options: { + includePaths, + sourceMap: "file", + }, + }, + { + entry: path.resolve(__dirname, "src/scss/oe-bcl-default.scss"), + dest: path.resolve(outputFolder, "css/oe-bcl-ckeditor5.min.css"), + options: { + prefixer: { + prefix: ".ck-content", + }, + includePaths, + sourceMap: "file", + minify: true, + }, + }, + { + entry: path.resolve(__dirname, "src/scss/oe-bcl-default.scss"), + dest: path.resolve(outputFolder, "css/oe-bcl-default.min.css"), + options: { + includePaths, + sourceMap: "file", + minify: true, + }, + }, + ], + sprite: [ + { + entry: [ + path.resolve(nodeModules, "@openeuropa/bcl-bootstrap/icons"), + path.resolve(__dirname, "src/icons/custom-icons"), + ], + dest: path.resolve(outputFolder, "icons/"), + options: { + list: [iconList, customIconList], + }, + }, + ], + copy: [ + { + from: [path.resolve(nodeModules, "slim-select/dist/slimselect.min.js")], + to: path.resolve(outputFolder, "js"), + options: { up: true }, + }, + { + from: [path.resolve(nodeModules, "slim-select-2/dist/slimselect.min.js")], + to: path.resolve(outputFolder, "js/slim-select-2"), + options: { up: true }, + }, + { + from: [ + path.resolve( + nodeModules, + "@openeuropa/bcl-bootstrap/bootstrap-icons.svg", + ), + ], + to: path.resolve(outputFolder, "icons"), + options: { up: true }, + }, + { + from: [ + path.resolve( + nodeModules, + "@ecl/resources-flag-icons/dist/sprites/icons-flag.svg", + ), + ], + to: path.resolve(outputFolder, "icons"), + options: { up: true }, + }, + { + from: [`${nodeModules}/flag-icons/flags/**/*.svg`], + to: path.resolve(outputFolder, "icons/world-flags"), + options: { up: 4 }, + }, + { + from: [`${nodeModules}/@ecl/resources-ec-logo/dist/positive/*.svg`], + to: path.resolve(outputFolder, "logos/ec"), + options: { up: true }, + }, + { + from: [`${nodeModules}/@ecl/resources-eu-logo/dist/standard-version/**`], + to: path.resolve(outputFolder, "logos/eu"), + options: { up: true }, + }, + { + from: [`${nodeModules}/@ecl/resources-eu-logo/dist/condensed-version/**`], + to: path.resolve(outputFolder, "logos/eu/mobile"), + options: { up: true }, + }, + ], +}; diff --git a/bcl/bootstrap/bin/build-plugins.js b/bcl/bootstrap/bin/build-plugins.js new file mode 100755 index 000000000..9c7512bd4 --- /dev/null +++ b/bcl/bootstrap/bin/build-plugins.js @@ -0,0 +1,106 @@ +#!/usr/bin/env node + +/*! + * Script to build our plugins to use them separately. + * Copyright 2020-2021 The Bootstrap Authors + * Copyright 2020-2021 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */ + +'use strict' + +const path = require('path') +const rollup = require('rollup') +const { globSync } = require('glob') +const { babel } = require('@rollup/plugin-babel') + +const srcPath = path.resolve(__dirname, '../js/src/') +const jsFiles = globSync(srcPath + '/**/*.js') + +// Array which holds the resolved plugins +const resolvedPlugins = [] + +// Trims the "js" extension and uppercases => first letter, hyphens, backslashes & slashes +const filenameToEntity = filename => filename.replace('.js', '') + .replace(/(?:^|-|\/|\\)[a-z]/g, str => str.slice(-1).toUpperCase()) + +for (const file of jsFiles) { + resolvedPlugins.push({ + src: file.replace('.js', ''), + dist: file.replace('src', 'dist'), + fileName: path.basename(file), + className: filenameToEntity(path.basename(file)) + // safeClassName: filenameToEntity(path.relative(srcPath, file)) + }) +} + +const build = async plugin => { + const globals = {} + + console.log(plugin); + + const bundle = await rollup.rollup({ + input: plugin.src, + plugins: [ + babel({ + // Only transpile our source code + exclude: 'node_modules/**', + // Include the helpers in each file, at most one copy of each + babelHelpers: 'bundled' + }) + ], + external: source => { + // Pattern to identify local files + const pattern = /^(\.{1,2})\// + + // It's not a local file, e.g a Node.js package + if (!pattern.test(source)) { + globals[source] = source + return true + } + + const usedPlugin = resolvedPlugins.find(plugin => { + return plugin.src.includes(source.replace(pattern, '')) + }) + + if (!usedPlugin) { + // It’s just a local JS file (such as ../dom/event-handler.js). Bundle it in. + return false + } + + // We can change `Index` with `UtilIndex` etc if we use + // `safeClassName` instead of `className` everywhere + globals[path.normalize(usedPlugin.src)] = usedPlugin.className + return true + } + }) + + await bundle.write({ + format: 'umd', + name: plugin.className, + sourcemap: true, + globals, + generatedCode: 'es2015', + file: plugin.dist + }) + + console.log(`Built ${plugin.className}`) +} + +(async () => { + try { + const basename = path.basename(__filename) + const timeLabel = `[${basename}] finished` + + console.log('Building individual plugins...') + console.time(timeLabel) + + await Promise.all(Object.values(resolvedPlugins).map(plugin => build(plugin))) + + console.timeEnd(timeLabel) + } catch (error) { + console.error(error) + process.exit(1) + } +})() + \ No newline at end of file diff --git a/bcl/bootstrap/bootstrap-icons.js b/bcl/bootstrap/bootstrap-icons.js new file mode 100644 index 000000000..3b10b6c58 --- /dev/null +++ b/bcl/bootstrap/bootstrap-icons.js @@ -0,0 +1,1537 @@ +export default [ + "123", + "alarm-fill", + "alarm", + "align-bottom", + "align-center", + "align-end", + "align-middle", + "align-start", + "align-top", + "alt", + "app-indicator", + "app", + "archive-fill", + "archive", + "arrow-90deg-down", + "arrow-90deg-left", + "arrow-90deg-right", + "arrow-90deg-up", + "arrow-bar-down", + "arrow-bar-left", + "arrow-bar-right", + "arrow-bar-up", + "arrow-clockwise", + "arrow-counterclockwise", + "arrow-down-circle-fill", + "arrow-down-circle", + "arrow-down-left-circle-fill", + "arrow-down-left-circle", + "arrow-down-left-square-fill", + "arrow-down-left-square", + "arrow-down-left", + "arrow-down-right-circle-fill", + "arrow-down-right-circle", + "arrow-down-right-square-fill", + "arrow-down-right-square", + "arrow-down-right", + "arrow-down-short", + "arrow-down-square-fill", + "arrow-down-square", + "arrow-down-up", + "arrow-down", + "arrow-left-circle-fill", + "arrow-left-circle", + "arrow-left-right", + "arrow-left-short", + "arrow-left-square-fill", + "arrow-left-square", + "arrow-left", + "arrow-repeat", + "arrow-return-left", + "arrow-return-right", + "arrow-right-circle-fill", + "arrow-right-circle", + "arrow-right-short", + "arrow-right-square-fill", + "arrow-right-square", + "arrow-right", + "arrow-up-circle-fill", + "arrow-up-circle", + "arrow-up-left-circle-fill", + "arrow-up-left-circle", + "arrow-up-left-square-fill", + "arrow-up-left-square", + "arrow-up-left", + "arrow-up-right-circle-fill", + "arrow-up-right-circle", + "arrow-up-right-square-fill", + "arrow-up-right-square", + "arrow-up-right", + "arrow-up-short", + "arrow-up-square-fill", + "arrow-up-square", + "arrow-up", + "arrows-angle-contract", + "arrows-angle-expand", + "arrows-collapse", + "arrows-expand", + "arrows-fullscreen", + "arrows-move", + "aspect-ratio-fill", + "aspect-ratio", + "asterisk", + "at", + "award-fill", + "award", + "back", + "backspace-fill", + "backspace-reverse-fill", + "backspace-reverse", + "backspace", + "badge-3d-fill", + "badge-3d", + "badge-4k-fill", + "badge-4k", + "badge-8k-fill", + "badge-8k", + "badge-ad-fill", + "badge-ad", + "badge-ar-fill", + "badge-ar", + "badge-cc-fill", + "badge-cc", + "badge-hd-fill", + "badge-hd", + "badge-tm-fill", + "badge-tm", + "badge-vo-fill", + "badge-vo", + "badge-vr-fill", + "badge-vr", + "badge-wc-fill", + "badge-wc", + "bag-check-fill", + "bag-check", + "bag-dash-fill", + "bag-dash", + "bag-fill", + "bag-plus-fill", + "bag-plus", + "bag-x-fill", + "bag-x", + "bag", + "bar-chart-fill", + "bar-chart-line-fill", + "bar-chart-line", + "bar-chart-steps", + "bar-chart", + "basket-fill", + "basket", + "basket2-fill", + "basket2", + "basket3-fill", + "basket3", + "battery-charging", + "battery-full", + "battery-half", + "battery", + "bell-fill", + "bell", + "bezier", + "bezier2", + "bicycle", + "binoculars-fill", + "binoculars", + "blockquote-left", + "blockquote-right", + "book-fill", + "book-half", + "book", + "bookmark-check-fill", + "bookmark-check", + "bookmark-dash-fill", + "bookmark-dash", + "bookmark-fill", + "bookmark-heart-fill", + "bookmark-heart", + "bookmark-plus-fill", + "bookmark-plus", + "bookmark-star-fill", + "bookmark-star", + "bookmark-x-fill", + "bookmark-x", + "bookmark", + "bookmarks-fill", + "bookmarks", + "bookshelf", + "bootstrap-fill", + "bootstrap-reboot", + "bootstrap", + "border-all", + "border-bottom", + "border-center", + "border-inner", + "border-left", + "border-middle", + "border-outer", + "border-right", + "border-style", + "border-top", + "border-width", + "border", + "bounding-box-circles", + "bounding-box", + "box-arrow-down-left", + "box-arrow-down-right", + "box-arrow-down", + "box-arrow-in-down-left", + "box-arrow-in-down-right", + "box-arrow-in-down", + "box-arrow-in-left", + "box-arrow-in-right", + "box-arrow-in-up-left", + "box-arrow-in-up-right", + "box-arrow-in-up", + "box-arrow-left", + "box-arrow-right", + "box-arrow-up-left", + "box-arrow-up-right", + "box-arrow-up", + "box-seam", + "box", + "braces", + "bricks", + "briefcase-fill", + "briefcase", + "brightness-alt-high-fill", + "brightness-alt-high", + "brightness-alt-low-fill", + "brightness-alt-low", + "brightness-high-fill", + "brightness-high", + "brightness-low-fill", + "brightness-low", + "broadcast-pin", + "broadcast", + "brush-fill", + "brush", + "bucket-fill", + "bucket", + "bug-fill", + "bug", + "building", + "bullseye", + "calculator-fill", + "calculator", + "calendar-check-fill", + "calendar-check", + "calendar-date-fill", + "calendar-date", + "calendar-day-fill", + "calendar-day", + "calendar-event-fill", + "calendar-event", + "calendar-fill", + "calendar-minus-fill", + "calendar-minus", + "calendar-month-fill", + "calendar-month", + "calendar-plus-fill", + "calendar-plus", + "calendar-range-fill", + "calendar-range", + "calendar-week-fill", + "calendar-week", + "calendar-x-fill", + "calendar-x", + "calendar", + "calendar2-check-fill", + "calendar2-check", + "calendar2-date-fill", + "calendar2-date", + "calendar2-day-fill", + "calendar2-day", + "calendar2-event-fill", + "calendar2-event", + "calendar2-fill", + "calendar2-minus-fill", + "calendar2-minus", + "calendar2-month-fill", + "calendar2-month", + "calendar2-plus-fill", + "calendar2-plus", + "calendar2-range-fill", + "calendar2-range", + "calendar2-week-fill", + "calendar2-week", + "calendar2-x-fill", + "calendar2-x", + "calendar2", + "calendar3-event-fill", + "calendar3-event", + "calendar3-fill", + "calendar3-range-fill", + "calendar3-range", + "calendar3-week-fill", + "calendar3-week", + "calendar3", + "calendar4-event", + "calendar4-range", + "calendar4-week", + "calendar4", + "camera-fill", + "camera-reels-fill", + "camera-reels", + "camera-video-fill", + "camera-video-off-fill", + "camera-video-off", + "camera-video", + "camera", + "camera2", + "capslock-fill", + "capslock", + "card-checklist", + "card-heading", + "card-image", + "card-list", + "card-text", + "caret-down-fill", + "caret-down-square-fill", + "caret-down-square", + "caret-down", + "caret-left-fill", + "caret-left-square-fill", + "caret-left-square", + "caret-left", + "caret-right-fill", + "caret-right-square-fill", + "caret-right-square", + "caret-right", + "caret-up-fill", + "caret-up-square-fill", + "caret-up-square", + "caret-up", + "cart-check-fill", + "cart-check", + "cart-dash-fill", + "cart-dash", + "cart-fill", + "cart-plus-fill", + "cart-plus", + "cart-x-fill", + "cart-x", + "cart", + "cart2", + "cart3", + "cart4", + "cash-stack", + "cash", + "cast", + "chat-dots-fill", + "chat-dots", + "chat-fill", + "chat-left-dots-fill", + "chat-left-dots", + "chat-left-fill", + "chat-left-quote-fill", + "chat-left-quote", + "chat-left-text-fill", + "chat-left-text", + "chat-left", + "chat-quote-fill", + "chat-quote", + "chat-right-dots-fill", + "chat-right-dots", + "chat-right-fill", + "chat-right-quote-fill", + "chat-right-quote", + "chat-right-text-fill", + "chat-right-text", + "chat-right", + "chat-square-dots-fill", + "chat-square-dots", + "chat-square-fill", + "chat-square-quote-fill", + "chat-square-quote", + "chat-square-text-fill", + "chat-square-text", + "chat-square", + "chat-text-fill", + "chat-text", + "chat", + "check-all", + "check-circle-fill", + "check-circle", + "check-square-fill", + "check-square", + "check", + "check2-all", + "check2-circle", + "check2-square", + "check2", + "chevron-bar-contract", + "chevron-bar-down", + "chevron-bar-expand", + "chevron-bar-left", + "chevron-bar-right", + "chevron-bar-up", + "chevron-compact-down", + "chevron-compact-left", + "chevron-compact-right", + "chevron-compact-up", + "chevron-contract", + "chevron-double-down", + "chevron-double-left", + "chevron-double-right", + "chevron-double-up", + "chevron-down", + "chevron-expand", + "chevron-left", + "chevron-right", + "chevron-up", + "circle-fill", + "circle-half", + "circle-square", + "circle", + "clipboard-check", + "clipboard-data", + "clipboard-minus", + "clipboard-plus", + "clipboard-x", + "clipboard", + "clock-fill", + "clock-history", + "clock", + "cloud-arrow-down-fill", + "cloud-arrow-down", + "cloud-arrow-up-fill", + "cloud-arrow-up", + "cloud-check-fill", + "cloud-check", + "cloud-download-fill", + "cloud-download", + "cloud-drizzle-fill", + "cloud-drizzle", + "cloud-fill", + "cloud-fog-fill", + "cloud-fog", + "cloud-fog2-fill", + "cloud-fog2", + "cloud-hail-fill", + "cloud-hail", + "cloud-haze-1", + "cloud-haze-fill", + "cloud-haze", + "cloud-haze2-fill", + "cloud-lightning-fill", + "cloud-lightning-rain-fill", + "cloud-lightning-rain", + "cloud-lightning", + "cloud-minus-fill", + "cloud-minus", + "cloud-moon-fill", + "cloud-moon", + "cloud-plus-fill", + "cloud-plus", + "cloud-rain-fill", + "cloud-rain-heavy-fill", + "cloud-rain-heavy", + "cloud-rain", + "cloud-slash-fill", + "cloud-slash", + "cloud-sleet-fill", + "cloud-sleet", + "cloud-snow-fill", + "cloud-snow", + "cloud-sun-fill", + "cloud-sun", + "cloud-upload-fill", + "cloud-upload", + "cloud", + "clouds-fill", + "clouds", + "cloudy-fill", + "cloudy", + "code-slash", + "code-square", + "code", + "collection-fill", + "collection-play-fill", + "collection-play", + "collection", + "columns-gap", + "columns", + "command", + "compass-fill", + "compass", + "cone-striped", + "cone", + "controller", + "cpu-fill", + "cpu", + "credit-card-2-back-fill", + "credit-card-2-back", + "credit-card-2-front-fill", + "credit-card-2-front", + "credit-card-fill", + "credit-card", + "crop", + "cup-fill", + "cup-straw", + "cup", + "cursor-fill", + "cursor-text", + "cursor", + "dash-circle-dotted", + "dash-circle-fill", + "dash-circle", + "dash-square-dotted", + "dash-square-fill", + "dash-square", + "dash", + "diagram-2-fill", + "diagram-2", + "diagram-3-fill", + "diagram-3", + "diamond-fill", + "diamond-half", + "diamond", + "dice-1-fill", + "dice-1", + "dice-2-fill", + "dice-2", + "dice-3-fill", + "dice-3", + "dice-4-fill", + "dice-4", + "dice-5-fill", + "dice-5", + "dice-6-fill", + "dice-6", + "disc-fill", + "disc", + "discord", + "display-fill", + "display", + "distribute-horizontal", + "distribute-vertical", + "door-closed-fill", + "door-closed", + "door-open-fill", + "door-open", + "dot", + "download", + "droplet-fill", + "droplet-half", + "droplet", + "earbuds", + "easel-fill", + "easel", + "egg-fill", + "egg-fried", + "egg", + "eject-fill", + "eject", + "emoji-angry-fill", + "emoji-angry", + "emoji-dizzy-fill", + "emoji-dizzy", + "emoji-expressionless-fill", + "emoji-expressionless", + "emoji-frown-fill", + "emoji-frown", + "emoji-heart-eyes-fill", + "emoji-heart-eyes", + "emoji-laughing-fill", + "emoji-laughing", + "emoji-neutral-fill", + "emoji-neutral", + "emoji-smile-fill", + "emoji-smile-upside-down-fill", + "emoji-smile-upside-down", + "emoji-smile", + "emoji-sunglasses-fill", + "emoji-sunglasses", + "emoji-wink-fill", + "emoji-wink", + "envelope-fill", + "envelope-open-fill", + "envelope-open", + "envelope", + "eraser-fill", + "eraser", + "exclamation-circle-fill", + "exclamation-circle", + "exclamation-diamond-fill", + "exclamation-diamond", + "exclamation-octagon-fill", + "exclamation-octagon", + "exclamation-square-fill", + "exclamation-square", + "exclamation-triangle-fill", + "exclamation-triangle", + "exclamation", + "exclude", + "eye-fill", + "eye-slash-fill", + "eye-slash", + "eye", + "eyedropper", + "eyeglasses", + "facebook", + "file-arrow-down-fill", + "file-arrow-down", + "file-arrow-up-fill", + "file-arrow-up", + "file-bar-graph-fill", + "file-bar-graph", + "file-binary-fill", + "file-binary", + "file-break-fill", + "file-break", + "file-check-fill", + "file-check", + "file-code-fill", + "file-code", + "file-diff-fill", + "file-diff", + "file-earmark-arrow-down-fill", + "file-earmark-arrow-down", + "file-earmark-arrow-up-fill", + "file-earmark-arrow-up", + "file-earmark-bar-graph-fill", + "file-earmark-bar-graph", + "file-earmark-binary-fill", + "file-earmark-binary", + "file-earmark-break-fill", + "file-earmark-break", + "file-earmark-check-fill", + "file-earmark-check", + "file-earmark-code-fill", + "file-earmark-code", + "file-earmark-diff-fill", + "file-earmark-diff", + "file-earmark-easel-fill", + "file-earmark-easel", + "file-earmark-excel-fill", + "file-earmark-excel", + "file-earmark-fill", + "file-earmark-font-fill", + "file-earmark-font", + "file-earmark-image-fill", + "file-earmark-image", + "file-earmark-lock-fill", + "file-earmark-lock", + "file-earmark-lock2-fill", + "file-earmark-lock2", + "file-earmark-medical-fill", + "file-earmark-medical", + "file-earmark-minus-fill", + "file-earmark-minus", + "file-earmark-music-fill", + "file-earmark-music", + "file-earmark-person-fill", + "file-earmark-person", + "file-earmark-play-fill", + "file-earmark-play", + "file-earmark-plus-fill", + "file-earmark-plus", + "file-earmark-post-fill", + "file-earmark-post", + "file-earmark-ppt-fill", + "file-earmark-ppt", + "file-earmark-richtext-fill", + "file-earmark-richtext", + "file-earmark-ruled-fill", + "file-earmark-ruled", + "file-earmark-slides-fill", + "file-earmark-slides", + "file-earmark-spreadsheet-fill", + "file-earmark-spreadsheet", + "file-earmark-text-fill", + "file-earmark-text", + "file-earmark-word-fill", + "file-earmark-word", + "file-earmark-x-fill", + "file-earmark-x", + "file-earmark-zip-fill", + "file-earmark-zip", + "file-earmark", + "file-easel-fill", + "file-easel", + "file-excel-fill", + "file-excel", + "file-fill", + "file-font-fill", + "file-font", + "file-image-fill", + "file-image", + "file-lock-fill", + "file-lock", + "file-lock2-fill", + "file-lock2", + "file-medical-fill", + "file-medical", + "file-minus-fill", + "file-minus", + "file-music-fill", + "file-music", + "file-person-fill", + "file-person", + "file-play-fill", + "file-play", + "file-plus-fill", + "file-plus", + "file-post-fill", + "file-post", + "file-ppt-fill", + "file-ppt", + "file-richtext-fill", + "file-richtext", + "file-ruled-fill", + "file-ruled", + "file-slides-fill", + "file-slides", + "file-spreadsheet-fill", + "file-spreadsheet", + "file-text-fill", + "file-text", + "file-word-fill", + "file-word", + "file-x-fill", + "file-x", + "file-zip-fill", + "file-zip", + "file", + "files-alt", + "files", + "film", + "filter-circle-fill", + "filter-circle", + "filter-left", + "filter-right", + "filter-square-fill", + "filter-square", + "filter", + "flag-fill", + "flag", + "flower1", + "flower2", + "flower3", + "folder-check", + "folder-fill", + "folder-minus", + "folder-plus", + "folder-symlink-fill", + "folder-symlink", + "folder-x", + "folder", + "folder2-open", + "folder2", + "fonts", + "forward-fill", + "forward", + "front", + "fullscreen-exit", + "fullscreen", + "funnel-fill", + "funnel", + "gear-fill", + "gear-wide-connected", + "gear-wide", + "gear", + "gem", + "geo-alt-fill", + "geo-alt", + "geo-fill", + "geo", + "gift-fill", + "gift", + "github", + "globe", + "globe2", + "google", + "graph-down", + "graph-up", + "grid-1x2-fill", + "grid-1x2", + "grid-3x2-gap-fill", + "grid-3x2-gap", + "grid-3x2", + "grid-3x3-gap-fill", + "grid-3x3-gap", + "grid-3x3", + "grid-fill", + "grid", + "grip-horizontal", + "grip-vertical", + "hammer", + "hand-index-fill", + "hand-index-thumb-fill", + "hand-index-thumb", + "hand-index", + "hand-thumbs-down-fill", + "hand-thumbs-down", + "hand-thumbs-up-fill", + "hand-thumbs-up", + "handbag-fill", + "handbag", + "hash", + "hdd-fill", + "hdd-network-fill", + "hdd-network", + "hdd-rack-fill", + "hdd-rack", + "hdd-stack-fill", + "hdd-stack", + "hdd", + "headphones", + "headset", + "heart-fill", + "heart-half", + "heart", + "heptagon-fill", + "heptagon-half", + "heptagon", + "hexagon-fill", + "hexagon-half", + "hexagon", + "hourglass-bottom", + "hourglass-split", + "hourglass-top", + "hourglass", + "house-door-fill", + "house-door", + "house-fill", + "house", + "hr", + "hurricane", + "image-alt", + "image-fill", + "image", + "images", + "inbox-fill", + "inbox", + "inboxes-fill", + "inboxes", + "info-circle-fill", + "info-circle", + "info-square-fill", + "info-square", + "info", + "input-cursor-text", + "input-cursor", + "instagram", + "intersect", + "journal-album", + "journal-arrow-down", + "journal-arrow-up", + "journal-bookmark-fill", + "journal-bookmark", + "journal-check", + "journal-code", + "journal-medical", + "journal-minus", + "journal-plus", + "journal-richtext", + "journal-text", + "journal-x", + "journal", + "journals", + "joystick", + "justify-left", + "justify-right", + "justify", + "kanban-fill", + "kanban", + "key-fill", + "key", + "keyboard-fill", + "keyboard", + "ladder", + "lamp-fill", + "lamp", + "laptop-fill", + "laptop", + "layer-backward", + "layer-forward", + "layers-fill", + "layers-half", + "layers", + "layout-sidebar-inset-reverse", + "layout-sidebar-inset", + "layout-sidebar-reverse", + "layout-sidebar", + "layout-split", + "layout-text-sidebar-reverse", + "layout-text-sidebar", + "layout-text-window-reverse", + "layout-text-window", + "layout-three-columns", + "layout-wtf", + "life-preserver", + "lightbulb-fill", + "lightbulb-off-fill", + "lightbulb-off", + "lightbulb", + "lightning-charge-fill", + "lightning-charge", + "lightning-fill", + "lightning", + "link-45deg", + "link", + "linkedin", + "list-check", + "list-nested", + "list-ol", + "list-stars", + "list-task", + "list-ul", + "list", + "lock-fill", + "lock", + "mailbox", + "mailbox2", + "map-fill", + "map", + "markdown-fill", + "markdown", + "mask", + "megaphone-fill", + "megaphone", + "menu-app-fill", + "menu-app", + "menu-button-fill", + "menu-button-wide-fill", + "menu-button-wide", + "menu-button", + "menu-down", + "menu-up", + "mic-fill", + "mic-mute-fill", + "mic-mute", + "mic", + "minecart-loaded", + "minecart", + "moisture", + "moon-fill", + "moon-stars-fill", + "moon-stars", + "moon", + "mouse-fill", + "mouse", + "mouse2-fill", + "mouse2", + "mouse3-fill", + "mouse3", + "music-note-beamed", + "music-note-list", + "music-note", + "music-player-fill", + "music-player", + "newspaper", + "node-minus-fill", + "node-minus", + "node-plus-fill", + "node-plus", + "nut-fill", + "nut", + "octagon-fill", + "octagon-half", + "octagon", + "option", + "outlet", + "paint-bucket", + "palette-fill", + "palette", + "palette2", + "paperclip", + "paragraph", + "patch-check-fill", + "patch-check", + "patch-exclamation-fill", + "patch-exclamation", + "patch-minus-fill", + "patch-minus", + "patch-plus-fill", + "patch-plus", + "patch-question-fill", + "patch-question", + "pause-btn-fill", + "pause-btn", + "pause-circle-fill", + "pause-circle", + "pause-fill", + "pause", + "peace-fill", + "peace", + "pen-fill", + "pen", + "pencil-fill", + "pencil-square", + "pencil", + "pentagon-fill", + "pentagon-half", + "pentagon", + "people-fill", + "people", + "percent", + "person-badge-fill", + "person-badge", + "person-bounding-box", + "person-check-fill", + "person-check", + "person-circle", + "person-dash-fill", + "person-dash", + "person-fill", + "person-lines-fill", + "person-plus-fill", + "person-plus", + "person-square", + "person-x-fill", + "person-x", + "person", + "phone-fill", + "phone-landscape-fill", + "phone-landscape", + "phone-vibrate-fill", + "phone-vibrate", + "phone", + "pie-chart-fill", + "pie-chart", + "pin-angle-fill", + "pin-angle", + "pin-fill", + "pin", + "pip-fill", + "pip", + "play-btn-fill", + "play-btn", + "play-circle-fill", + "play-circle", + "play-fill", + "play", + "plug-fill", + "plug", + "plus-circle-dotted", + "plus-circle-fill", + "plus-circle", + "plus-square-dotted", + "plus-square-fill", + "plus-square", + "plus", + "power", + "printer-fill", + "printer", + "puzzle-fill", + "puzzle", + "question-circle-fill", + "question-circle", + "question-diamond-fill", + "question-diamond", + "question-octagon-fill", + "question-octagon", + "question-square-fill", + "question-square", + "question", + "rainbow", + "receipt-cutoff", + "receipt", + "reception-0", + "reception-1", + "reception-2", + "reception-3", + "reception-4", + "record-btn-fill", + "record-btn", + "record-circle-fill", + "record-circle", + "record-fill", + "record", + "record2-fill", + "record2", + "reply-all-fill", + "reply-all", + "reply-fill", + "reply", + "rss-fill", + "rss", + "rulers", + "save-fill", + "save", + "save2-fill", + "save2", + "scissors", + "screwdriver", + "search", + "segmented-nav", + "server", + "share-fill", + "share", + "shield-check", + "shield-exclamation", + "shield-fill-check", + "shield-fill-exclamation", + "shield-fill-minus", + "shield-fill-plus", + "shield-fill-x", + "shield-fill", + "shield-lock-fill", + "shield-lock", + "shield-minus", + "shield-plus", + "shield-shaded", + "shield-slash-fill", + "shield-slash", + "shield-x", + "shield", + "shift-fill", + "shift", + "shop-window", + "shop", + "shuffle", + "signpost-2-fill", + "signpost-2", + "signpost-fill", + "signpost-split-fill", + "signpost-split", + "signpost", + "sim-fill", + "sim", + "skip-backward-btn-fill", + "skip-backward-btn", + "skip-backward-circle-fill", + "skip-backward-circle", + "skip-backward-fill", + "skip-backward", + "skip-end-btn-fill", + "skip-end-btn", + "skip-end-circle-fill", + "skip-end-circle", + "skip-end-fill", + "skip-end", + "skip-forward-btn-fill", + "skip-forward-btn", + "skip-forward-circle-fill", + "skip-forward-circle", + "skip-forward-fill", + "skip-forward", + "skip-start-btn-fill", + "skip-start-btn", + "skip-start-circle-fill", + "skip-start-circle", + "skip-start-fill", + "skip-start", + "slack", + "slash-circle-fill", + "slash-circle", + "slash-square-fill", + "slash-square", + "slash", + "sliders", + "smartwatch", + "snow", + "snow2", + "snow3", + "sort-alpha-down-alt", + "sort-alpha-down", + "sort-alpha-up-alt", + "sort-alpha-up", + "sort-down-alt", + "sort-down", + "sort-numeric-down-alt", + "sort-numeric-down", + "sort-numeric-up-alt", + "sort-numeric-up", + "sort-up-alt", + "sort-up", + "soundwave", + "speaker-fill", + "speaker", + "speedometer", + "speedometer2", + "spellcheck", + "square-fill", + "square-half", + "square", + "stack", + "star-fill", + "star-half", + "star", + "stars", + "stickies-fill", + "stickies", + "sticky-fill", + "sticky", + "stop-btn-fill", + "stop-btn", + "stop-circle-fill", + "stop-circle", + "stop-fill", + "stop", + "stoplights-fill", + "stoplights", + "stopwatch-fill", + "stopwatch", + "subtract", + "suit-club-fill", + "suit-club", + "suit-diamond-fill", + "suit-diamond", + "suit-heart-fill", + "suit-heart", + "suit-spade-fill", + "suit-spade", + "sun-fill", + "sun", + "sunglasses", + "sunrise-fill", + "sunrise", + "sunset-fill", + "sunset", + "symmetry-horizontal", + "symmetry-vertical", + "table", + "tablet-fill", + "tablet-landscape-fill", + "tablet-landscape", + "tablet", + "tag-fill", + "tag", + "tags-fill", + "tags", + "telegram", + "telephone-fill", + "telephone-forward-fill", + "telephone-forward", + "telephone-inbound-fill", + "telephone-inbound", + "telephone-minus-fill", + "telephone-minus", + "telephone-outbound-fill", + "telephone-outbound", + "telephone-plus-fill", + "telephone-plus", + "telephone-x-fill", + "telephone-x", + "telephone", + "terminal-fill", + "terminal", + "text-center", + "text-indent-left", + "text-indent-right", + "text-left", + "text-paragraph", + "text-right", + "textarea-resize", + "textarea-t", + "textarea", + "thermometer-half", + "thermometer-high", + "thermometer-low", + "thermometer-snow", + "thermometer-sun", + "thermometer", + "three-dots-vertical", + "three-dots", + "toggle-off", + "toggle-on", + "toggle2-off", + "toggle2-on", + "toggles", + "toggles2", + "tools", + "tornado", + "trash-fill", + "trash", + "trash2-fill", + "trash2", + "tree-fill", + "tree", + "triangle-fill", + "triangle-half", + "triangle", + "trophy-fill", + "trophy", + "tropical-storm", + "truck-flatbed", + "truck", + "tsunami", + "tv-fill", + "tv", + "twitch", + "twitter", + "type-bold", + "type-h1", + "type-h2", + "type-h3", + "type-italic", + "type-strikethrough", + "type-underline", + "type", + "ui-checks-grid", + "ui-checks", + "ui-radios-grid", + "ui-radios", + "umbrella-fill", + "umbrella", + "union", + "unlock-fill", + "unlock", + "upc-scan", + "upc", + "upload", + "vector-pen", + "view-list", + "view-stacked", + "vinyl-fill", + "vinyl", + "voicemail", + "volume-down-fill", + "volume-down", + "volume-mute-fill", + "volume-mute", + "volume-off-fill", + "volume-off", + "volume-up-fill", + "volume-up", + "vr", + "wallet-fill", + "wallet", + "wallet2", + "watch", + "water", + "whatsapp", + "wifi-1", + "wifi-2", + "wifi-off", + "wifi", + "wind", + "window-dock", + "window-sidebar", + "window", + "wrench", + "x-circle-fill", + "x-circle", + "x-diamond-fill", + "x-diamond", + "x-octagon-fill", + "x-octagon", + "x-square-fill", + "x-square", + "x", + "youtube", + "zoom-in", + "zoom-out", + "bank", + "bank2", + "bell-slash-fill", + "bell-slash", + "cash-coin", + "check-lg", + "coin", + "currency-bitcoin", + "currency-dollar", + "currency-euro", + "currency-exchange", + "currency-pound", + "currency-yen", + "dash-lg", + "exclamation-lg", + "file-earmark-pdf-fill", + "file-earmark-pdf", + "file-pdf-fill", + "file-pdf", + "gender-ambiguous", + "gender-female", + "gender-male", + "gender-trans", + "headset-vr", + "info-lg", + "mastodon", + "messenger", + "piggy-bank-fill", + "piggy-bank", + "pin-map-fill", + "pin-map", + "plus-lg", + "question-lg", + "recycle", + "reddit", + "safe-fill", + "safe2-fill", + "safe2", + "sd-card-fill", + "sd-card", + "skype", + "slash-lg", + "translate", + "x-lg", + "safe", + "apple", + "microsoft", + "windows", + "behance", + "dribbble", + "line", + "medium", + "paypal", + "pinterest", + "signal", + "snapchat", + "spotify", + "stack-overflow", + "strava", + "wordpress", + "vimeo", + "activity", + "easel2-fill", + "easel2", + "easel3-fill", + "easel3", + "fan", + "fingerprint", + "graph-down-arrow", + "graph-up-arrow", + "hypnotize", + "magic", + "person-rolodex", + "person-video", + "person-video2", + "person-video3", + "person-workspace", + "radioactive", + "webcam-fill", + "webcam", + "yin-yang", + "bandaid-fill", + "bandaid", + "bluetooth", + "body-text", + "boombox", + "boxes", + "dpad-fill", + "dpad", + "ear-fill", + "ear", + "envelope-check-1", + "envelope-check-fill", + "envelope-check", + "envelope-dash-1", + "envelope-dash-fill", + "envelope-dash", + "envelope-exclamation-1", + "envelope-exclamation-fill", + "envelope-exclamation", + "envelope-plus-fill", + "envelope-plus", + "envelope-slash-1", + "envelope-slash-fill", + "envelope-slash", + "envelope-x-1", + "envelope-x-fill", + "envelope-x", + "explicit-fill", + "explicit", + "git", + "infinity", + "list-columns-reverse", + "list-columns", + "meta", + "mortorboard-fill", + "mortorboard", + "nintendo-switch", + "pc-display-horizontal", + "pc-display", + "pc-horizontal", + "pc", + "playstation", + "plus-slash-minus", + "projector-fill", + "projector", + "qr-code-scan", + "qr-code", + "quora", + "quote", + "robot", + "send-check-fill", + "send-check", + "send-dash-fill", + "send-dash", + "send-exclamation-1", + "send-exclamation-fill", + "send-exclamation", + "send-fill", + "send-plus-fill", + "send-plus", + "send-slash-fill", + "send-slash", + "send-x-fill", + "send-x", + "send", + "steam", + "terminal-dash-1", + "terminal-dash", + "terminal-plus", + "terminal-split", + "ticket-detailed-fill", + "ticket-detailed", + "ticket-fill", + "ticket-perferated-fill", + "ticket-perferated", + "ticket", + "tiktok", + "window-dash", + "window-desktop", + "window-fullscreen", + "window-plus", + "window-split", + "window-stack", + "window-x", + "xbox", + "ethernet", + "hdmi-fill", + "hdmi", + "usb-c-fill", + "usb-c", + "usb-fill", + "usb-plug-fill", + "usb-plug", + "usb-symbol", + "usb", + "boombox-fill", + "displayport-1", + "displayport", + "gpu-card", + "memory", + "modem-fill", + "modem", + "motherboard-fill", + "motherboard", + "optical-audio-fill", + "optical-audio", + "pci-card", + "router-fill", + "router", + "ssd-fill", + "ssd", + "thunderbolt-fill", + "thunderbolt", + "usb-drive-fill", + "usb-drive", + "usb-micro-fill", + "usb-micro", + "usb-mini-fill", + "usb-mini", + "cloud-haze2", + "device-hdd-fill", + "device-hdd", + "device-ssd-fill", + "device-ssd", + "displayport-fill", + "mortarboard-fill", + "mortarboard", + "terminal-x" +] diff --git a/bcl/bootstrap/legacy/dependency/manipulator.js b/bcl/bootstrap/legacy/dependency/manipulator.js new file mode 100644 index 000000000..bdec344f9 --- /dev/null +++ b/bcl/bootstrap/legacy/dependency/manipulator.js @@ -0,0 +1,80 @@ +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.3): dom/manipulator.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + + function normalizeData(val) { + if (val === 'true') { + return true + } + + if (val === 'false') { + return false + } + + if (val === Number(val).toString()) { + return Number(val) + } + + if (val === '' || val === 'null') { + return null + } + + return val +} + +function normalizeDataKey(key) { + return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`) +} + +const Manipulator = { + setDataAttribute(element, key, value) { + element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value) + }, + + removeDataAttribute(element, key) { + element.removeAttribute(`data-bs-${normalizeDataKey(key)}`) + }, + + getDataAttributes(element) { + if (!element) { + return {} + } + + const attributes = {} + + Object.keys(element.dataset) + .filter(key => key.startsWith('bs')) + .forEach(key => { + let pureKey = key.replace(/^bs/, '') + pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length) + attributes[pureKey] = normalizeData(element.dataset[key]) + }) + + return attributes + }, + + getDataAttribute(element, key) { + return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)) + }, + + offset(element) { + const rect = element.getBoundingClientRect() + + return { + top: rect.top + window.pageYOffset, + left: rect.left + window.pageXOffset + } + }, + + position(element) { + return { + top: element.offsetTop, + left: element.offsetLeft + } + } +} + +export default Manipulator diff --git a/bcl/bootstrap/legacy/dependency/util/index.js b/bcl/bootstrap/legacy/dependency/util/index.js new file mode 100644 index 000000000..297e57149 --- /dev/null +++ b/bcl/bootstrap/legacy/dependency/util/index.js @@ -0,0 +1,336 @@ +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.2.3): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +const MAX_UID = 1_000_000 +const MILLISECONDS_MULTIPLIER = 1000 +const TRANSITION_END = 'transitionend' + +// Shout-out Angus Croll (https://goo.gl/pxwQGp) +const toType = object => { + if (object === null || object === undefined) { + return `${object}` + } + + return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase() +} + +/** + * Public Util API + */ + +const getUID = prefix => { + do { + prefix += Math.floor(Math.random() * MAX_UID) + } while (document.getElementById(prefix)) + + return prefix +} + +const getSelector = element => { + let selector = element.getAttribute('data-bs-target') + + if (!selector || selector === '#') { + let hrefAttribute = element.getAttribute('href') + + // The only valid content that could double as a selector are IDs or classes, + // so everything starting with `#` or `.`. If a "real" URL is used as the selector, + // `document.querySelector` will rightfully complain it is invalid. + // See https://github.com/twbs/bootstrap/issues/32273 + if (!hrefAttribute || (!hrefAttribute.includes('#') && !hrefAttribute.startsWith('.'))) { + return null + } + + // Just in case some CMS puts out a full URL with the anchor appended + if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) { + hrefAttribute = `#${hrefAttribute.split('#')[1]}` + } + + selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null + } + + return selector +} + +const getSelectorFromElement = element => { + const selector = getSelector(element) + + if (selector) { + return document.querySelector(selector) ? selector : null + } + + return null +} + +const getElementFromSelector = element => { + const selector = getSelector(element) + + return selector ? document.querySelector(selector) : null +} + +const getTransitionDurationFromElement = element => { + if (!element) { + return 0 + } + + // Get transition-duration of the element + let { transitionDuration, transitionDelay } = window.getComputedStyle(element) + + const floatTransitionDuration = Number.parseFloat(transitionDuration) + const floatTransitionDelay = Number.parseFloat(transitionDelay) + + // Return 0 if element or transition duration is not found + if (!floatTransitionDuration && !floatTransitionDelay) { + return 0 + } + + // If multiple durations are defined, take the first + transitionDuration = transitionDuration.split(',')[0] + transitionDelay = transitionDelay.split(',')[0] + + return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER +} + +const triggerTransitionEnd = element => { + element.dispatchEvent(new Event(TRANSITION_END)) +} + +const isElement = object => { + if (!object || typeof object !== 'object') { + return false + } + + if (typeof object.jquery !== 'undefined') { + object = object[0] + } + + return typeof object.nodeType !== 'undefined' +} + +const getElement = object => { + // it's a jQuery object or a node element + if (isElement(object)) { + return object.jquery ? object[0] : object + } + + if (typeof object === 'string' && object.length > 0) { + return document.querySelector(object) + } + + return null +} + +const isVisible = element => { + if (!isElement(element) || element.getClientRects().length === 0) { + return false + } + + const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible' + // Handle `details` element as its content may falsie appear visible when it is closed + const closedDetails = element.closest('details:not([open])') + + if (!closedDetails) { + return elementIsVisible + } + + if (closedDetails !== element) { + const summary = element.closest('summary') + if (summary && summary.parentNode !== closedDetails) { + return false + } + + if (summary === null) { + return false + } + } + + return elementIsVisible +} + +const isDisabled = element => { + if (!element || element.nodeType !== Node.ELEMENT_NODE) { + return true + } + + if (element.classList.contains('disabled')) { + return true + } + + if (typeof element.disabled !== 'undefined') { + return element.disabled + } + + return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false' +} + +const findShadowRoot = element => { + if (!document.documentElement.attachShadow) { + return null + } + + // Can find the shadow root otherwise it'll return the document + if (typeof element.getRootNode === 'function') { + const root = element.getRootNode() + return root instanceof ShadowRoot ? root : null + } + + if (element instanceof ShadowRoot) { + return element + } + + // when we don't find a shadow root + if (!element.parentNode) { + return null + } + + return findShadowRoot(element.parentNode) +} + +const noop = () => {} + +/** + * Trick to restart an element's animation + * + * @param {HTMLElement} element + * @return void + * + * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation + */ +const reflow = element => { + element.offsetHeight // eslint-disable-line no-unused-expressions +} + +const getjQuery = () => { + if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { + return window.jQuery + } + + return null +} + +const DOMContentLoadedCallbacks = [] + +const onDOMContentLoaded = callback => { + if (document.readyState === 'loading') { + // add listener on the first call when the document is in loading state + if (!DOMContentLoadedCallbacks.length) { + document.addEventListener('DOMContentLoaded', () => { + for (const callback of DOMContentLoadedCallbacks) { + callback() + } + }) + } + + DOMContentLoadedCallbacks.push(callback) + } else { + callback() + } +} + +const isRTL = () => document.documentElement.dir === 'rtl' + +const defineJQueryPlugin = plugin => { + onDOMContentLoaded(() => { + const $ = getjQuery() + /* istanbul ignore if */ + if ($) { + const name = plugin.NAME + const JQUERY_NO_CONFLICT = $.fn[name] + $.fn[name] = plugin.jQueryInterface + $.fn[name].Constructor = plugin + $.fn[name].noConflict = () => { + $.fn[name] = JQUERY_NO_CONFLICT + return plugin.jQueryInterface + } + } + }) +} + +const execute = callback => { + if (typeof callback === 'function') { + callback() + } +} + +const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => { + if (!waitForTransition) { + execute(callback) + return + } + + const durationPadding = 5 + const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding + + let called = false + + const handler = ({ target }) => { + if (target !== transitionElement) { + return + } + + called = true + transitionElement.removeEventListener(TRANSITION_END, handler) + execute(callback) + } + + transitionElement.addEventListener(TRANSITION_END, handler) + setTimeout(() => { + if (!called) { + triggerTransitionEnd(transitionElement) + } + }, emulatedDuration) +} + +/** + * Return the previous/next element of a list. + * + * @param {array} list The list of elements + * @param activeElement The active element + * @param shouldGetNext Choose to get next or previous element + * @param isCycleAllowed + * @return {Element|elem} The proper element + */ +const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { + const listLength = list.length + let index = list.indexOf(activeElement) + + // if the element does not exist in the list return an element + // depending on the direction and if cycle is allowed + if (index === -1) { + return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0] + } + + index += shouldGetNext ? 1 : -1 + + if (isCycleAllowed) { + index = (index + listLength) % listLength + } + + return list[Math.max(0, Math.min(index, listLength - 1))] +} + +export { + defineJQueryPlugin, + execute, + executeAfterTransition, + findShadowRoot, + getElement, + getElementFromSelector, + getjQuery, + getNextActiveElement, + getSelectorFromElement, + getTransitionDurationFromElement, + getUID, + isDisabled, + isElement, + isRTL, + isVisible, + noop, + onDOMContentLoaded, + reflow, + triggerTransitionEnd, + toType +} diff --git a/bcl/bootstrap/legacy/scrollspy-legacy.js b/bcl/bootstrap/legacy/scrollspy-legacy.js new file mode 100644 index 000000000..bfd9cfcff --- /dev/null +++ b/bcl/bootstrap/legacy/scrollspy-legacy.js @@ -0,0 +1,294 @@ +/** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.3): scrollspy.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ + +// Old versions +import Manipulator from './dependency/manipulator' + + import { + defineJQueryPlugin, + getElement, + getSelectorFromElement, +} from './dependency/util/index' +import EventHandler from './dom/event-handler' +import SelectorEngine from './dom/selector-engine' +import BaseComponent from './base-component' + +/** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + +const NAME = 'scrollspy' +const DATA_KEY = 'bs.scrollspy' +const EVENT_KEY = `.${DATA_KEY}` +const DATA_API_KEY = '.data-api' + +const Default = { + offset: 10, + method: 'auto', + target: '' +} + +const DefaultType = { + offset: 'number', + method: 'string', + target: '(string|element)' +} + +const EVENT_ACTIVATE = `activate${EVENT_KEY}` +const EVENT_SCROLL = `scroll${EVENT_KEY}` +const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}` + +const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item' +const CLASS_NAME_ACTIVE = 'active' + +const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]' +const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group' +const SELECTOR_NAV_LINKS = '.nav-link' +const SELECTOR_NAV_ITEMS = '.nav-item' +const SELECTOR_LIST_ITEMS = '.list-group-item' +const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}` +const SELECTOR_DROPDOWN = '.dropdown' +const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle' + +const METHOD_OFFSET = 'offset' +const METHOD_POSITION = 'position' + +/** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + +class ScrollSpy extends BaseComponent { + constructor(element, config) { + super(element) + this._scrollElement = this._element.tagName === 'BODY' ? window : this._element + this._config = this._getConfig(config) + this._offsets = [] + this._targets = [] + this._activeTarget = null + this._scrollHeight = 0 + + EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process()) + + this.refresh() + this._process() + } + + // Getters + + static get Default() { + return Default + } + + static get NAME() { + return NAME + } + + // Public + + refresh() { + const autoMethod = this._scrollElement === this._scrollElement.window ? + METHOD_OFFSET : + METHOD_POSITION + + const offsetMethod = this._config.method === 'auto' ? + autoMethod : + this._config.method + + const offsetBase = offsetMethod === METHOD_POSITION ? + this._getScrollTop() : + 0 + + this._offsets = [] + this._targets = [] + this._scrollHeight = this._getScrollHeight() + + const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target) + + targets.map(element => { + const targetSelector = getSelectorFromElement(element) + const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null + + if (target) { + const targetBCR = target.getBoundingClientRect() + if (targetBCR.width || targetBCR.height) { + return [ + Manipulator[offsetMethod](target).top + offsetBase, + targetSelector + ] + } + } + + return null + }) + .filter(item => item) + .sort((a, b) => a[0] - b[0]) + .forEach(item => { + this._offsets.push(item[0]) + this._targets.push(item[1]) + }) + } + + dispose() { + EventHandler.off(this._scrollElement, EVENT_KEY) + super.dispose() + } + + // Private + + _getConfig(config) { + config = { + ...Default, + ...Manipulator.getDataAttributes(this._element), + ...(typeof config === 'object' && config ? config : {}) + } + + config.target = getElement(config.target) || document.documentElement + + return config + } + + _getScrollTop() { + return this._scrollElement === window ? + this._scrollElement.pageYOffset : + this._scrollElement.scrollTop + } + + _getScrollHeight() { + return this._scrollElement.scrollHeight || Math.max( + document.body.scrollHeight, + document.documentElement.scrollHeight + ) + } + + _getOffsetHeight() { + return this._scrollElement === window ? + window.innerHeight : + this._scrollElement.getBoundingClientRect().height + } + + _process() { + const scrollTop = this._getScrollTop() + this._config.offset + const scrollHeight = this._getScrollHeight() + const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight() + + if (this._scrollHeight !== scrollHeight) { + this.refresh() + } + + if (scrollTop >= maxScroll) { + const target = this._targets[this._targets.length - 1] + + if (this._activeTarget !== target) { + this._activate(target) + } + + return + } + + if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { + this._activeTarget = null + this._clear() + return + } + + for (let i = this._offsets.length; i--;) { + const isActiveTarget = this._activeTarget !== this._targets[i] && + scrollTop >= this._offsets[i] && + (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]) + + if (isActiveTarget) { + this._activate(this._targets[i]) + } + } + } + + _activate(target) { + this._activeTarget = target + + this._clear() + + const queries = SELECTOR_LINK_ITEMS.split(',') + .map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`) + + const link = SelectorEngine.findOne(queries.join(','), this._config.target) + + link.classList.add(CLASS_NAME_ACTIVE) + if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { + SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)) + .classList.add(CLASS_NAME_ACTIVE) + } else { + SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP) + .forEach(listGroup => { + // Set triggered links parents as active + // With both