vanilla-framework 4.43.0 → 4.44.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.
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
{% from "_macros/shared/vf_linked-logo-block.jinja" import vf_linked_logo_block %}
|
|
7
7
|
{% from "_macros/shared/vf_logo-block.jinja" import vf_logo_block %}
|
|
8
8
|
|
|
9
|
-
{% macro vf_basic_section_blocks(items=[]) %}
|
|
9
|
+
{% macro vf_basic_section_blocks(items=[], override_last_item_padding=false) %}
|
|
10
10
|
{%- for item in items -%}
|
|
11
11
|
{%- set item_padding = (item.get("padding", "")) | trim -%}
|
|
12
12
|
{%- if item_padding not in ["shallow"] -%}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
{%- endif -%}
|
|
20
20
|
|
|
21
21
|
{#- Last item should not have any additional padding - the pattern itself already has bottom padding -#}
|
|
22
|
-
{%- if loop.last -%}
|
|
22
|
+
{%- if loop.last and not override_last_item_padding -%}
|
|
23
23
|
{%- set item_classes = "" -%}
|
|
24
24
|
{%- endif -%}
|
|
25
25
|
<div{%- if item_classes | length > 0 %} class="{{ item_classes }}"{%- endif -%}>
|
|
@@ -41,22 +41,27 @@
|
|
|
41
41
|
{%- endmacro -%}
|
|
42
42
|
|
|
43
43
|
# image_config
|
|
44
|
-
# - aspect_ratio: "16-9" | "3-2" | "" (default is "")
|
|
44
|
+
# - aspect_ratio: "16-9" | "3-2" | "2-3", "cinematic" | "" (default is "")
|
|
45
45
|
# - caption_html: The HTML content for the caption of the image (optional). Will be wrapped in <figcaption>, and the image and caption will be wrapped in a <figure>.
|
|
46
|
+
# - is_highlighted: Whether to apply the "is-highlighted" class to the image container (default is true).
|
|
47
|
+
# - is_cover: Whether to apply the "is-cover" class to the image container (default is false).
|
|
46
48
|
# - attrs: A dictionary of attributes to apply to the image
|
|
47
49
|
{% macro _basic_section_image(image_config={}) %}
|
|
48
50
|
{%- set aspect_ratio = image_config.get("aspect_ratio", "") | trim -%}
|
|
49
|
-
{%- if aspect_ratio not in ["16-9", "3-2"] -%}
|
|
51
|
+
{%- if aspect_ratio not in ["16-9", "3-2", "2-3", "cinematic"] -%}
|
|
50
52
|
{%- set aspect_ratio = "" -%}
|
|
51
53
|
{%- endif -%}
|
|
52
54
|
|
|
53
55
|
{%- set caption_html = image_config.get("caption_html", "") | trim -%}
|
|
54
56
|
{%- set has_caption = caption_html | length > 0 -%}
|
|
55
57
|
|
|
58
|
+
{%- set is_highlighted = image_config.get("is_highlighted", true) -%}
|
|
59
|
+
{%- set is_cover = image_config.get("is_cover", false) -%}
|
|
60
|
+
|
|
56
61
|
{%- if has_caption -%}
|
|
57
62
|
<figure>
|
|
58
63
|
{%- endif -%}
|
|
59
|
-
<div class="p-image-container{%- if aspect_ratio | length > 0 -%}--{{- aspect_ratio -}}{%- endif %} is-highlighted">
|
|
64
|
+
<div class="p-image-container{%- if aspect_ratio | length > 0 -%}--{{- aspect_ratio -}}{%- endif %}{%- if is_highlighted %} is-highlighted{% endif -%}{%- if is_cover %} is-cover{% endif -%}">
|
|
60
65
|
<img class="p-image-container__image {{ image_config.get("attrs", {}).get("class", "") -}}"
|
|
61
66
|
{%- for attr, value in image_config.get("attrs", {}).items() -%}
|
|
62
67
|
{% if attr != "class" %}
|
|
@@ -238,6 +243,7 @@
|
|
|
238
243
|
padding="default",
|
|
239
244
|
is_split_on_medium=false,
|
|
240
245
|
top_rule_variant="default",
|
|
246
|
+
override_last_item_padding=false,
|
|
241
247
|
attrs={}
|
|
242
248
|
) -%}
|
|
243
249
|
|
|
@@ -280,7 +286,7 @@
|
|
|
280
286
|
{%- if has_subtitle -%}
|
|
281
287
|
<p class="p-heading--{{ subtitle_heading_level }}">{{- subtitle_text -}}</p>
|
|
282
288
|
{%- endif -%}
|
|
283
|
-
{{- vf_basic_section_blocks(items=items) -}}
|
|
289
|
+
{{- vf_basic_section_blocks(items=items, override_last_item_padding=override_last_item_padding) -}}
|
|
284
290
|
</div>
|
|
285
291
|
</div>
|
|
286
292
|
</section>
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
{% from "_macros/shared/vf_cta-block.jinja" import vf_cta_block %}
|
|
2
|
+
{% from "_macros/vf_basic-section.jinja" import vf_basic_section_blocks %}
|
|
3
|
+
|
|
1
4
|
# Params
|
|
2
5
|
# title_text: Hero title text (required)
|
|
3
6
|
# subtitle_text: Hero subtitle text
|
|
@@ -5,28 +8,35 @@
|
|
|
5
8
|
# is_split_on_medium: whether the layout is split on tablet in 50/50, 25/75, and 75/25 layouts.
|
|
6
9
|
# If false, the layout is stacked on tablet.
|
|
7
10
|
# If true, the layout is split on tablet.
|
|
8
|
-
# Slots
|
|
9
|
-
# description: paragraph-style content below the title and subtitle
|
|
10
|
-
# cta: call-to-action block below the description
|
|
11
|
-
# image: slot for image content
|
|
12
|
-
# signpost_image: slot for signpost (left column) image content in 25/75 layout. Required for 25/75 layout.
|
|
13
11
|
# display_blank_signpost_image_space: whether to indent the content for 25/75 layout on large screens.
|
|
12
|
+
# blocks: list of content blocks for the hero section. Includes description, cta, image, and signpost_image blocks.
|
|
13
|
+
# Slots
|
|
14
|
+
# description (deprecated): paragraph-style content below the title and subtitle
|
|
15
|
+
# cta (deprecated): call-to-action block below the description
|
|
16
|
+
# image (deprecated): slot for image content
|
|
17
|
+
# signpost_image (deprecated): slot for signpost (left column) image content in 25/75 layout. Required for 25/75 layout.
|
|
14
18
|
{% macro vf_hero(
|
|
15
19
|
title_text,
|
|
16
20
|
subtitle_text='',
|
|
17
21
|
layout="fallback",
|
|
18
22
|
is_split_on_medium=false,
|
|
19
|
-
display_blank_signpost_image_space=false
|
|
23
|
+
display_blank_signpost_image_space=false,
|
|
24
|
+
blocks=[]
|
|
20
25
|
) -%}
|
|
26
|
+
{%- set description_blocks = blocks | selectattr("type", "equalto", "description") | list -%}
|
|
27
|
+
{%- set cta_block = blocks | selectattr("type", "equalto", "cta-block") | list | first | default(None) -%}
|
|
28
|
+
{%- set image_block = blocks | selectattr("type", "equalto", "image") | list | first | default(None) -%}
|
|
29
|
+
{%- set signpost_image_block = blocks | selectattr("type", "equalto", "signpost_image") | list | first | default(None) -%}
|
|
30
|
+
|
|
21
31
|
{% set has_subtitle = subtitle_text|trim|length > 0 %}
|
|
22
32
|
{% set description_content = caller('description') %}
|
|
23
|
-
{% set has_description = description_content|trim|length > 0 %}
|
|
33
|
+
{% set has_description = description_blocks | length > 0 or description_content|trim|length > 0 %}
|
|
24
34
|
{% set cta_content = caller('cta') %}
|
|
25
|
-
{% set has_cta = cta_content|trim|length > 0 %}
|
|
35
|
+
{% set has_cta = cta_block or cta_content|trim|length > 0 %}
|
|
26
36
|
{% set image_content = caller('image') %}
|
|
27
|
-
{% set has_image = image_content|trim|length > 0 %}
|
|
37
|
+
{% set has_image = image_block or image_content|trim|length > 0 %}
|
|
28
38
|
{% set signpost_image_content = caller('signpost_image') %}
|
|
29
|
-
{% set has_signpost_image = signpost_image_content|trim|length > 0 or display_blank_signpost_image_space %}
|
|
39
|
+
{% set has_signpost_image = signpost_image_block or signpost_image_content|trim|length > 0 or display_blank_signpost_image_space %}
|
|
30
40
|
|
|
31
41
|
{#- User can pass layout as "X-Y" or "X/Y" -#}
|
|
32
42
|
{% set layout = layout | trim | replace('/', '-') %}
|
|
@@ -98,7 +108,9 @@
|
|
|
98
108
|
{%- endmacro %}
|
|
99
109
|
|
|
100
110
|
{%- macro _hero_cta_block() -%}
|
|
101
|
-
{
|
|
111
|
+
{%- if cta_block -%}
|
|
112
|
+
{{- vf_basic_section_blocks(items=[cta_block], override_last_item_padding=true) -}}
|
|
113
|
+
{% elif has_cta -%}
|
|
102
114
|
<div class="p-cta-block">
|
|
103
115
|
{{ cta_content }}
|
|
104
116
|
</div>
|
|
@@ -106,19 +118,35 @@
|
|
|
106
118
|
{%- endmacro %}
|
|
107
119
|
|
|
108
120
|
{%- macro _hero_description_block() -%}
|
|
109
|
-
{
|
|
121
|
+
{%- if description_blocks | length > 0 -%}
|
|
122
|
+
{% for description_block in description_blocks %}
|
|
123
|
+
{{ vf_basic_section_blocks(items=[description_block], override_last_item_padding=true) }}
|
|
124
|
+
{% endfor %}
|
|
125
|
+
{% elif has_description %}
|
|
110
126
|
<div class="p-section--shallow">
|
|
111
127
|
{{ description_content }}
|
|
112
128
|
</div>
|
|
113
129
|
{% endif %}
|
|
114
130
|
{%- endmacro %}
|
|
115
131
|
|
|
132
|
+
{%- macro _hero_image_block() -%}
|
|
133
|
+
{%- if image_block -%}
|
|
134
|
+
{{- vf_basic_section_blocks(items=[image_block], override_last_item_padding=true) -}}
|
|
135
|
+
{% elif has_image -%}
|
|
136
|
+
{{ image_content }}
|
|
137
|
+
{% endif %}
|
|
138
|
+
{%- endmacro %}
|
|
139
|
+
|
|
116
140
|
{%- macro _hero_signpost_image_block() -%}
|
|
117
|
-
|
|
118
|
-
|
|
141
|
+
<div class="p-section--shallow">
|
|
142
|
+
{%- if signpost_image_block -%}
|
|
143
|
+
{% set _ = signpost_image_block.update(type="image") %}
|
|
144
|
+
{% set _ = signpost_image_block.item.attrs.update({"class": "u-no-margin"}) %}
|
|
145
|
+
{{- vf_basic_section_blocks(items=[signpost_image_block], override_last_item_padding=true) -}}
|
|
146
|
+
{% else -%}
|
|
119
147
|
{{ signpost_image_content }}
|
|
120
|
-
|
|
121
|
-
|
|
148
|
+
{% endif %}
|
|
149
|
+
</div>
|
|
122
150
|
{%- endmacro %}
|
|
123
151
|
|
|
124
152
|
<section class="p-section--hero">
|
|
@@ -140,7 +168,7 @@
|
|
|
140
168
|
</div>
|
|
141
169
|
{% if has_image -%}
|
|
142
170
|
<div class="{{ col_classes[1] }}">
|
|
143
|
-
{{
|
|
171
|
+
{{ _hero_image_block() }}
|
|
144
172
|
</div>
|
|
145
173
|
{% endif -%}
|
|
146
174
|
{% elif (has_full_width_image and not has_signpost_image) or is_50_50_no_image %}
|
|
@@ -156,8 +184,8 @@
|
|
|
156
184
|
{{- _hero_description_block() -}}
|
|
157
185
|
{{- _hero_cta_block() -}}
|
|
158
186
|
</div>
|
|
159
|
-
{{
|
|
160
|
-
{% elif has_signpost_image %}
|
|
187
|
+
{{ _hero_image_block() }}
|
|
188
|
+
{% elif has_signpost_image and layout == '25-75' %}
|
|
161
189
|
{#- 25/75 Signpost layout -#}
|
|
162
190
|
<div class="{{ col_classes[0] }}">
|
|
163
191
|
{{ _hero_signpost_image_block() -}}
|
|
@@ -172,7 +200,7 @@
|
|
|
172
200
|
</div>
|
|
173
201
|
{% if has_image %}
|
|
174
202
|
{#- Signpost with image is always full-width, so set it after the columns -#}
|
|
175
|
-
{{-
|
|
203
|
+
{{- _hero_image_block() }}
|
|
176
204
|
{% endif -%}
|
|
177
205
|
{% else %}
|
|
178
206
|
<div class="{{ col_classes[0] }}">
|
|
@@ -185,7 +213,7 @@
|
|
|
185
213
|
</div>
|
|
186
214
|
{% if has_image -%}
|
|
187
215
|
<div class="{{ col_classes[1] }}">
|
|
188
|
-
{{
|
|
216
|
+
{{ _hero_image_block() }}
|
|
189
217
|
</div>
|
|
190
218
|
{% endif -%}
|
|
191
219
|
{% endif -%}
|