@openeuropa/bcl-file 0.1.202408021145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/file-translations.html.twig +93 -0
- package/file.html.twig +164 -0
- package/package.json +30 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-2021 Mark Otto
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{% apply spaceless %}
|
|
2
|
+
|
|
3
|
+
{# Parameters:
|
|
4
|
+
- id (string) (default: language-dropdown-random(1000))
|
|
5
|
+
- label (string) (default: '')
|
|
6
|
+
- icon_path (string) (default: '')
|
|
7
|
+
- items (string) (default: [])
|
|
8
|
+
format: [
|
|
9
|
+
{
|
|
10
|
+
extension: '',
|
|
11
|
+
language: '',
|
|
12
|
+
size: '',
|
|
13
|
+
download: {}, - link Object
|
|
14
|
+
},
|
|
15
|
+
]
|
|
16
|
+
#}
|
|
17
|
+
|
|
18
|
+
{% set _id = id|default('language-dropdown' ~ random(1000)) %}
|
|
19
|
+
{% set _label = label|default('') %}
|
|
20
|
+
{% set _icon_path = icon_path|default('') %}
|
|
21
|
+
{% set _items = items|default([]) %}
|
|
22
|
+
|
|
23
|
+
{% if attributes is empty %}
|
|
24
|
+
{% set attributes = create_attribute() %}
|
|
25
|
+
{% endif %}
|
|
26
|
+
|
|
27
|
+
{% set attributes = attributes.addClass(['bg-lighter', 'py-3', 'px-4', 'border-top']) %}
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
{{ attributes }}>
|
|
31
|
+
<div class="text-end text-md-center">
|
|
32
|
+
{% include '@oe-bcl/bcl-link/link.html.twig' with _label|merge({
|
|
33
|
+
path: '#' ~ _id,
|
|
34
|
+
attributes: create_attribute()
|
|
35
|
+
.addClass(['standalone'])
|
|
36
|
+
.setAttribute('aria-controls', _id)
|
|
37
|
+
.setAttribute('data-bs-toggle', 'collapse')
|
|
38
|
+
.setAttribute('aria-expanded', 'false')
|
|
39
|
+
.setAttribute('role', 'button'),
|
|
40
|
+
}) only %}
|
|
41
|
+
</div>
|
|
42
|
+
{% if _items is not empty and _items is iterable %}
|
|
43
|
+
<div class="collapse" id="{{ _id }}">
|
|
44
|
+
{% for _item in _items %}
|
|
45
|
+
{% set _item_classes = loop.last ? 'pt-3' : 'py-3 border-bottom' %}
|
|
46
|
+
<div class="{{ _item_classes }}">
|
|
47
|
+
{% if _item.type == 'content' %}
|
|
48
|
+
{{ _item.content }}
|
|
49
|
+
{% else %}
|
|
50
|
+
<div class="row">
|
|
51
|
+
<div class="col-12 col-md-9">
|
|
52
|
+
{% if _item.title is not empty %}
|
|
53
|
+
<p class="fw-bold m-0">{{ _item.title }}</p>
|
|
54
|
+
{% endif %}
|
|
55
|
+
{% if _item.description is not empty %}
|
|
56
|
+
<p class="m-0">{{ _item.description }}</p>
|
|
57
|
+
{% endif %}
|
|
58
|
+
{% if _item.language is not empty or _item.meta is not empty %}
|
|
59
|
+
<small class="fw-bold m-0">
|
|
60
|
+
{%- if _item.language is not empty -%}
|
|
61
|
+
{{- _item.language -}}
|
|
62
|
+
{%- endif -%}
|
|
63
|
+
{%- if _item.meta is not empty -%}
|
|
64
|
+
<span class="fw-normal">
|
|
65
|
+
{{- ' ' ~ _item.meta -}}
|
|
66
|
+
</span>
|
|
67
|
+
{%- endif -%}
|
|
68
|
+
</small>
|
|
69
|
+
{% endif %}
|
|
70
|
+
</div>
|
|
71
|
+
<div class="col-12 col-md-3 align-self-end text-md-end">
|
|
72
|
+
{% include '@oe-bcl/bcl-link/link.html.twig' with _item.download|merge({
|
|
73
|
+
icon_position: "after",
|
|
74
|
+
icon: {
|
|
75
|
+
name: "download",
|
|
76
|
+
size: "fluid",
|
|
77
|
+
path: _icon_path,
|
|
78
|
+
},
|
|
79
|
+
attributes: create_attribute()
|
|
80
|
+
.setAttribute('download', true)
|
|
81
|
+
.setAttribute('target', '_blank')
|
|
82
|
+
.addClass(['d-block', 'standalone', 'mt-1'])
|
|
83
|
+
}) only %}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
{% endif %}
|
|
87
|
+
</div>
|
|
88
|
+
{% endfor %}
|
|
89
|
+
</div>
|
|
90
|
+
{% endif %}
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
{% endapply %}
|
package/file.html.twig
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
{% apply spaceless %}
|
|
2
|
+
|
|
3
|
+
{#
|
|
4
|
+
Parameters:
|
|
5
|
+
- title (string) (default: '')
|
|
6
|
+
- title_tag (string) (default: 'h2')
|
|
7
|
+
- title_link: (link object) (default: {})
|
|
8
|
+
- title_attributes (drupal attrs)
|
|
9
|
+
- item_title (string) (default: '')
|
|
10
|
+
- icon (icon Object) (default: {})
|
|
11
|
+
- icon_inline (boolean) (deafult: true)
|
|
12
|
+
- text (string) (default: '')
|
|
13
|
+
- content (string) (default: '')
|
|
14
|
+
- image (object) (default: {}) - format: {
|
|
15
|
+
path: '',
|
|
16
|
+
alt: '',
|
|
17
|
+
}
|
|
18
|
+
- badges (badge[]) (default: [])
|
|
19
|
+
- meta (string) (default: '')
|
|
20
|
+
- language (string) (default: '')
|
|
21
|
+
- variant (string) (default: 'default')
|
|
22
|
+
- options: ['default', 'card']
|
|
23
|
+
- download (link Object) (default: {})
|
|
24
|
+
- translation (file translation Object) (default: {}) format: {
|
|
25
|
+
id: '',
|
|
26
|
+
label: {}, - link Object
|
|
27
|
+
items: [
|
|
28
|
+
{
|
|
29
|
+
extension: '',
|
|
30
|
+
language: '',
|
|
31
|
+
size: '',
|
|
32
|
+
download: {}, - link Object
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
- icon_path (string) (default: '')
|
|
36
|
+
- attributes (drupal attrs)
|
|
37
|
+
#}
|
|
38
|
+
|
|
39
|
+
{# Internal properties #}
|
|
40
|
+
|
|
41
|
+
{% set _title = title|default('') %}
|
|
42
|
+
{% set _title_tag = title_tag|default('h2') %}
|
|
43
|
+
{% set _title_link = title_link|default({}) %}
|
|
44
|
+
{% set _title_attributes = title_attributes ?: create_attribute() %}
|
|
45
|
+
{% set _item_title = item_title|default('') %}
|
|
46
|
+
{% set _icon = icon|default({}) %}
|
|
47
|
+
{% set _icon_inline = icon_inline ?? true %}
|
|
48
|
+
{% set _text = text|default('') %}
|
|
49
|
+
{% set _content = content|default('') %}
|
|
50
|
+
{% set _image = image|default({}) %}
|
|
51
|
+
{% set _badges = badges|default([]) %}
|
|
52
|
+
{% set _meta = meta|default('') %}
|
|
53
|
+
{% set _language = language|default('') %}
|
|
54
|
+
{% set _variant = variant|default('default') %}
|
|
55
|
+
{% set _download = download|default({}) %}
|
|
56
|
+
{% set _translation = translation|default({}) %}
|
|
57
|
+
{% set _icon_path = icon_path|default('') %}
|
|
58
|
+
|
|
59
|
+
{% set _classes = ['bcl-file'] %}
|
|
60
|
+
|
|
61
|
+
{% if attributes is empty %}
|
|
62
|
+
{% set attributes = create_attribute() %}
|
|
63
|
+
{% endif %}
|
|
64
|
+
|
|
65
|
+
{% set attributes = attributes.addClass(_classes) %}
|
|
66
|
+
|
|
67
|
+
{% if _icon is not empty %}
|
|
68
|
+
{% set _container_classes = _container_classes ~ ' ms-2-5' %}
|
|
69
|
+
{% set _icon = _icon|merge({
|
|
70
|
+
attributes: create_attribute().addClass(['mt-1', 'icon--file'])
|
|
71
|
+
}) %}
|
|
72
|
+
{% endif %}
|
|
73
|
+
|
|
74
|
+
{% if _title is not empty %}
|
|
75
|
+
{% include '@oe-bcl/bcl-heading/heading.html.twig' with {
|
|
76
|
+
title: _title,
|
|
77
|
+
title_tag: _title_tag,
|
|
78
|
+
title_link: _title_link,
|
|
79
|
+
attributes: _title_attributes,
|
|
80
|
+
} only %}
|
|
81
|
+
{% endif %}
|
|
82
|
+
|
|
83
|
+
{% set attributes = attributes.addClass(['border', 'rounded']) %}
|
|
84
|
+
|
|
85
|
+
{% set _container_classes = 'd-md-flex flex-grow-1' %}
|
|
86
|
+
|
|
87
|
+
<div
|
|
88
|
+
{{ attributes }}
|
|
89
|
+
>
|
|
90
|
+
{% if _variant == 'card' %}
|
|
91
|
+
<div class="border-bottom px-3-5 py-3 d-md-flex">
|
|
92
|
+
<div class="pe-2 pb-2">
|
|
93
|
+
{% if _icon is not empty %}
|
|
94
|
+
{%- include '@oe-bcl/bcl-icon/icon.html.twig' with _icon|merge({
|
|
95
|
+
path: _icon_path,
|
|
96
|
+
}) only -%}
|
|
97
|
+
{% endif %}
|
|
98
|
+
</div>
|
|
99
|
+
<div>
|
|
100
|
+
{% if _item_title is not empty %}
|
|
101
|
+
<p class="fw-medium mb-2 fs-5">{{ _item_title }}</p>
|
|
102
|
+
{% endif %}
|
|
103
|
+
{% if _text is not empty %}
|
|
104
|
+
<p class="mb-3">{{ _text }}</p>
|
|
105
|
+
{% endif %}
|
|
106
|
+
{% if _content is not empty %}
|
|
107
|
+
{{ _content }}
|
|
108
|
+
{% endif %}
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
{% endif %}
|
|
112
|
+
<div class="px-3-5 py-3">
|
|
113
|
+
<div class="d-md-flex">
|
|
114
|
+
{% if _icon is not empty and _variant == 'default' %}
|
|
115
|
+
<div class="pe-2 pb-2">
|
|
116
|
+
{% if _icon is not empty %}
|
|
117
|
+
{%- include '@oe-bcl/bcl-icon/icon.html.twig' with _icon|merge({
|
|
118
|
+
path: _icon_path,
|
|
119
|
+
}) only -%}
|
|
120
|
+
{% endif %}
|
|
121
|
+
</div>
|
|
122
|
+
{% endif %}
|
|
123
|
+
<div class="{{ _container_classes }}">
|
|
124
|
+
<div class="flex-grow-1">
|
|
125
|
+
{% if _item_title is not empty and _variant == 'default' %}
|
|
126
|
+
<p class="fw-medium m-0 fs-5">{{ _item_title }}</p>
|
|
127
|
+
{% endif %}
|
|
128
|
+
{% if _language is not empty or _meta is not empty %}
|
|
129
|
+
<small class="fw-medium m-0">
|
|
130
|
+
{%- if _language is not empty -%}
|
|
131
|
+
{{- _language -}}
|
|
132
|
+
{%- endif -%}
|
|
133
|
+
{%- if _meta is not empty -%}
|
|
134
|
+
<span class="fw-normal">
|
|
135
|
+
{{- ' ' ~ _meta -}}
|
|
136
|
+
</span>
|
|
137
|
+
{%- endif -%}
|
|
138
|
+
</small>
|
|
139
|
+
{% endif %}
|
|
140
|
+
</div>
|
|
141
|
+
{% set _download = _download|merge({
|
|
142
|
+
icon_position: "after",
|
|
143
|
+
icon: {
|
|
144
|
+
name: "download",
|
|
145
|
+
size: "fluid",
|
|
146
|
+
path: _icon_path,
|
|
147
|
+
},
|
|
148
|
+
attributes: create_attribute()
|
|
149
|
+
.setAttribute('download', true)
|
|
150
|
+
.setAttribute('target', '_blank')
|
|
151
|
+
.addClass(['standalone', 'align-self-center', 'd-inline-block', 'mt-1', 'mt-md-0', 'flex-shrink-0'])
|
|
152
|
+
}) %}
|
|
153
|
+
{% include '@oe-bcl/bcl-link/link.html.twig' with _download only %}
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
{% if _translation is not empty %}
|
|
158
|
+
{% include '@oe-bcl/bcl-file/file-translations.html.twig' with _translation|merge({
|
|
159
|
+
icon_path: _icon_path
|
|
160
|
+
}) only %}
|
|
161
|
+
{% endif %}
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
{% endapply %}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openeuropa/bcl-file",
|
|
3
|
+
"author": "European Commission",
|
|
4
|
+
"license": "EUPL-1.2",
|
|
5
|
+
"version": "0.1.202408021145",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"description": "OE - BCL file",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@openeuropa/bcl-heading": "^0.1.202408021145",
|
|
12
|
+
"@openeuropa/bcl-icon": "^0.1.202408021145",
|
|
13
|
+
"@openeuropa/bcl-link": "^0.1.202408021145"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/openeuropa/bootstrap-component-library.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/openeuropa/bootstrap-component-library.git/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/openeuropa/bootstrap-component-library",
|
|
23
|
+
"keywords": [
|
|
24
|
+
"openeuropa",
|
|
25
|
+
"bootstrap-component-library",
|
|
26
|
+
"design-system",
|
|
27
|
+
"twig"
|
|
28
|
+
],
|
|
29
|
+
"gitHead": "7ee2013f7f64a70ddfa35228a9a65967dd71eec3"
|
|
30
|
+
}
|