maverick-wave 4.14.0 → 4.16.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.
@@ -0,0 +1,231 @@
1
+ @use '../abstracts' as *;
2
+
3
+ // The word variant is set down from the price size and then has to climb back
4
+ // to its line box - the two numbers only work as a pair, so they are named.
5
+ $_mw-price-line-height: 1.1;
6
+ $_mw-price-word-scale: 0.68;
7
+
8
+ // ---------------------------------------------------------------------------
9
+ // Price
10
+ //
11
+ // The figure, not the card around it: one baseline row holding the price that
12
+ // was, the price that is, the unit and a discount tag.
13
+ //
14
+ // Every part is sized in `em` off a single token, so the size variants only
15
+ // have to retune `--mw-price-size` and the whole row moves together - cents,
16
+ // currency and struck-through original included.
17
+ // ---------------------------------------------------------------------------
18
+
19
+ .mw-price {
20
+ --mw-price-size: #{font-size('3xl')};
21
+
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ // Baseline, not centre: figure and words are read as one line of text, and
25
+ // centring a 0.45em word against a 2.2rem number floats it in the middle of
26
+ // the digits instead of sitting it on them.
27
+ align-items: baseline;
28
+ gap: spacing('2') spacing('3');
29
+ margin: spacing('0');
30
+ font-size: var(--mw-price-size);
31
+ line-height: $_mw-price-line-height;
32
+ color: var(--mw-primary-text-color);
33
+
34
+ // A pill is a box, not a word - on the baseline it hangs off the bottom of
35
+ // the digits. Centre is where the eye looks for it.
36
+ > .mw-tag,
37
+ > .mw-badge {
38
+ align-self: center;
39
+ flex-shrink: 0;
40
+ }
41
+
42
+ &-amount {
43
+ font-weight: font-weight('bold');
44
+ // Two prices under each other line up, and a figure swapped by a billing
45
+ // toggle does not jump sideways on the way
46
+ font-variant-numeric: tabular-nums lining-nums;
47
+ font-feature-settings: 'tnum', 'lnum';
48
+ white-space: nowrap;
49
+ }
50
+
51
+ // Cents, written inside the amount. One step down and left on the baseline -
52
+ // cents raised to the cap height are a discounter's idiom, and a service
53
+ // price that borrows it reads cheaper than it is.
54
+ &-fraction {
55
+ font-size: 0.62em;
56
+ font-weight: font-weight('medium');
57
+ }
58
+
59
+ // "Euro", "CHF", "€" - the unit, not the number, so it does not carry the
60
+ // weight either.
61
+ //
62
+ // The floor is where the `em` chain stops being useful: 0.45 of an
63
+ // `mw-price-sm` is 11px, and that is the size most offer cards run at.
64
+ &-currency {
65
+ font-size: max(0.45em, #{font-size('xs')});
66
+ font-weight: font-weight('normal');
67
+ }
68
+
69
+ // What it cost before the discount. Muted *and* struck: muted alone reads as
70
+ // a footnote, the line is what says "this is no longer the price".
71
+ //
72
+ // The rule is drawn explicitly, because the browser default is a hairline
73
+ // that vanishes at this size against a muted tone.
74
+ &-original {
75
+ // On its own line, above the new price. Inline it reads fine on a wide card
76
+ // and badly everywhere else: "199 Euro 159 Euro -20 %" is a long row, and
77
+ // the first thing to drop to the next line when the width runs out is the
78
+ // discount tag - the one part that was there to catch the eye. Broken here
79
+ // it breaks where it is meant to.
80
+ //
81
+ // `flex-basis` is the line break. A wrapper element around the rest would
82
+ // do the same job and cost an element in every price on the page.
83
+ flex-basis: 100%;
84
+ margin-bottom: spacing('-1');
85
+ // Floored higher than the unit - this one is a figure, and a reader has to
86
+ // be able to compare it with the one next to it
87
+ font-size: max(0.5em, #{font-size('sm')});
88
+ font-weight: font-weight('normal');
89
+ color: var(--mw-text-muted-color);
90
+ text-decoration: line-through;
91
+ text-decoration-thickness: 0.09em;
92
+ white-space: nowrap;
93
+ }
94
+
95
+ // "/ month", "per session" - what the price is per
96
+ &-period {
97
+ font-size: max(0.42em, #{font-size('xs')});
98
+ font-weight: font-weight('normal');
99
+ color: var(--mw-text-muted-color);
100
+ }
101
+
102
+ // "On request", "free" - not a figure, so not set like one. Still bold, so it
103
+ // holds the same slot in a row of cards as a real price would.
104
+ //
105
+ // The line height is scaled back up to the one a full-size amount has: a row
106
+ // of offers puts "On request" next to "129", and a shorter line box would sit
107
+ // that card's price a few pixels out of line with its neighbours.
108
+ &-word {
109
+ font-size: $_mw-price-word-scale * 1em;
110
+ line-height: calc(#{$_mw-price-line-height}em / #{$_mw-price-word-scale});
111
+ font-weight: font-weight('bold');
112
+ }
113
+
114
+ // The line under a price - what it includes, what it saves. A *sibling* of
115
+ // the row, not a child: inside it, it would inherit the price size and be a
116
+ // flex item on the same baseline.
117
+ &-note {
118
+ margin: spacing('2') spacing('0') spacing('0');
119
+ font-size: font-size('sm');
120
+ color: var(--mw-text-muted-color);
121
+ }
122
+ }
123
+
124
+ // Size. Only the token moves - see the `em` above.
125
+ .mw-price-sm {
126
+ --mw-price-size: #{font-size('xl')};
127
+ }
128
+
129
+ .mw-price-lg {
130
+ --mw-price-size: #{font-size('5xl')};
131
+ }
132
+
133
+ // Old price in front of the new one instead of above it - one line, for a wide
134
+ // card or a table row that has the width to spare. Check it at the narrow end
135
+ // before reaching for it: the discount tag is the first thing to wrap away.
136
+ .mw-price-inline .mw-price-original {
137
+ flex-basis: auto;
138
+ margin-bottom: spacing('0');
139
+ }
140
+
141
+ .mw-price-center {
142
+ justify-content: center;
143
+ }
144
+
145
+ // Body colour instead of the brand - for a table row or a list where a coloured
146
+ // price would be the loudest thing on screen for no reason.
147
+ .mw-price-plain {
148
+ color: var(--mw-text-color);
149
+ }
150
+
151
+ // ---------------------------------------------------------------------------
152
+ // Offer card
153
+ //
154
+ // The card a price is sold from: what you get, what it costs, the button that
155
+ // asks for it. Deliberately thin - shell, body and footer are `mw-card`'s, this
156
+ // adds only what selling something needs.
157
+ // ---------------------------------------------------------------------------
158
+
159
+ .mw-offer {
160
+ // Prices in a row of offers have to sit on one line, and the feature lists
161
+ // are never the same length. Pushed down rather than positioned: the grid
162
+ // already stretches the cards to equal height, so "as far down as it goes"
163
+ // resolves to the same line in every card of the row.
164
+ > .mw-card-body > .mw-price {
165
+ margin-top: auto;
166
+ padding-top: spacing('5');
167
+ }
168
+
169
+ // The card body already pushes its footer down the same way. Two `auto`
170
+ // margins in one column *share* the free space instead of collecting it above
171
+ // the first, which leaves the price floating somewhere in the middle and at a
172
+ // different height in every card - so the footer gives its own up as soon as
173
+ // a price stands in front of it.
174
+ //
175
+ // Bottom-aligned, note included: a card that carries a `mw-price-note` and
176
+ // one that does not will not have their prices on the same line. Give every
177
+ // card in a row a note, or none of them.
178
+ > .mw-card-body > .mw-price ~ .mw-card-footer {
179
+ margin-top: spacing('0');
180
+ }
181
+
182
+ // A solid band across the top carrying the name and the price - the layout
183
+ // for when the price is the thing being compared and the feature list is
184
+ // only its justification. Colour comes from `mw-card-addon-*` on the card,
185
+ // the same set the card badge and the ribbon read.
186
+ &-head {
187
+ display: flex;
188
+ flex-direction: column;
189
+ align-items: center;
190
+ gap: spacing('2');
191
+ padding: spacing('6') spacing('5');
192
+ // The card's own radius minus its border - the band sits inside it
193
+ border-radius: (radius('sm') - 1px) (radius('xl') - 1px) 0 0;
194
+ background: var(--mw-card-addon-color, var(--mw-primary-color));
195
+ color: var(--mw-card-addon-text-color, var(--mw-primary-accent-text-color));
196
+ text-align: center;
197
+
198
+ // On a solid fill the price cannot keep the brand colour, and the muted
199
+ // parts cannot keep a grey that was mixed against the page background
200
+ .mw-price,
201
+ .mw-price-original,
202
+ .mw-price-period {
203
+ color: inherit;
204
+ }
205
+
206
+ .mw-price-original,
207
+ .mw-price-period {
208
+ opacity: 0.7;
209
+ }
210
+ }
211
+
212
+ &-name {
213
+ margin: spacing('0');
214
+ font-size: font-size('md');
215
+ font-weight: font-weight('bold');
216
+ letter-spacing: 0.06em;
217
+ text-transform: uppercase;
218
+ }
219
+
220
+ // With a band above it the body no longer opens the card, so it does not need
221
+ // the air a card top usually gets
222
+ &-head + .mw-card-body {
223
+ padding-top: spacing('6');
224
+ }
225
+ }
226
+
227
+ // The band owns the top-right corner. An arc drawn over it either disappears
228
+ // into the fill or fights it - the same call the coloured panel header makes.
229
+ .mw-offer:has(> .mw-offer-head)::after {
230
+ @include corner-accent(1px, 'bottom');
231
+ }
@@ -65,6 +65,18 @@
65
65
  background: var(--mw-primary-color);
66
66
  border-color: var(--mw-primary-text-color);
67
67
  color: var(--mw-primary-accent-text-color);
68
+
69
+ // A tag inside an item - the saving on a billing cycle, a count on a
70
+ // filter. Its colour variants mix their background from the *page*, so on
71
+ // the active item's fill they come out muddy: an orange pill on blue turns
72
+ // purple. On that one the tag borrows the item's own ink; on the others it
73
+ // keeps its colour, which is what makes a visitor click it in the first
74
+ // place.
75
+ .mw-tag {
76
+ background: transparent;
77
+ border-color: currentColor;
78
+ color: inherit;
79
+ }
68
80
  }
69
81
  }
70
82