vanilla-framework 4.22.0 → 4.23.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-framework",
3
- "version": "4.22.0",
3
+ "version": "4.23.1",
4
4
  "author": {
5
5
  "email": "webteam@canonical.com",
6
6
  "name": "Canonical Webteam"
@@ -50,7 +50,6 @@ $code-inline-padding: 0.25rem;
50
50
  pre code {
51
51
  background: none;
52
52
  box-shadow: none;
53
- display: inline-block;
54
53
  line-height: map-get($line-heights, default-text);
55
54
  margin-left: 0;
56
55
  margin-right: 0;
@@ -112,6 +112,19 @@
112
112
  }
113
113
  }
114
114
 
115
+ %vf-grid-row-subgrid {
116
+ @extend %vf-grid-row;
117
+
118
+ @supports (display: grid) {
119
+ & > * {
120
+ display: grid;
121
+ grid-column: span calc($grid-8-columns / 4);
122
+ grid-row: span 100;
123
+ grid-template-rows: subgrid;
124
+ }
125
+ }
126
+ }
127
+
115
128
  %vf-grid-container-padding {
116
129
  // set static outside padding per breakpoint
117
130
  padding-left: map-get($grid-margin-widths, small);
@@ -0,0 +1,47 @@
1
+ /*
2
+ @classreference
3
+ pricing-block:
4
+ Pricing block:
5
+ .p-pricing-block:
6
+ Main element of the pricing block component, to represent 4 cards.
7
+ .p-pricing-block--25-75:
8
+ Modifier class for 3 cards with a 25-75 split. The first 25% row is empty.
9
+ .p-pricing-block--50-50:
10
+ Modifier class for 2 cards, where each card takes up 50% of the row.
11
+ Column:
12
+ .p-pricing-block__tier:
13
+ Column element within a pricing block. Each column represents a card.
14
+ */
15
+
16
+ @import 'settings';
17
+
18
+ @mixin vf-p-pricing-block {
19
+ .p-pricing-block,
20
+ .p-pricing-block--25-75,
21
+ .p-pricing-block--50-50 {
22
+ @extend %vf-grid-row-subgrid;
23
+
24
+ .p-pricing-block__tier {
25
+ grid-column: span $grid-8-columns-small;
26
+ padding-bottom: $spv--x-large;
27
+
28
+ @media (min-width: $threshold-4-6-col) {
29
+ grid-column: span calc($grid-8-columns-medium / 2);
30
+ }
31
+ }
32
+ }
33
+
34
+ .p-pricing-block--25-75 .p-pricing-block__tier {
35
+ @media (min-width: $threshold-6-12-col) {
36
+ &:first-child {
37
+ grid-column: calc($grid-8-columns / 4 + 1) / span calc($grid-8-columns / 4); // Shift the first card to the right
38
+ }
39
+ }
40
+ }
41
+
42
+ .p-pricing-block--50-50 .p-pricing-block__tier {
43
+ @media (min-width: $threshold-6-12-col) {
44
+ grid-column: span $grid-8-columns-small;
45
+ }
46
+ }
47
+ }
@@ -38,6 +38,7 @@
38
38
  @import 'patterns_navigation-reduced';
39
39
  @import 'patterns_notifications';
40
40
  @import 'patterns_pagination';
41
+ @import 'patterns_pricing-block';
41
42
  @import 'patterns_pull-quotes';
42
43
  @import 'patterns_rule';
43
44
  @import 'patterns_search-and-filter';
@@ -134,6 +135,7 @@
134
135
  @include vf-p-navigation-reduced;
135
136
  @include vf-p-notification;
136
137
  @include vf-p-pagination;
138
+ @include vf-p-pricing-block;
137
139
  @include vf-p-pull-quotes;
138
140
  @include vf-p-rule;
139
141
  @include vf-p-search-and-filter;
@@ -0,0 +1,75 @@
1
+ {#
2
+ Params
3
+ - title_text (string) (required): The text to be displayed as the heading
4
+ - layout: layout of linked logo section. Options are '50/50', '25/75', 'full-width'
5
+ - links (array) (required) : Array of links, each including 'href', 'label', 'text', and 'image_html'
6
+ #}
7
+
8
+ {% macro vf_linked_logo_section(title_text, links, layout="full-width") -%}
9
+ {% set layout = layout | trim | replace('/', '-') %}
10
+
11
+ {% if layout not in ['50-50', '25-75', 'full-width'] %}
12
+ {% set layout = 'full-width' %}
13
+ {% endif %}
14
+
15
+ {% set max_logos_map = {
16
+ "full-width": 8,
17
+ "50-50": 6,
18
+ "25-75": 9
19
+ } %}
20
+
21
+ {% set max_logos = max_logos_map[layout] or 8 %}
22
+ {% set links = links[:max_logos] %}
23
+
24
+ {% macro _list(links, cols_per_item=2) %}
25
+ {%- if links|length > 1 -%}
26
+ <div class="grid-row">
27
+ {%- for link in links -%}
28
+ <div class="grid-col-{{ cols_per_item }} grid-col-medium-{{ cols_per_item }}">
29
+ <a href="{{ link.href }}" aria-label="{{ link.label }}">
30
+ <div class="p-image-container--16-9 is-highlighted">
31
+ {{ link.image_html | safe }}
32
+ </div>
33
+ <hr class="p-rule--muted">
34
+ <p>{{ link.text }}</p>
35
+ </a>
36
+ </div>
37
+ {%- endfor -%}
38
+ </div>
39
+ {%- endif -%}
40
+ {% endmacro %}
41
+
42
+ <section class="p-section">
43
+ <hr class="p-rule is-fixed-width"/>
44
+ {%- if layout == "50-50" -%}
45
+ <div class="p-section--shallow">
46
+ <div class="grid-row">
47
+ <div class="grid-col-4">
48
+ <h2>{{ title_text }}</h2>
49
+ </div>
50
+ <div class="grid-col-4 grid-col-medium-4">
51
+ {{ _list(links) }}
52
+ </div>
53
+ </div>
54
+ </div>
55
+ {%- elif layout == "25-75" -%}
56
+ <div class="p-section--shallow">
57
+ <div class="grid-row">
58
+ <div class="grid-col-2">
59
+ <h2>{{ title_text }}</h2>
60
+ </div>
61
+ <div class="grid-col-6">
62
+ {{ _list(links) }}
63
+ </div>
64
+ </div>
65
+ </div>
66
+ {%- else -%}
67
+ <div class="p-section--shallow">
68
+ <div class="grid-row">
69
+ <h2>{{- title_text -}}</h2>
70
+ </div>
71
+ </div>
72
+ {{ _list(links) }}
73
+ {%- endif -%}
74
+ </section>
75
+ {%- endmacro %}
@@ -0,0 +1,88 @@
1
+ {#
2
+ Params
3
+ - title_text (string) (required): The text to be displayed as the heading
4
+ - tiers (Array<{
5
+ tier_name_text: String,
6
+ tier_price_text: String,
7
+ tier_price_explanation: String,
8
+ tier_description_html?: String,
9
+ tier_label_text: String,
10
+ tier_offerings: Array<{
11
+ list_item_style?: ‘ticked’ | ‘crossed’,
12
+ list_item_content_html: string
13
+ }>‘,
14
+ cta_html?: String
15
+ }>) (required)
16
+ Slots
17
+ - description (optional): paragraph-style content below the title
18
+ #}
19
+ {%- macro vf_pricing_block(
20
+ title_text="",
21
+ tiers=[]
22
+ ) -%}
23
+ {% set section_description = caller('section_description') %}
24
+ {% set has_tier_descriptions = (tiers | selectattr("tier_description_html") | list | length) > 0 %}
25
+ {% if tiers|length == 2 %}
26
+ {% set base_class_name = "p-pricing-block--50-50" %}
27
+ {% elif tiers|length == 3 %}
28
+ {% set base_class_name = "p-pricing-block--25-75" %}
29
+ {% else %}
30
+ {% set base_class_name = "p-pricing-block" %}
31
+ {% endif %}
32
+
33
+ {%- macro _tier_offerings_list(tier) %}
34
+ <p class="u-text--muted">What's included</p>
35
+ <hr class="p-rule--muted u-no-margin--bottom" />
36
+ <ul class="p-list--divided">
37
+ {%- for offering in tier.get("tier_offerings") %}
38
+ {%- set item_style = offering.get('list_item_style', 'undefined') -%}
39
+ {% if item_style == 'ticked' -%}
40
+ {% set item_class = "is-ticked" -%}
41
+ {% elif item_style == 'crossed' -%}
42
+ {% set item_class = "is-crossed u-text--muted" -%}
43
+ {% else -%}
44
+ {% set item_class = "has-bullet" -%}
45
+ {%- endif -%}
46
+ <li class="p-list__item {{ item_class }}">{{ offering.list_item_content_html }}</li>
47
+ {% endfor -%}
48
+ </ul>
49
+ {%- endmacro -%}
50
+
51
+ <div class="p-section">
52
+ <div class="p-section--shallow">
53
+ <hr class="p-rule--highlight is-fixed-width" />
54
+ <div class="grid-row">
55
+ <div class="grid-col-4 grid-col-medium-4 grid-col-small-4">
56
+ <h2>{{ title_text }}</h2>
57
+ </div>
58
+ {%- if section_description -%}
59
+ <div class="grid-col-4 grid-col-medium-4 grid-col-small-4">{{ section_description }}</div>
60
+ {%- endif -%}
61
+ </div>
62
+ </div>
63
+
64
+ <div class="{{ base_class_name }}">
65
+ {%- for tier in tiers %}
66
+ <div class="p-pricing-block__tier">
67
+ <div class="p-pricing-block__section">
68
+ <div class="p-section--shallow">
69
+ <h3 class="p-heading--4">
70
+ {{ tier.get("tier_name_text") }}
71
+ <br />
72
+ <strong>{{ tier.get("tier_price_text") }}</strong>
73
+ <span class="u-text--muted">{{ tier.get("tier_price_explanation") }}</span>
74
+ </h3>
75
+ </div>
76
+ </div>
77
+ {%- if has_tier_descriptions -%}
78
+ {% set description = tier.get("tier_description_html") if tier.get("tier_description_html") else '' %}
79
+ <div class="p-pricing-block__section"
80
+ {% if not description %}role="presentation"{% endif %}>{{ description }}</div>
81
+ {%- endif %}
82
+ <div class="p-pricing-block__section">{{ _tier_offerings_list(tier) }}</div>
83
+ {% if tier.cta_html %}<div class="p-pricing-block__section">{{ tier.cta_html }}</div>{% endif -%}
84
+ </div>
85
+ {%- endfor -%}
86
+ </div>
87
+ </div>
88
+ {% endmacro -%}