Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -11,6 +17,7 @@
/runner.yml
/.idea/
/package-lock.json
**/package-lock.json
/phpunit.xml
/.stylelintrc.json
/docker-compose.*.yml
Expand Down
1 change: 0 additions & 1 deletion assets/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/bcl/
/css/
/icons/
/js/
Expand Down
144 changes: 144 additions & 0 deletions assets/bcl/bcl-accordion/bcl-accordion.html.twig
Original file line number Diff line number Diff line change
@@ -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 %}
<div
{{ attributes }}
>
{%- 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']) %}
<div
{{ wrapper_attributes }}
>
{% 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 %}
</div>
{% endif %}
<div class="accordion-items-wrapper">
{% 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 %}
<div class="accordion-item">
{%- 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 %}
<span>
{{- _item.title -}}
</span>
{% endset %}
{% include '@oe-bcl/bcl-button/button.html.twig' with {
label: item_title,
clean_class: true,
attributes: button_attributes
} only %}
</{{ _item_title_tag }}>
<div
id="collapse-{{ _id }}-{{ loop.index }}"
class="accordion-collapse collapse{{ _open_item ? ' show' }}"
aria-labelledby="heading-{{ _id }}-{{ loop.index }}"
role="region"
{% if not _item.stay_open and _expand_button is empty %}
data-bs-parent="#accordion-{{ _id }}"
{% endif %}
>
<div class="accordion-body">
{%- set _content = _item.content|default('') %}
{%- block content _content -%}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}

{% endapply %}
83 changes: 83 additions & 0 deletions assets/bcl/bcl-alert/bcl-alert.html.twig
Original file line number Diff line number Diff line change
@@ -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') %}

<div {{ attributes }}>
{% 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 %}
<div class="alert-content flex-grow-1">
{%- if _heading is not empty -%}
<div class="alert-heading h4">{{ _heading }}</div>
{%- endif -%}
{%- if _message is not empty -%}
{{- _message -}}
{%- endif -%}
</div>
{%- if _dismissible -%}
<button
type="button"
class="btn-close"
data-bs-dismiss="alert"
aria-label="Close">
</button>
{%- endif -%}
</div>

{% endapply %}
79 changes: 79 additions & 0 deletions assets/bcl/bcl-badge/bcl-badge.html.twig
Original file line number Diff line number Diff line change
@@ -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 -%}
<span class="visually-hidden">
{{- _assistive_text -}}
</span>
{%- endif -%}
{{- _label -}}
{%- if _dismissible -%}
<span class="icon--close" aria-hidden="true">
{% include '@oe-bcl/bcl-icon/icon.html.twig' with {
name: "x-circle-fill",
size: "xs",
path: _icon_path,
} only %}
</span>
{%- endif -%}
{% endset %}

{%- if _url is not empty -%}
{% include '@oe-bcl/bcl-link/link.html.twig' with {
label: _label,
path: _url,
attributes: attributes,
} only %}
{%- else -%}
<span
{{ attributes }}
>
{{- _label -}}
</span>
{%- endif -%}

{% endapply %}
Loading