@openeuropa/bcl-file 0.22.0 → 0.25.0

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.
Files changed (2) hide show
  1. package/file.html.twig +58 -47
  2. package/package.json +5 -5
package/file.html.twig CHANGED
@@ -4,14 +4,16 @@
4
4
  Parameters:
5
5
  - title (string) (default: '')
6
6
  - title_tag (string) (default: 'h2')
7
+ - title_link: (link object) (default: {})
7
8
  - title_attributes (drupal attrs)
8
9
  - item_title (string) (default: '')
9
10
  - icon (icon Object) (default: {})
11
+ - icon_inline (boolean) (deafult: true)
10
12
  - text (string) (default: '')
11
13
  - content (string) (default: '')
12
14
  - image (object) (default: {}) - format: {
13
- path:"",
14
- alt: "",
15
+ path: '',
16
+ alt: '',
15
17
  }
16
18
  - badges (array of badges Object) (default: [])
17
19
  - meta (string) (default: '')
@@ -20,24 +22,27 @@
20
22
  - options: ['default', 'card']
21
23
  - download (link Object) (default: {})
22
24
  - translation (object) (default: {}) format: {
23
- id: "",
25
+ id: '',
24
26
  label: {}, - link Object
25
27
  items: [
26
28
  {
27
- extension: "",
28
- language: "",
29
- size: "",
29
+ extension: '',
30
+ language: '',
31
+ size: '',
30
32
  download: {}, - link Object
31
33
  },
32
34
  }
33
35
  - icon_path (string) (default: '')
36
+ - attributes (drupal attrs)
34
37
  #}
35
38
 
36
39
  {# Internal properties #}
37
40
 
38
41
  {% set _icon = icon|default({}) %}
42
+ {% set _icon_inline = icon_inline|default(true) %}
39
43
  {% set _title = title|default('') %}
40
44
  {% set _title_tag = title_tag|default('h2') %}
45
+ {% set _title_link = title_link|default({}) %}
41
46
  {% set _title_attributes = title_attributes ?: create_attribute() %}
42
47
  {% set _item_title = item_title|default('') %}
43
48
  {% set _text = text|default('') %}
@@ -51,7 +56,14 @@
51
56
  {% set _translation = translation|default({}) %}
52
57
  {% set _icon_path = icon_path|default({}) %}
53
58
 
54
- {% set _container_classes = 'w-100 d-md-flex' %}
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
+
55
67
  {% if _icon is not empty %}
56
68
  {% set _container_classes = _container_classes ~ ' ms-2-5' %}
57
69
  {% set _icon = _icon|merge({
@@ -59,65 +71,62 @@
59
71
  }) %}
60
72
  {% endif %}
61
73
 
62
- {% if attributes is empty %}
63
- {% set attributes = create_attribute() %}
64
- {% endif %}
65
-
66
74
  {% if _title is not empty %}
67
75
  {% include '@oe-bcl/bcl-heading/heading.html.twig' with {
68
76
  title: _title,
69
77
  title_tag: _title_tag,
78
+ title_link: _title_link,
70
79
  attributes: _title_attributes,
71
80
  } only %}
72
81
  {% endif %}
73
82
 
74
- {% if _variant == 'card' %}
75
- {% set attributes = attributes.addClass(['border', 'rounded-bottom']) %}
76
- {% set _image = _image|merge({
77
- position: "top",
78
- classes: "mb-3",
79
- rounded: 0,
80
- }) %}
81
- {% include '@oe-bcl/bcl-card/card.html.twig' with {
82
- horizontal: true,
83
- horizontal_grid: {
84
- left_col_classes: "col-12 col-md-4 order-md-2",
85
- right_col_classes: "col-12 col-md-8",
86
- },
87
- badges: _badges,
88
- title: {
89
- content: _item_title,
90
- },
91
- text: {
92
- content: _text,
93
- classes: "mb-2",
94
- },
95
- content: _content,
96
- image: _image,
97
- extra_classes_body: "p-0",
98
- attributes: create_attribute().addClass(['rounded-0', 'rounded-top', 'p-4', 'border-bottom-0'])
99
- } only %}
100
- {% else %}
101
- {% set attributes = attributes.addClass(['border', 'rounded']) %}
102
- {% endif %}
83
+ {% set attributes = attributes.addClass(['border', 'rounded']) %}
84
+
85
+ {% set _container_classes = 'd-md-flex flex-grow-1' %}
103
86
 
104
87
  <div
105
88
  {{ attributes }}
106
89
  >
107
- <div class="px-3-5 py-3">
108
- <div class="d-flex">
90
+ {% if _variant == 'card' %}
91
+ <div class="border-bottom px-3-5 py-3 d-md-flex">
92
+ <div class="pe-2 pb-2">
109
93
  {% if _icon is not empty %}
110
94
  {%- include '@oe-bcl/bcl-icon/icon.html.twig' with _icon|merge({
111
95
  path: _icon_path,
112
96
  }) only -%}
113
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-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 %}
114
123
  <div class="{{ _container_classes }}">
115
124
  <div class="flex-grow-1">
116
125
  {% if _item_title is not empty and _variant == 'default' %}
117
- <p class="fw-bold m-0">{{ _item_title }}</p>
126
+ <p class="fw-medium m-0 fs-5">{{ _item_title }}</p>
118
127
  {% endif %}
119
128
  {% if _language is not empty or _meta is not empty %}
120
- <small class="fw-bold m-0">
129
+ <small class="fw-medium m-0">
121
130
  {%- if _language is not empty -%}
122
131
  {{- _language -}}
123
132
  {%- endif -%}
@@ -137,8 +146,9 @@
137
146
  path: _icon_path,
138
147
  },
139
148
  attributes: create_attribute()
140
- .setAttribute('download', _download.url)
141
- .addClass(['standalone', 'align-self-center', 'd-inline-block', 'mt-1', 'mt-md-0'])
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'])
142
152
  }) %}
143
153
  {% include '@oe-bcl/bcl-link/link.html.twig' with _download only %}
144
154
  </div>
@@ -196,7 +206,8 @@
196
206
  path: _icon_path,
197
207
  },
198
208
  attributes: create_attribute()
199
- .setAttribute("download", _item.download.url)
209
+ .setAttribute('download', true)
210
+ .setAttribute('target', '_blank')
200
211
  .addClass(['d-block', 'standalone', 'mt-1'])
201
212
  }) only %}
202
213
  </div>
package/package.json CHANGED
@@ -2,15 +2,15 @@
2
2
  "name": "@openeuropa/bcl-file",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "0.22.0",
5
+ "version": "0.25.0",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
9
  "description": "OE - BCL file",
10
10
  "dependencies": {
11
- "@openeuropa/bcl-heading": "^0.22.0",
12
- "@openeuropa/bcl-icon": "^0.22.0",
13
- "@openeuropa/bcl-link": "^0.22.0"
11
+ "@openeuropa/bcl-heading": "^0.25.0",
12
+ "@openeuropa/bcl-icon": "^0.25.0",
13
+ "@openeuropa/bcl-link": "^0.25.0"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
@@ -26,5 +26,5 @@
26
26
  "design-system",
27
27
  "twig"
28
28
  ],
29
- "gitHead": "57304ad94ae3c234f2f2b904208ce540a7a53f23"
29
+ "gitHead": "f50c7dfeab8695bbb5c18d5f7d5304509512268a"
30
30
  }