@ons/design-system 72.9.1 → 72.10.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 (56) hide show
  1. package/components/button/_button.scss +10 -0
  2. package/components/card/_macro.njk +3 -3
  3. package/components/card/_macro.spec.js +109 -252
  4. package/components/card/_test_examples.js +56 -0
  5. package/components/chart/_chart.scss +74 -1
  6. package/components/chart/_macro.njk +64 -5
  7. package/components/chart/_macro.spec.js +405 -0
  8. package/components/chart/bar-chart.js +2 -2
  9. package/components/chart/boxplot.js +37 -0
  10. package/components/chart/chart-constants.js +13 -0
  11. package/components/chart/chart.js +98 -50
  12. package/components/chart/columnrange-chart.js +94 -0
  13. package/components/chart/common-chart-options.js +28 -19
  14. package/components/chart/example-bar-chart-with-annotations.njk +1 -1
  15. package/components/chart/example-bar-chart-with-point-range-and-reference-line-annotations.njk +95 -0
  16. package/components/chart/example-bar-with-confidence-levels.njk +71 -0
  17. package/components/chart/example-clustered-column-chart.njk +1 -3
  18. package/components/chart/example-column-chart-with-annotations.njk +1 -1
  19. package/components/chart/example-column-chart-with-range-annotations.njk +64 -0
  20. package/components/chart/example-column-chart-with-reference-line-annotations.njk +64 -0
  21. package/components/chart/example-column-with-confidence-levels.njk +61 -0
  22. package/components/chart/example-line-chart-with-annotations.njk +3 -3
  23. package/components/chart/example-line-chart-with-markers.njk +1 -1
  24. package/components/chart/example-line-chart-with-range-annotations-inside.njk +238 -0
  25. package/components/chart/example-line-chart-with-range-annotations-outside-left-right.njk +240 -0
  26. package/components/chart/example-line-chart-with-range-annotations-outside-top-bottom.njk +239 -0
  27. package/components/chart/example-line-chart-with-reference-line-annotations.njk +236 -0
  28. package/components/chart/example-scatter-chart.njk +1 -1
  29. package/components/chart/range-annotations-options.js +216 -0
  30. package/components/chart/reference-line-annotations-options.js +93 -0
  31. package/components/chart/scatter-chart.js +15 -0
  32. package/components/chart/specific-chart-options.js +1 -1
  33. package/components/chart/utilities.js +96 -0
  34. package/components/details-panel/_macro.njk +5 -1
  35. package/components/details-panel/_macro.spec.js +22 -0
  36. package/components/document-list/_document-list.scss +5 -13
  37. package/components/document-list/_macro.njk +14 -17
  38. package/components/document-list/_macro.spec.js +3 -3
  39. package/components/fieldset/_macro.spec.js +200 -120
  40. package/components/fieldset/_test_examples.js +15 -0
  41. package/components/header/_header.scss +11 -0
  42. package/components/header/_macro.njk +11 -6
  43. package/components/header/_macro.spec.js +113 -3
  44. package/components/hero/_macro.spec.js +1 -1
  45. package/components/icon/_macro.njk +14 -24
  46. package/components/language-selector/_macro.njk +6 -3
  47. package/components/navigation/navigation.js +57 -58
  48. package/components/navigation/navigation.spec.js +6 -10
  49. package/components/summary/_macro.njk +4 -1
  50. package/components/table-of-contents/_macro.njk +1 -1
  51. package/components/table-of-contents/_macro.spec.js +7 -0
  52. package/components/table-of-contents/table-of-contents.js +43 -26
  53. package/css/main.css +1 -1
  54. package/package.json +1 -1
  55. package/scripts/main.es5.js +1 -1
  56. package/scripts/main.js +1 -1
@@ -147,6 +147,15 @@ $button-shadow-size: 3px;
147
147
  top: ems($button-shadow-size);
148
148
  }
149
149
 
150
+ &.disabled {
151
+ cursor: not-allowed;
152
+ border: 0;
153
+
154
+ &:hover {
155
+ border: 0;
156
+ }
157
+ }
158
+
150
159
  // Small buttons
151
160
  &--small,
152
161
  &--mobile {
@@ -156,6 +165,7 @@ $button-shadow-size: 3px;
156
165
  &--small & {
157
166
  &__inner {
158
167
  padding: 0.5rem 0.75rem;
168
+
159
169
  .ons-icon {
160
170
  height: 16px;
161
171
  width: 16px;
@@ -4,7 +4,7 @@
4
4
  {% set closingHeadingTag = "</h" + headingLevel + ">" %}
5
5
  {% set placeholderSrcset = (params.image.placeholderUrl if params.image.placeholderUrl else "") + "/img/small/placeholder-card.png 1x, " + (params.image.placeholderUrl if params.image.placeholderUrl else "") + "/img/large/placeholder-card.png 2x" %}
6
6
 
7
- <div class="ons-card {% if params.variant == "feature" %}ons-card--feature ons-u-flex-grow{% endif %}">
7
+ <div class="ons-card{% if params.variant == 'feature' %}{{ ' ' }}ons-card--feature ons-u-flex-grow{% endif %}">
8
8
  {% set imageBlock %}
9
9
  {%- if params.image -%}
10
10
  {% if params.image.smallSrc %}
@@ -38,7 +38,7 @@
38
38
  {% endset %}
39
39
 
40
40
  {% if params.title.url %}
41
- <a href="{{ params.title.url }}" class="ons-card__link {% if params.title.subtitle %}ons-u-mb-xs{% endif %}">
41
+ <a href="{{ params.title.url }}" class="ons-card__link{% if params.title.subtitle %}{{ ' ' }}ons-u-mb-xs{% endif %}">
42
42
  {{ imageBlock | safe }}
43
43
  {{ titleBlock | safe }}
44
44
  </a>
@@ -55,7 +55,7 @@
55
55
  <p class="ons-card__figure ons-u-fs-3xl ons-u-fw-b ons-u-mb-no">{{ params.body.figure }}</p>
56
56
  {% endif %}
57
57
 
58
- <p id="{{ params.body.id }}">{{ params.body.text }}</p>
58
+ <p id="{{ params.body.id }}" class="ons-card__body">{{ params.body.text }}</p>
59
59
 
60
60
  {%- if params.body.itemsList -%}
61
61
  {% from "components/list/_macro.njk" import onsList %}
@@ -1,328 +1,185 @@
1
1
  /** @jest-environment jsdom */
2
2
 
3
3
  import * as cheerio from 'cheerio';
4
-
5
4
  import axe from '../../tests/helpers/axe';
6
5
  import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
7
6
 
8
- const EXAMPLE_CARD_WITHOUT_IMAGE = {
9
- title: {
10
- text: 'Example card title',
11
- },
12
- body: {
13
- text: 'Example card text.',
14
- id: 'example-text-id',
15
- },
16
- };
17
-
18
- const EXAMPLE_CARD_WITH_IMAGE = {
19
- ...EXAMPLE_CARD_WITHOUT_IMAGE,
20
- image: {
21
- smallSrc: 'example-small.png',
22
- largeSrc: 'example-large.png',
23
- alt: 'Example alt text',
24
- },
25
- };
26
-
27
- const EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE = {
28
- ...EXAMPLE_CARD_WITHOUT_IMAGE,
29
- image: true,
30
- };
31
-
32
- const EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH = {
33
- ...EXAMPLE_CARD_WITHOUT_IMAGE,
34
- image: {
35
- placeholderUrl: '/placeholder-image-url',
36
- },
37
- };
38
-
39
- const EXAMPLE_CARD_FEATURE_VARIANT = {
40
- variant: 'feature',
41
- title: {
42
- text: 'Feature card title',
43
- url: 'http://example.com',
44
- subtitle: 'Optional subtitle',
45
- },
46
- body: {
47
- figure: '123,456',
48
- text: 'Example feature card text',
49
- id: 'example-feature-text-id',
50
- },
51
- };
52
-
53
- describe('macro: card', () => {
54
- describe('mode: without image', () => {
55
- it('passes jest-axe checks', async () => {
56
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITHOUT_IMAGE));
57
-
58
- const results = await axe($.html());
59
- expect(results).toHaveNoViolations();
60
- });
61
-
62
- it('has the provided `title` text', () => {
63
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITHOUT_IMAGE));
64
-
65
- expect($('.ons-card__title').text().trim()).toBe('Example card title');
66
- });
67
-
68
- it.each([
69
- [1, 'h1'],
70
- [4, 'h4'],
71
- ])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
72
- const $ = cheerio.load(
73
- renderComponent('card', {
74
- title: {
75
- text: 'Example card title',
76
- headingLevel: headingLevel,
77
- },
78
- body: {
79
- text: 'Example card text.',
80
- id: 'example-text-id',
81
- },
82
- }),
83
- );
84
-
85
- expect($(`${expectedTitleTag}.ons-card__title`).text().trim()).toBe('Example card title');
86
- });
87
-
88
- it('has the provided `text` accessible via the `textId` identifier', () => {
89
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITHOUT_IMAGE));
7
+ import {
8
+ EXAMPLE_CARD,
9
+ EXAMPLE_CARD_WITH_IMAGE,
10
+ EXAMPLE_CARD_WITH_LIST,
11
+ EXAMPLE_CARD_FULL_EXAMPLE,
12
+ EXAMPLE_CARD_FEATURE_VARIANT,
13
+ } from './_test_examples';
14
+
15
+ describe('FOR: Macro: Card', () => {
16
+ describe('GIVEN: Params: required', () => {
17
+ describe('WHEN: all required params are provided', () => {
18
+ const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD));
19
+
20
+ test('THEN: jest-axe text pass', async () => {
21
+ const results = await axe($.html());
22
+ expect(results).toHaveNoViolations();
23
+ });
90
24
 
91
- expect($('#example-text-id').text().trim()).toBe('Example card text.');
92
- });
25
+ test('THEN: renders the title with the provided text', () => {
26
+ expect($('.ons-card__title').text().trim()).toBe('Example card title');
27
+ });
93
28
 
94
- it('renders the provided `itemsList` using the `list` component', () => {
95
- const faker = templateFaker();
96
- const listsSpy = faker.spy('list');
97
-
98
- faker.renderComponent('card', {
99
- title: {
100
- text: 'Example card title',
101
- },
102
- body: {
103
- text: 'Example card text.',
104
- id: 'example-text-id',
105
- itemsList: [{ text: 'Test item 1' }, { text: 'Test item 2' }],
106
- },
29
+ test('THEN: renders the body with the provided id', () => {
30
+ expect($('.ons-card__body').attr('id')).toBe('example-text-id');
107
31
  });
108
32
 
109
- expect(listsSpy.occurrences[0]).toEqual({
110
- variants: 'dashed',
111
- itemsList: [{ text: 'Test item 1' }, { text: 'Test item 2' }],
33
+ test('THEN: renders the body with the provided text', () => {
34
+ expect($('.ons-card__body').text().trim()).toBe('Example card text');
112
35
  });
113
36
  });
37
+ });
114
38
 
115
- it('outputs a hyperlink with the provided `url`', () => {
116
- const $ = cheerio.load(
117
- renderComponent('card', {
118
- title: {
119
- text: 'Example card title',
120
- url: 'https://example.com',
121
- },
122
- body: {
123
- text: 'Example card text.',
124
- id: 'example-text-id',
125
- },
126
- }),
127
- );
39
+ describe('GIVEN: Params: figure', () => {
40
+ describe('WHEN: figure is provided', () => {
41
+ const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_FULL_EXAMPLE));
128
42
 
129
- expect($('.ons-card__link').attr('href')).toBe('https://example.com');
43
+ test('THEN: it renders the provided figure', () => {
44
+ expect($('.ons-card__figure').text().trim()).toBe('123,456');
45
+ });
130
46
  });
131
47
  });
132
48
 
133
- describe('mode: with image', () => {
134
- it('passes jest-axe checks', async () => {
135
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));
136
-
137
- const results = await axe($.html());
138
- expect(results).toHaveNoViolations();
49
+ describe('GIVEN: Params: headingLevel', () => {
50
+ describe('WHEN: headingLevel is provided', () => {
51
+ it.each([
52
+ [1, 'h1'],
53
+ [4, 'h4'],
54
+ ])('THEN: it renders headings with the correct heading tag (%i -> <%s>)', (headingLevel, expectedTag) => {
55
+ const $ = cheerio.load(
56
+ renderComponent('card', {
57
+ ...EXAMPLE_CARD,
58
+ title: {
59
+ text: 'Example card title',
60
+ headingLevel,
61
+ },
62
+ }),
63
+ );
64
+ const titleTag = $('.ons-card__title')[0].tagName;
65
+ expect(titleTag).toBe(expectedTag);
66
+ });
139
67
  });
68
+ });
140
69
 
141
- it('has the provided `title` text', () => {
142
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));
143
-
144
- expect($('.ons-card__title').text().trim()).toBe('Example card title');
145
- });
70
+ describe('GIVEN: Params: itemsList', () => {
71
+ describe('WHEN: itemsList is provided in the body', () => {
72
+ test('THEN: renders the list with the provided items', () => {
73
+ const faker = templateFaker();
74
+ const listsSpy = faker.spy('list');
146
75
 
147
- it.each([
148
- [1, 'h1'],
149
- [4, 'h4'],
150
- ])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
151
- const $ = cheerio.load(
152
- renderComponent('card', {
153
- title: {
154
- text: 'Example card title',
155
- headingLevel: headingLevel,
156
- },
157
- body: {
158
- text: 'Example card text.',
159
- id: 'example-text-id',
160
- },
161
- image: {
162
- smallSrc: 'example-small.png',
163
- largeSrc: 'example-large.png',
164
- alt: 'Example alt text',
165
- },
166
- }),
167
- );
76
+ faker.renderComponent('card', EXAMPLE_CARD_WITH_LIST);
168
77
 
169
- expect($(`${expectedTitleTag}.ons-card__title`).text().trim()).toBe('Example card title');
78
+ expect(listsSpy.occurrences[0]).toEqual({
79
+ variants: 'dashed',
80
+ itemsList: [{ text: 'Test item 1' }, { text: 'Test item 2' }],
81
+ });
82
+ });
170
83
  });
84
+ });
171
85
 
172
- it('has the provided `text`', () => {
173
- const $ = cheerio.load(
174
- renderComponent('card', {
175
- ...EXAMPLE_CARD_WITH_IMAGE,
176
- }),
177
- );
178
-
179
- expect($('#example-text-id').text().trim()).toBe('Example card text.');
86
+ describe('GIVEN: Params: title', () => {
87
+ const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_FULL_EXAMPLE));
88
+ describe('WHEN: url is provided', () => {
89
+ test('THEN: renders the title with the provided url', () => {
90
+ expect($('.ons-card__link').attr('href')).toBe('http://example.com');
91
+ });
180
92
  });
181
-
182
- it('outputs a hyperlink with the provided `url`', () => {
183
- const $ = cheerio.load(
184
- renderComponent('card', {
185
- title: {
186
- text: 'Example card title',
187
- url: 'https://example.com',
188
- },
189
- body: {
190
- text: 'Example card text.',
191
- id: 'example-text-id',
192
- },
193
- }),
194
- );
195
-
196
- expect($('.ons-card__link').attr('href')).toBe('https://example.com');
93
+ describe('WHEN: subtitle is provided', () => {
94
+ test('THEN: it renders the subtitle with the provided text', () => {
95
+ expect($('.ons-card__subtitle').text().trim()).toBe('Optional subtitle');
96
+ });
197
97
  });
98
+ });
198
99
 
199
- describe('with a custom image', () => {
200
- it('outputs an `img` element', () => {
201
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));
100
+ describe('GIVEN: Params: image', () => {
101
+ describe('WHEN: an image is provided', () => {
102
+ const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));
202
103
 
203
- expect($('.ons-card__image')[0].tagName).toBe('img');
104
+ test('THEN: jest-axe checks pass', async () => {
105
+ const results = await axe($.html());
106
+ expect(results).toHaveNoViolations();
204
107
  });
205
108
 
206
- it('outputs an `img` element with the expected `srcset`', () => {
207
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));
109
+ test('THEN: it renders an image element', () => {
110
+ expect($('.ons-card__image')[0].tagName).toBe('img');
111
+ });
208
112
 
113
+ test('THEN: the image has the expected srcset attribute set', () => {
209
114
  expect($('.ons-card__image').attr('srcset')).toBe('example-small.png 1x, example-large.png 2x');
210
115
  });
211
116
 
212
- it('outputs an `img` element with the expected `src`', () => {
213
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));
214
-
117
+ test('THEN: the image has the expected src attribute source set', () => {
215
118
  expect($('.ons-card__image').attr('src')).toBe('example-small.png');
216
119
  });
217
120
 
218
- it('outputs an `img` element with the expected alt text', () => {
219
- const $ = cheerio.load(
220
- renderComponent('card', {
221
- ...EXAMPLE_CARD_WITH_IMAGE,
222
- alt: 'Example alt text',
223
- }),
224
- );
225
-
121
+ test('THEN: the image has the expected alt text', () => {
226
122
  expect($('.ons-card__image').attr('alt')).toBe('Example alt text');
227
123
  });
228
124
  });
229
125
 
230
- describe('with a default placeholder image', () => {
231
- it('outputs an `img` element', () => {
232
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE));
126
+ describe('WHEN: image is set to true', () => {
127
+ const $ = cheerio.load(renderComponent('card', { ...EXAMPLE_CARD, image: true }));
233
128
 
129
+ test('THEN: it outputs an image element', () => {
234
130
  expect($('.ons-card__image')[0].tagName).toBe('img');
235
131
  });
236
132
 
237
- it('outputs an `img` element with the expected `srcset`', () => {
238
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE));
239
-
133
+ test('THEN: the card is rendered with the srcset attribute set to the placeholder image', () => {
240
134
  expect($('.ons-card__image').attr('srcset')).toBe('/img/small/placeholder-card.png 1x, /img/large/placeholder-card.png 2x');
241
135
  });
242
136
 
243
- it('outputs an `img` element with the expected `src`', () => {
244
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE));
245
-
137
+ test('THEN: the card is rendered with the src attribute set to the placeholder image', () => {
246
138
  expect($('.ons-card__image').attr('src')).toBe('/img/small/placeholder-card.png');
247
139
  });
248
140
 
249
- it('outputs an `img` element with the expected empty alt text', () => {
250
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE));
251
-
141
+ test('THEN: the image has an empty alt attribute', () => {
252
142
  expect($('.ons-card__image').attr('alt')).toBe('');
253
143
  });
254
144
  });
255
145
 
256
- describe('with a default placeholder image with `placeholderUrl`', () => {
257
- it('outputs an `img` element', () => {
258
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));
146
+ describe('WHEN: image placeholderUrl is provided', () => {
147
+ const $ = cheerio.load(
148
+ renderComponent('card', {
149
+ ...EXAMPLE_CARD,
150
+ image: {
151
+ placeholderUrl: '/placeholder-image-url',
152
+ },
153
+ }),
154
+ );
259
155
 
156
+ test('THEN: it outputs an image element', () => {
260
157
  expect($('.ons-card__image')[0].tagName).toBe('img');
261
158
  });
262
159
 
263
- it('outputs an `img` element with the expected `srcset`', () => {
264
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));
265
-
160
+ test('THEN: the image has the expected srcset attribute set with the custom path', () => {
266
161
  expect($('.ons-card__image').attr('srcset')).toBe(
267
162
  '/placeholder-image-url/img/small/placeholder-card.png 1x, /placeholder-image-url/img/large/placeholder-card.png 2x',
268
163
  );
269
164
  });
270
165
 
271
- it('outputs an `img` element with the expected `src`', () => {
272
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));
273
-
166
+ test('THEN: the image has the expected src attribute set with the custom path', () => {
274
167
  expect($('.ons-card__image').attr('src')).toBe('/placeholder-image-url/img/small/placeholder-card.png');
275
168
  });
276
169
 
277
- it('outputs an `img` element with the expected empty alt text', () => {
278
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));
279
-
170
+ test('THEN: the image has an empty alt attribute', () => {
280
171
  expect($('.ons-card__image').attr('alt')).toBe('');
281
172
  });
282
173
  });
283
174
  });
284
175
 
285
- describe('variant: feature', () => {
286
- it('renders the `feature` variant with correct class', () => {
287
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_FEATURE_VARIANT));
288
- expect($('.ons-card').hasClass('ons-card--feature')).toBe(true);
289
- });
290
-
291
- it('has the provided `title` text', () => {
292
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_FEATURE_VARIANT));
293
-
294
- expect($('.ons-card__title').text().trim()).toBe('Feature card title');
295
- });
296
-
297
- it('has the provided `subitle` text', () => {
298
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_FEATURE_VARIANT));
299
-
300
- expect($('.ons-card__subtitle').text().trim()).toBe('Optional subtitle');
301
- });
302
-
303
- it('outputs a hyperlink with the provided `url`', () => {
176
+ describe('GIVEN: Params: variant', () => {
177
+ describe('WHEN: variant is set to feature', () => {
304
178
  const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_FEATURE_VARIANT));
305
179
 
306
- expect($('.ons-card__link').attr('href')).toBe('http://example.com');
307
- });
308
-
309
- it('has the provided `figure`', () => {
310
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_FEATURE_VARIANT));
311
-
312
- expect($('.ons-card__figure').text().trim()).toBe('123,456');
313
- });
314
-
315
- it('has the provided `text` accessible via the `textId` identifier', () => {
316
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_FEATURE_VARIANT));
317
-
318
- expect($('#example-feature-text-id').text().trim()).toBe('Example feature card text');
319
- });
320
-
321
- it('passes jest-axe checks', async () => {
322
- const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_FEATURE_VARIANT));
323
-
324
- const results = await axe($.html());
325
- expect(results).toHaveNoViolations();
180
+ test('THEN: it renders the card with the feature modifier class', () => {
181
+ expect($('.ons-card').hasClass('ons-card--feature')).toBe(true);
182
+ });
326
183
  });
327
184
  });
328
185
  });
@@ -0,0 +1,56 @@
1
+ export const EXAMPLE_CARD = {
2
+ title: {
3
+ text: 'Example card title',
4
+ },
5
+ body: {
6
+ text: 'Example card text',
7
+ id: 'example-text-id',
8
+ },
9
+ };
10
+
11
+ export const EXAMPLE_CARD_FULL_EXAMPLE = {
12
+ title: {
13
+ text: 'Example card title',
14
+ url: 'http://example.com',
15
+ subtitle: 'Optional subtitle',
16
+ },
17
+ body: {
18
+ figure: '123,456',
19
+ text: 'Example card text',
20
+ id: 'example-text-id',
21
+ },
22
+ };
23
+
24
+ export const EXAMPLE_CARD_WITH_LIST = {
25
+ title: {
26
+ text: 'Example card title',
27
+ },
28
+ body: {
29
+ text: 'Example card text.',
30
+ id: 'example-text-id',
31
+ itemsList: [{ text: 'Test item 1' }, { text: 'Test item 2' }],
32
+ },
33
+ };
34
+
35
+ export const EXAMPLE_CARD_WITH_IMAGE = {
36
+ ...EXAMPLE_CARD,
37
+ image: {
38
+ smallSrc: 'example-small.png',
39
+ largeSrc: 'example-large.png',
40
+ alt: 'Example alt text',
41
+ },
42
+ };
43
+
44
+ export const EXAMPLE_CARD_FEATURE_VARIANT = {
45
+ variant: 'feature',
46
+ title: {
47
+ text: 'Feature card title',
48
+ url: 'http://example.com',
49
+ subtitle: 'Optional subtitle',
50
+ },
51
+ body: {
52
+ figure: '123,456',
53
+ text: 'Example feature card text',
54
+ id: 'example-feature-text-id',
55
+ },
56
+ };
@@ -25,7 +25,10 @@
25
25
  }
26
26
 
27
27
  &__footnote-number {
28
- display: flex;
28
+ // !important is necessary for some range annotation labels at mobile, otherwise
29
+ // the inline-styled block display takes precedence. This inline style is only
30
+ // applied in some cases - it seems to happen when the shaded area is narrower than the label width.
31
+ display: flex !important;
29
32
  flex-shrink: 0;
30
33
  flex-grow: 0;
31
34
  align-items: center;
@@ -72,6 +75,39 @@
72
75
  font-size: 0.875rem; // 14px
73
76
  color: var(--ons-color-grey-100);
74
77
  }
78
+
79
+ &__boxplot-legend {
80
+ display: flex;
81
+ gap: 2rem;
82
+ font-size: 0.875rem; // 14px
83
+ padding-left: 1rem;
84
+ align-items: center;
85
+
86
+ &-item {
87
+ display: flex;
88
+ align-items: center;
89
+ gap: 0.5rem;
90
+ }
91
+
92
+ &-item {
93
+ &--uncertainty {
94
+ width: 12px;
95
+ height: 12px;
96
+ background-color: rgb(32 96 149 / 65%);
97
+ }
98
+
99
+ &--estimate {
100
+ width: 20px;
101
+ height: 3px;
102
+ border-radius: 2px;
103
+ background-color: #003c57;
104
+ }
105
+ }
106
+
107
+ &-label {
108
+ font-size: inherit;
109
+ }
110
+ }
75
111
  }
76
112
 
77
113
  // This is a workaround to position the axis title to the left
@@ -88,3 +124,40 @@
88
124
  .highcharts-a11y-proxy-group-legend button {
89
125
  cursor: auto !important;
90
126
  }
127
+
128
+ .ons-chart__range-annotation-label {
129
+ &--x {
130
+ padding: 0 1.25rem;
131
+ }
132
+
133
+ &--outside {
134
+ padding: 0;
135
+ overflow: visible !important;
136
+ }
137
+
138
+ &--right {
139
+ text-align: left !important;
140
+ padding-left: 0.3125rem;
141
+ }
142
+
143
+ &--left {
144
+ text-align: right !important;
145
+ padding-right: 0.3125rem;
146
+ }
147
+
148
+ &--top {
149
+ text-align: center !important;
150
+ padding-bottom: 0.3125rem;
151
+ }
152
+
153
+ &--bottom {
154
+ text-align: center !important;
155
+ padding-top: 0.3125rem;
156
+ }
157
+ }
158
+
159
+ .ons-chart__connector-line {
160
+ position: absolute;
161
+ border-top: 1px solid var(--ons-color-grey-100);
162
+ border-left: 1px solid var(--ons-color-grey-100);
163
+ }