vanilla-framework 4.45.0 → 4.46.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
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
{% from "_macros/shared/vf_cta-block.jinja" import vf_cta_block %}
|
|
2
|
+
{% from "_macros/shared/vf_description-block.jinja" import vf_description_block %}
|
|
3
|
+
|
|
1
4
|
# All Params
|
|
2
5
|
# title_text: H2 title text
|
|
3
6
|
# variant: variant for the cta section. Options are "default", "block". Default is "default".
|
|
4
7
|
# layout: Layout type of cta section. Options are "100", "25-75".
|
|
8
|
+
# blocks: list of content blocks for the CTA section. Includes description and cta blocks.
|
|
5
9
|
|
|
6
10
|
# All Slots
|
|
7
|
-
# description: Paragraph-style (one or more) content below the title. This slot is required for "cta-block-100" and "cta-block-25-75" layouts.
|
|
8
|
-
# cta: Call-to-action block with action links/buttons. This slot is required for "cta-block-100" and "cta-block-25-75" layouts.
|
|
11
|
+
# description (deprecated): Paragraph-style (one or more) content below the title. This slot is required for "cta-block-100" and "cta-block-25-75" layouts.
|
|
12
|
+
# cta (deprecated): Call-to-action block with action links/buttons. This slot is required for "cta-block-100" and "cta-block-25-75" layouts.
|
|
9
13
|
|
|
10
14
|
# Variants:
|
|
11
15
|
# default-100: Full-width CTA with title and link text
|
|
@@ -14,6 +18,7 @@
|
|
|
14
18
|
# variant: default
|
|
15
19
|
# layout: 100
|
|
16
20
|
# attrs: A dictionary of attributes to apply to the section element
|
|
21
|
+
# blocks: cta-block is required
|
|
17
22
|
|
|
18
23
|
# Slots:
|
|
19
24
|
# cta: The cta link - required
|
|
@@ -23,6 +28,7 @@
|
|
|
23
28
|
# title_text: H2 title text - optional
|
|
24
29
|
# variant: default
|
|
25
30
|
# layout: 25-75
|
|
31
|
+
# blocks: cta-block is required
|
|
26
32
|
|
|
27
33
|
# Slots:
|
|
28
34
|
# cta: The cta link - required
|
|
@@ -32,6 +38,7 @@
|
|
|
32
38
|
# title_text: H2 title text - required
|
|
33
39
|
# variant: block
|
|
34
40
|
# layout: 100
|
|
41
|
+
# blocks: cta-block is required
|
|
35
42
|
|
|
36
43
|
# Slots:
|
|
37
44
|
# description: Paragraph-style (one or more) content below the title - Optional
|
|
@@ -42,31 +49,69 @@
|
|
|
42
49
|
# title_text: H2 title text - required
|
|
43
50
|
# variant: block
|
|
44
51
|
# layout: 25-75
|
|
52
|
+
# blocks: cta-block is required
|
|
45
53
|
|
|
46
54
|
# Slots:
|
|
47
55
|
# description: Paragraph-style (one or more) content below the title - Optional
|
|
48
56
|
# cta: Call-to-action block (required)
|
|
49
57
|
|
|
50
|
-
{%- macro vf_cta_section(title_text, variant='default', layout='100', caller=None, attrs={}) -%}
|
|
58
|
+
{%- macro vf_cta_section(title_text, variant='default', layout='100', caller=None, attrs={}, blocks=[]) -%}
|
|
59
|
+
|
|
60
|
+
{%- set description_block = blocks | selectattr("type", "equalto", "description") | list | last | default(None) -%}
|
|
61
|
+
{%- set cta_block = blocks | selectattr("type", "equalto", "cta") | list | last | default(None) -%}
|
|
62
|
+
|
|
51
63
|
{% set description_content = caller('description') %}
|
|
52
|
-
{% set has_description = description_content|trim|length > 0 %}
|
|
64
|
+
{% set has_description = description_block or description_content|trim|length > 0 %}
|
|
53
65
|
{% set cta_content = caller('cta') %}
|
|
54
|
-
{% set has_cta = cta_content|trim|length > 0 %}
|
|
66
|
+
{% set has_cta = cta_block or cta_content|trim|length > 0 %}
|
|
67
|
+
|
|
68
|
+
{%- if cta_block -%}
|
|
69
|
+
{%- set cta_block_item = cta_block.get("item", {}) -%}
|
|
70
|
+
{%- set cta_block_type = cta_block_item.get("type","") | trim -%}
|
|
71
|
+
|
|
72
|
+
{%- if cta_block_type == "html" -%}
|
|
73
|
+
{%- set cta_content = cta_block_item.get("content","") | trim -%}
|
|
74
|
+
{%- endif -%}
|
|
75
|
+
{%- endif -%}
|
|
76
|
+
|
|
77
|
+
{%- if description_block -%}
|
|
78
|
+
{%- set description_block_item = description_block.get("item", {}) -%}
|
|
79
|
+
{%- endif -%}
|
|
80
|
+
|
|
55
81
|
{#- User can pass layout as "X-Y" or "X/Y" -#}
|
|
56
82
|
{% set layout = layout | trim | replace('/', '-') %}
|
|
83
|
+
|
|
57
84
|
{% if layout not in ['100', '25-75'] %}
|
|
58
85
|
{% set layout = "100" %}
|
|
59
86
|
{% endif %}
|
|
87
|
+
|
|
60
88
|
{% set variant = variant | trim %}
|
|
61
89
|
{% if variant not in ['default', 'block'] %}
|
|
62
90
|
{% set variant = "default" %}
|
|
63
91
|
{% endif %}
|
|
92
|
+
|
|
64
93
|
{%- macro _description_block() -%}
|
|
65
|
-
{
|
|
66
|
-
|
|
94
|
+
{%- if description_block -%}
|
|
95
|
+
{{ vf_description_block(type = description_block_item.get("type", ""), content = description_block_item.get("content","")) }}
|
|
96
|
+
{% elif has_description %}
|
|
97
|
+
{{ description_content }}
|
|
98
|
+
{% endif %}
|
|
99
|
+
{%- endmacro %}
|
|
100
|
+
|
|
67
101
|
{%- macro _cta_block() -%}
|
|
68
|
-
{
|
|
69
|
-
|
|
102
|
+
{%- if cta_block -%}
|
|
103
|
+
{%- if cta_block_type == "html" -%}
|
|
104
|
+
<div class="p-cta-block">{{- cta_content | safe -}}</div>
|
|
105
|
+
{%- else -%}
|
|
106
|
+
{{ vf_cta_block( primary=cta_block_item.get("primary", {}),
|
|
107
|
+
secondaries=cta_block_item.get("secondaries", []),
|
|
108
|
+
link=cta_block_item.get("link",{})) }}
|
|
109
|
+
{% endif %}
|
|
110
|
+
{% elif has_cta %}
|
|
111
|
+
<div class="p-cta-block">{{ cta_content }}</div>
|
|
112
|
+
{% endif %}
|
|
113
|
+
{%- endmacro %}
|
|
114
|
+
|
|
70
115
|
{%- macro _cta_default_variant() -%}
|
|
71
116
|
<h2>
|
|
72
117
|
{%- if title_text -%}
|
|
@@ -76,11 +121,13 @@
|
|
|
76
121
|
{{ cta_content }}
|
|
77
122
|
</h2>
|
|
78
123
|
{%- endmacro -%}
|
|
124
|
+
|
|
79
125
|
{%- macro _cta_block_variant() -%}
|
|
80
126
|
<h2>{{ title_text }}</h2>
|
|
81
127
|
{{ _description_block() -}}
|
|
82
128
|
{{ _cta_block() }}
|
|
83
129
|
{%- endmacro -%}
|
|
130
|
+
|
|
84
131
|
{%- macro _cta_variant() -%}
|
|
85
132
|
{%- if variant == 'default' -%}
|
|
86
133
|
{{ _cta_default_variant() }}
|
|
@@ -88,6 +135,7 @@
|
|
|
88
135
|
{{ _cta_block_variant() }}
|
|
89
136
|
{%- endif -%}
|
|
90
137
|
{%- endmacro -%}
|
|
138
|
+
|
|
91
139
|
<hr class="p-rule is-fixed-width u-no-margin--bottom" />
|
|
92
140
|
<section class="p-strip is-deep {{ attrs.get("class", "") -}}"
|
|
93
141
|
{%- for attr, value in attrs.items() -%}
|