@ons/design-system 72.10.3 → 72.10.4

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 (36) hide show
  1. package/components/card/_card.scss +1 -0
  2. package/components/card/example-card-set-with-headline-figures.njk +4 -4
  3. package/components/chart/_macro.njk +34 -34
  4. package/components/chart/_macro.spec.js +0 -49
  5. package/components/chart/chart.js +18 -8
  6. package/components/chart/columnrange-chart.js +3 -0
  7. package/components/chart/common-chart-options.js +1 -13
  8. package/components/chart/example-bar-with-confidence-levels.njk +0 -5
  9. package/components/chart/example-column-with-confidence-levels.njk +1 -4
  10. package/components/chart/example-scatter-chart.njk +4 -8
  11. package/components/chart/specific-chart-options.js +32 -9
  12. package/components/description-list/_description-list.scss +7 -6
  13. package/components/description-list/_macro.njk +1 -1
  14. package/components/details-panel/_details-panel.scss +40 -20
  15. package/components/details-panel/_macro.njk +18 -12
  16. package/components/details-panel/example-details-panel.njk +1 -0
  17. package/components/featured-article/_macro.njk +76 -0
  18. package/components/featured-article/example-featured-article-with-chart.njk +223 -0
  19. package/components/featured-article/example-featured-article-with-image.njk +24 -0
  20. package/components/featured-article/featured-article.scss +33 -0
  21. package/components/featured-article/macro.spec.js +173 -0
  22. package/components/header/_header.scss +34 -1
  23. package/components/header/_macro.njk +140 -132
  24. package/components/hero/_hero.scss +5 -0
  25. package/components/hero/_macro.njk +8 -4
  26. package/components/hero/example-hero-grey.njk +2 -17
  27. package/css/main.css +1 -1
  28. package/css/print.css +1 -1
  29. package/js/details.js +39 -0
  30. package/js/main.js +1 -0
  31. package/package.json +1 -1
  32. package/scripts/main.es5.js +1 -1
  33. package/scripts/main.js +1 -1
  34. package/scss/main.scss +1 -0
  35. package/scss/print.scss +6 -1
  36. package/scss/utilities/_grid.scss +46 -0
@@ -5,6 +5,7 @@
5
5
  &--feature {
6
6
  background-color: var(--ons-color-banner-bg);
7
7
  padding: 2rem;
8
+ outline: 1px solid transparent;
8
9
  }
9
10
 
10
11
  &__link {
@@ -1,8 +1,8 @@
1
1
  {% from "components/card/_macro.njk" import onsCard %}
2
2
 
3
3
  <div class="ons-container">
4
- <div class="ons-grid ons-grid-flex ons-grid-flex--vertical-top">
5
- <div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch ons-u-flex-grow ons-col-4@m">
4
+ <div class="ons-grid ons-grid-flex-gap ons-grid-flex-gap--s ons-grid-flex--vertical-top">
5
+ <div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch">
6
6
  {{
7
7
  onsCard({
8
8
  "variant": 'feature',
@@ -20,7 +20,7 @@
20
20
  }}
21
21
  </div>
22
22
 
23
- <div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch ons-u-flex-grow ons-col-4@m">
23
+ <div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch">
24
24
  {{
25
25
  onsCard({
26
26
  "variant": 'feature',
@@ -38,7 +38,7 @@
38
38
  }}
39
39
  </div>
40
40
 
41
- <div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch ons-u-flex-grow ons-col-4@m">
41
+ <div class="ons-grid__col ons-grid__col--flex-col ons-grid__col--stretch">
42
42
  {{
43
43
  onsCard({
44
44
  "variant": 'feature',
@@ -2,14 +2,9 @@
2
2
 
3
3
  {% macro onsChart(params) %}
4
4
  {% set supportedChartTypes = ['line', 'bar', 'column', 'scatter', 'area', 'columnrange', 'boxplot'] %}
5
- {% set supportedChartTypesWithLine = ['column', 'columnrange'] %}
5
+ {% set supportedChartTypesWithLine = ['column'] %}
6
6
  {% set supportedChartTypesWithScatter = ['columnrange'] %}
7
-
8
- {% if params.headingLevel and params.headingLevel >= 1 and params.headingLevel <= 4 %}
9
- {% set headingLevel = params.headingLevel %}
10
- {% else %}
11
- {% set headingLevel = 2 %}
12
- {% endif %}
7
+ {% set headingLevel = params.headingLevel | default(2) %}
13
8
  {% set openingTitleTag = "<h" ~ headingLevel %}
14
9
  {% set closingTitleTag = "</h" ~ headingLevel ~ ">" %}
15
10
  {% set openingSubtitleTag = "<h" ~ (headingLevel + 1) %}
@@ -53,8 +48,11 @@
53
48
  >
54
49
  <figure class="ons-chart">
55
50
  {{ openingTitleTag | safe }} class="ons-chart__title">{{ params.title }}{{ closingTitleTag | safe }}
56
- {{ openingSubtitleTag | safe }}
57
- class="ons-chart__subtitle">{{ params.subtitle }}{{ closingSubtitleTag | safe }}
51
+ {% if params.subtitle %}
52
+ {{ openingSubtitleTag | safe }}
53
+ class="ons-chart__subtitle">{{ params.subtitle }}{{ closingSubtitleTag | safe }}
54
+ {% endif %}
55
+
58
56
  {% if params.description %}
59
57
  <p class="ons-u-vh">{{ params.description }}</p>
60
58
  {% endif %}
@@ -83,28 +81,31 @@
83
81
  Footnotes for the annotations at mobile
84
82
  Hidden from screen readers because the full text will be read out where they appear in the chart
85
83
  #}
86
- <ul class="ons-chart__footnotes" aria-hidden="true">
87
- {% for annotation in params.annotations %}
88
- <li class="ons-chart__footnote_item">
89
- <span class="ons-chart__footnote-number">{{ loop.index }}</span>
90
- {{ annotation.text }}
91
- </li>
92
- {% endfor %}
93
- {% for rangeAnnotation in params.rangeAnnotations %}
94
- <li class="ons-chart__footnote_item">
95
- <span class="ons-chart__footnote-number">{{ loop.index + params.annotations | length }}</span>
96
- {{ rangeAnnotation.text }}
97
- </li>
98
- {% endfor %}
99
- {% for referenceLineAnnotation in params.referenceLineAnnotations %}
100
- <li class="ons-chart__footnote_item">
101
- <span class="ons-chart__footnote-number"
102
- >{{ loop.index + params.annotations | length + params.rangeAnnotations | length }}</span
103
- >
104
- {{ referenceLineAnnotation.text }}
105
- </li>
106
- {% endfor %}
107
- </ul>
84
+ {% if params.annotations or params.rangeAnnotations or params.referenceLineAnnotations %}
85
+ <ul class="ons-chart__footnotes" aria-hidden="true">
86
+ {% for annotation in params.annotations %}
87
+ <li class="ons-chart__footnote_item">
88
+ <span class="ons-chart__footnote-number">{{ loop.index }}</span>
89
+ {{ annotation.text }}
90
+ </li>
91
+ {% endfor %}
92
+ {% for rangeAnnotation in params.rangeAnnotations %}
93
+ <li class="ons-chart__footnote_item">
94
+ <span class="ons-chart__footnote-number">{{ loop.index + params.annotations | length }}</span>
95
+ {{ rangeAnnotation.text }}
96
+ </li>
97
+ {% endfor %}
98
+ {% for referenceLineAnnotation in params.referenceLineAnnotations %}
99
+ <li class="ons-chart__footnote_item">
100
+ <span class="ons-chart__footnote-number"
101
+ >{{ loop.index + params.annotations | length + params.rangeAnnotations | length }}</span
102
+ >
103
+ {{ referenceLineAnnotation.text }}
104
+ </li>
105
+ {% endfor %}
106
+ </ul>
107
+ {% endif %}
108
+
108
109
  {% if params.caption %}
109
110
  <figcaption class="ons-chart__caption">{{ params.caption }}</figcaption>
110
111
  {% endif %}
@@ -132,7 +133,7 @@
132
133
  "name": item.name if item.name else '',
133
134
  "data": item.data if item.data else [],
134
135
  "marker": {
135
- "enabled": item.marker if item.marker else false
136
+ "enabled": true if (item.type == 'scatter' or params.chartType == 'scatter' or item.marker == true) else false
136
137
  },
137
138
  "dataLabels": {
138
139
  "enabled": item.dataLabels if item.dataLabels else false
@@ -160,8 +161,7 @@
160
161
  {%
161
162
  set config = {
162
163
  "chart": {
163
- "type": params.chartType,
164
- "inverted": params.isChartInverted if params.isChartInverted == true else false
164
+ "type": params.chartType
165
165
  },
166
166
  "legend": {
167
167
  "enabled" : legendValue
@@ -1132,55 +1132,6 @@ describe('Macro: Chart', () => {
1132
1132
  expect(configScript).toContain('"type":"columnrange"');
1133
1133
  expect(configScript).toContain('"type":"scatter"');
1134
1134
  });
1135
-
1136
- describe('GIVEN: Params: isChartInverted', () => {
1137
- describe('WHEN: isChartInverted parameter is provided and set to true', () => {
1138
- const $ = cheerio.load(
1139
- renderComponent('chart', {
1140
- ...EXAMPLE_COLUMN_RANGE_CHART_PARAMS,
1141
- isChartInverted: true,
1142
- }),
1143
- );
1144
- test('THEN: it sets isChartInverted to true', () => {
1145
- const configScript = $(`script[data-highcharts-config--uuid]`).html();
1146
- expect(configScript).toContain('"chart":{"type":"columnrange","inverted":true}');
1147
- });
1148
- });
1149
-
1150
- describe('WHEN: isChartInverted parameter is provided and set to false', () => {
1151
- const $ = cheerio.load(
1152
- renderComponent('chart', {
1153
- ...EXAMPLE_COLUMN_RANGE_CHART_PARAMS,
1154
- isChartInverted: false,
1155
- }),
1156
- );
1157
- test('THEN: it sets isChartInverted to false', () => {
1158
- const configScript = $(`script[data-highcharts-config--uuid]`).html();
1159
- expect(configScript).toContain('"chart":{"type":"columnrange","inverted":false}');
1160
- });
1161
- });
1162
-
1163
- describe('WHEN: isChartInverted parameter is not provided', () => {
1164
- const $ = cheerio.load(renderComponent('chart', EXAMPLE_COLUMN_RANGE_CHART_PARAMS));
1165
- test('THEN: it sets isChartInverted to false', () => {
1166
- const configScript = $(`script[data-highcharts-config--uuid]`).html();
1167
- expect(configScript).toContain('"chart":{"type":"columnrange","inverted":false}');
1168
- });
1169
- });
1170
-
1171
- describe('WHEN: isChartInverted parameter is provided but is not a boolean', () => {
1172
- const $ = cheerio.load(
1173
- renderComponent('chart', {
1174
- ...EXAMPLE_COLUMN_RANGE_CHART_PARAMS,
1175
- isChartInverted: 'false',
1176
- }),
1177
- );
1178
- test('THEN: it sets isChartInverted to false', () => {
1179
- const configScript = $(`script[data-highcharts-config--uuid]`).html();
1180
- expect(configScript).toContain('"chart":{"type":"columnrange","inverted":false}');
1181
- });
1182
- });
1183
- });
1184
1135
  });
1185
1136
  });
1186
1137
  });
@@ -62,14 +62,20 @@ class HighchartsBaseChart {
62
62
  this.yAxisTickIntervalDesktop = this.node.dataset.highchartsYAxisTickIntervalDesktop
63
63
  ? parseInt(this.node.dataset.highchartsYAxisTickIntervalDesktop)
64
64
  : undefined;
65
- this.commonChartOptions = new CommonChartOptions(this.xAxisTickIntervalDesktop, this.yAxisTickIntervalDesktop);
65
+ this.commonChartOptions = new CommonChartOptions();
66
66
  this.estimateLineLabel = this.node.dataset.highchartsEstimateLineLabel;
67
67
  this.uncertainyRangeLabel = this.node.dataset.highchartsUncertaintyRangeLabel;
68
68
  this.customReferenceLineValue = this.node.dataset.highchartsCustomReferenceLineValue
69
69
  ? parseFloat(this.node.dataset.highchartsCustomReferenceLineValue)
70
70
  : undefined;
71
71
 
72
- this.specificChartOptions = new SpecificChartOptions(this.theme, this.chartType, this.config);
72
+ this.specificChartOptions = new SpecificChartOptions(
73
+ this.theme,
74
+ this.chartType,
75
+ this.config,
76
+ this.xAxisTickIntervalDesktop,
77
+ this.yAxisTickIntervalDesktop,
78
+ );
73
79
  this.lineChart = new LineChart();
74
80
  this.barChart = new BarChart();
75
81
  this.columnChart = new ColumnChart();
@@ -259,25 +265,29 @@ class HighchartsBaseChart {
259
265
  const currentChart = event.target;
260
266
  if (this.chartType === 'line') {
261
267
  this.lineChart.updateLastPointMarker(currentChart.series);
262
- this.commonChartOptions.hideDataLabels(currentChart.series);
268
+ this.specificChartOptions.hideDataLabels(currentChart.series);
263
269
  }
264
270
  if (this.chartType === 'bar') {
265
271
  this.barChart.updateBarChartHeight(this.config, currentChart, this.useStackedLayout);
266
272
  if (!this.hideDataLabels) {
267
273
  this.barChart.postLoadDataLabels(currentChart);
268
274
  } else {
269
- this.commonChartOptions.hideDataLabels(currentChart.series);
275
+ this.specificChartOptions.hideDataLabels(currentChart.series);
270
276
  }
271
277
  }
272
278
  if (this.chartType === 'column') {
273
- this.commonChartOptions.hideDataLabels(currentChart.series);
279
+ this.specificChartOptions.hideDataLabels(currentChart.series);
274
280
  }
275
281
  if (this.chartType === 'scatter') {
276
282
  this.scatterChart.updateMarkers(currentChart);
283
+ this.specificChartOptions.hideDataLabels(currentChart.series);
284
+ }
285
+ if (this.chartType === 'boxplot') {
286
+ this.specificChartOptions.hideDataLabels(currentChart.series);
277
287
  }
278
288
  if (this.chartType === 'columnrange') {
279
289
  this.columnRangeChart.updateColumnRangeChartHeight(this.config, currentChart);
280
- this.commonChartOptions.hideDataLabels(currentChart.series);
290
+ this.specificChartOptions.hideDataLabels(currentChart.series);
281
291
 
282
292
  if (this.extraScatter > 0) {
283
293
  const scatterSeries = currentChart.series.filter((series) => series.type === 'scatter');
@@ -290,7 +300,7 @@ class HighchartsBaseChart {
290
300
  if (this.extraLines > 0) {
291
301
  currentChart.series.forEach((series) => {
292
302
  if (series.type === 'line') {
293
- this.commonChartOptions.hideDataLabels([series]);
303
+ this.specificChartOptions.hideDataLabels([series]);
294
304
  }
295
305
  });
296
306
  }
@@ -307,7 +317,7 @@ class HighchartsBaseChart {
307
317
  if (this.rangeAnnotationsOptions) {
308
318
  this.rangeAnnotationsOptions.addLine(currentChart);
309
319
  }
310
- if (this.chartType != 'bar') {
320
+ if (this.chartType != 'bar' && this.chartType != 'columnrange') {
311
321
  this.specificChartOptions.adjustChartHeight(currentChart, this.percentageHeightDesktop, this.percentageHeightMobile);
312
322
  }
313
323
  // Update the legend symbols on render to maintain them during resize
@@ -57,6 +57,9 @@ class ColumnRangeChart {
57
57
  useHTML: false,
58
58
  },
59
59
  },
60
+ chart: {
61
+ inverted: true, // Invert the chart to make it horizontal
62
+ },
60
63
  legend: {
61
64
  symbolRadius: 0,
62
65
  itemStyle: {
@@ -2,7 +2,7 @@ import ChartConstants from './chart-constants';
2
2
 
3
3
  // Options that are common to all chart types - these are set once in the Highcharts.setOptions() method
4
4
  class CommonChartOptions {
5
- constructor(xAxisTickInterval, yAxisTickInterval) {
5
+ constructor() {
6
6
  this.constants = ChartConstants.constants();
7
7
 
8
8
  this.options = {
@@ -85,7 +85,6 @@ class CommonChartOptions {
85
85
  tickWidth: 1,
86
86
  tickLength: 6,
87
87
  tickColor: this.constants.gridLineColor,
88
- tickInterval: yAxisTickInterval,
89
88
  },
90
89
  xAxis: {
91
90
  labels: {
@@ -109,7 +108,6 @@ class CommonChartOptions {
109
108
  tickWidth: 1,
110
109
  tickLength: 6,
111
110
  tickColor: this.constants.gridLineColor,
112
- tickInterval: xAxisTickInterval,
113
111
  },
114
112
  plotOptions: {
115
113
  series: {
@@ -134,16 +132,6 @@ class CommonChartOptions {
134
132
  }
135
133
 
136
134
  getOptions = () => this.options;
137
-
138
- hideDataLabels = (series) => {
139
- series.forEach((series) => {
140
- series.update({
141
- dataLabels: {
142
- enabled: false,
143
- },
144
- });
145
- });
146
- };
147
135
  }
148
136
 
149
137
  export default CommonChartOptions;
@@ -3,9 +3,7 @@
3
3
  {{
4
4
  onsChart({
5
5
  "chartType": "columnrange",
6
- "isChartInverted": true,
7
6
  "description": "Volume sales, seasonally adjusted, Great Britain, January 2022 to January 2025",
8
- "theme": "primary",
9
7
  "title": "Food stores showed a strong rise on the month, while non-food stores fell",
10
8
  "subtitle": "Figure 6: Upward contribution from housing and household services (including energy) saw the annual CPIH inflation rate rise",
11
9
  "id": "uuid",
@@ -56,13 +54,10 @@
56
54
  [-10.5, 12.0],
57
55
  [-12.1, 18.5]
58
56
  ],
59
- "dataLabels": true,
60
57
  "name": "Values"
61
58
  },
62
59
  {
63
60
  "data": [1,2,3,4,5,6,7,8,9,10,3,11,12],
64
- "marker": true,
65
- "dataLabels": false,
66
61
  "name": "Another test data source",
67
62
  "type": "scatter"
68
63
  }
@@ -4,7 +4,6 @@
4
4
  onsChart({
5
5
  "chartType": "boxplot",
6
6
  "description": "Public sector net debt excluding public sector banks, percentage of gross domestic product (GDP), UK, financial year ending (FYE) 1901 to October 2024",
7
- "theme": "primary",
8
7
  "title": "Figure 6: Net debt as a percentage of GDP remains at levels last seen in the early 1960s",
9
8
  "subtitle": "Public sector net debt excluding public sector banks, percentage of gross domestic product (GDP), UK, financial year ending (FYE) 1901 to October 2024",
10
9
  "id": "uuid",
@@ -39,9 +38,7 @@
39
38
  [817, 817, 817, 817, 817],
40
39
  [806, 806, 806, 806, 806],
41
40
  [864, 864, 864, 864, 864]
42
- ],
43
- "dataLabels": false,
44
- "name": "Net debt"
41
+ ]
45
42
  }
46
43
  ],
47
44
  'estimateLineLabel': 'Data line',
@@ -46,8 +46,7 @@
46
46
  [163.5, 54.9], [158.7, 51.2], [165.5, 57.8], [160.4, 52.7],
47
47
  [162.7, 55.4], [166.4, 58.4], [159.4, 51.5], [164.8, 56.5],
48
48
  [158.6, 50.6], [163.4, 53.5]
49
- ],
50
- "marker": true
49
+ ]
51
50
  },
52
51
  {
53
52
  "name": "Male",
@@ -60,8 +59,7 @@
60
59
  [178.7, 68.8], [182.2, 74.7], [176.4, 67.5], [188.0, 77.6],
61
60
  [184.1, 73.4], [179.2, 70.8], [186.6, 79.8], [183.4, 75.4],
62
61
  [177.8, 69.6], [185.5, 76.7]
63
- ],
64
- "marker": true
62
+ ]
65
63
  },
66
64
  {
67
65
  "name": "Adolescent Male",
@@ -72,8 +70,7 @@
72
70
  [168.8, 58.6], [171.5, 62.8], [169.2, 59.4], [173.7, 63.5],
73
71
  [170.2, 61.6], [172.4, 64.2], [168.2, 58.1], [173.9, 64.8],
74
72
  [169.8, 60.7], [171.4, 63.6]
75
- ],
76
- "marker": true
73
+ ]
77
74
  },
78
75
  {
79
76
  "name": "Adolescent Female",
@@ -84,8 +81,7 @@
84
81
  [164.5, 55.1], [166.2, 57.5], [163.4, 53.6], [165.9, 56.2],
85
82
  [162.6, 52.5], [167.5, 58.4], [164.4, 55.6], [166.6, 57.6],
86
83
  [163.8, 53.7], [165.2, 56.9]
87
- ],
88
- "marker": true
84
+ ]
89
85
  }
90
86
  ],
91
87
  "percentageHeightDesktop": 35,
@@ -2,7 +2,7 @@ import ChartConstants from './chart-constants';
2
2
 
3
3
  // Options that rely on the chart config but are not specific to the chart type
4
4
  class SpecificChartOptions {
5
- constructor(theme, type, config) {
5
+ constructor(theme, type, config, xAxisTickInterval, yAxisTickInterval) {
6
6
  this.constants = ChartConstants.constants();
7
7
  this.theme = theme;
8
8
  this.config = config;
@@ -13,6 +13,12 @@ class SpecificChartOptions {
13
13
  type: type,
14
14
  marginTop: this.config.legend.enabled ? (type === 'boxplot' ? 50 : undefined) : 50,
15
15
  },
16
+ yAxis: {
17
+ tickInterval: yAxisTickInterval,
18
+ },
19
+ xAxis: {
20
+ tickInterval: xAxisTickInterval,
21
+ },
16
22
  };
17
23
  }
18
24
 
@@ -32,6 +38,16 @@ class SpecificChartOptions {
32
38
  };
33
39
  };
34
40
 
41
+ hideDataLabels = (series) => {
42
+ series.forEach((series) => {
43
+ series.update({
44
+ dataLabels: {
45
+ enabled: false,
46
+ },
47
+ });
48
+ });
49
+ };
50
+
35
51
  disableLegendForSingleSeries = (config) => {
36
52
  if (config.chart.type != 'boxplot' && config.series.length === 1) {
37
53
  config.legend = {
@@ -42,18 +58,25 @@ class SpecificChartOptions {
42
58
  };
43
59
 
44
60
  adjustChartHeight = (currentChart, percentageHeightDesktop, percentageHeightMobile) => {
45
- // get height and width of the plot area
46
- const plotHeight = currentChart.plotHeight;
61
+ // get current width of the plot area
47
62
  const plotWidth = currentChart.plotWidth;
48
- // calculate the new plot height based on the percentage height
49
- // default to the current height
50
- let newPlotHeight = plotHeight;
63
+ let newPlotHeight = undefined;
64
+ let totalHeight = 400; // Highcharts default height - needed if one of the percentage heights is undefined
65
+
66
+ // Calculate the new plot height based on the percentage height
51
67
  if (plotWidth > 400) {
52
- newPlotHeight = Math.round(plotWidth * (percentageHeightDesktop / 100));
68
+ if (percentageHeightDesktop !== undefined) {
69
+ newPlotHeight = Math.round(plotWidth * (percentageHeightDesktop / 100));
70
+ }
53
71
  } else {
54
- newPlotHeight = Math.round(plotWidth * (percentageHeightMobile / 100));
72
+ if (percentageHeightMobile !== undefined) {
73
+ newPlotHeight = Math.round(plotWidth * (percentageHeightMobile / 100));
74
+ }
75
+ }
76
+ // update the total height if we have a new plot height
77
+ if (newPlotHeight !== undefined) {
78
+ totalHeight = currentChart.plotTop + newPlotHeight + currentChart.marginBottom;
55
79
  }
56
- const totalHeight = currentChart.plotTop + newPlotHeight + currentChart.marginBottom;
57
80
 
58
81
  // set the new size of the chart
59
82
  if (totalHeight !== currentChart.chartHeight) {
@@ -41,17 +41,17 @@
41
41
  }
42
42
 
43
43
  &--inline {
44
- .ons-description-list__term {
45
- padding-right: 1rem;
46
- }
47
-
48
44
  @include mq(l) {
49
45
  display: grid;
50
46
  grid-template-columns: repeat(3, 1fr);
51
- grid-template-rows: repeat(2, 1fr);
52
- grid-auto-flow: column;
47
+ grid-auto-rows: auto;
48
+ grid-auto-flow: row;
53
49
  gap: 0.5rem 2.5rem;
54
50
 
51
+ &-single {
52
+ grid-template-columns: 1fr;
53
+ }
54
+
55
55
  .ons-description-list__value {
56
56
  grid-column-start: 2;
57
57
  }
@@ -59,6 +59,7 @@
59
59
  .ons-description-list__item {
60
60
  display: grid;
61
61
  grid-template-columns: auto 1fr;
62
+ grid-column-gap: 1rem;
62
63
  }
63
64
  }
64
65
  }
@@ -1,6 +1,6 @@
1
1
  {% macro onsDescriptionList(params) %}
2
2
  <dl
3
- class="ons-description-list ons-description-list__items ons-grid ons-grid--gutterless{{ ' ons-description-list--inline' if params.variant == 'inline' else ' ons-u-cf' }}{{ ' ' + params.classes if params.classes else '' }}"
3
+ class="ons-description-list ons-description-list__items ons-grid ons-grid--gutterless{{ ' ons-description-list--inline' if params.variant == 'inline' else ' ons-u-cf' }}{{ ' ons-description-list--inline-single' if params.itemsList|length < 2 else '' }}{{ ' ' + params.classes if params.classes else '' }}"
4
4
  {% if params.id %}id="{{ params.id }}"{% endif %}
5
5
  {% if params.descriptionListLabel %}
6
6
  title="{{ params.descriptionListLabel }}" aria-label="{{ params.descriptionListLabel }}"
@@ -20,6 +20,27 @@
20
20
  background-color: var(--ons-color-ocean-blue);
21
21
  color: var(--ons-color-white);
22
22
  border: 1px solid var(--ons-color-ocean-blue);
23
+
24
+ // remove browser default arrow for <details>
25
+ &::marker,
26
+ &::-webkit-details-marker {
27
+ display: none;
28
+ }
29
+
30
+ &:focus {
31
+ outline: 0;
32
+
33
+ #{$root}__banner-detail {
34
+ background: var(--ons-color-focus);
35
+ box-shadow: 0 ems($button-shadow-size) 0 var(--ons-color-text-link-focus);
36
+ color: var(--ons-color-text-link-focus);
37
+ outline: none;
38
+ }
39
+
40
+ #{$root}__banner-detail-title {
41
+ text-decoration: none;
42
+ }
43
+ }
23
44
  }
24
45
 
25
46
  &__banner-contents {
@@ -29,22 +50,28 @@
29
50
  &__banner-detail {
30
51
  width: fit-content;
31
52
  cursor: pointer;
32
-
33
- &:focus {
34
- background: var(--ons-color-focus);
35
- box-shadow: 0 ems($button-shadow-size) 0 var(--ons-color-text-link-focus);
36
- color: var(--ons-color-text-link-focus);
37
- outline: none;
38
- }
39
53
  }
40
54
 
41
55
  &__banner-detail-title {
42
56
  text-decoration: underline var(--ons-color-white) 2px;
43
57
  text-underline-position: under;
44
- }
58
+ display: inline-block;
59
+
60
+ &--open {
61
+ display: inline;
45
62
 
46
- &__banner-detail:focus &__banner-detail-title {
47
- text-decoration: none;
63
+ #{$root}[open] & {
64
+ display: none;
65
+ }
66
+ }
67
+
68
+ &--close {
69
+ display: none;
70
+
71
+ #{$root}[open] & {
72
+ display: inline;
73
+ }
74
+ }
48
75
  }
49
76
 
50
77
  &__banner-detail-icon {
@@ -65,19 +92,12 @@
65
92
  #{$root}[open] & {
66
93
  display: block;
67
94
  }
68
-
69
- .ons-details--initialised & {
70
- display: none;
71
- }
72
95
  }
73
96
 
74
97
  &__item {
75
98
  display: flex;
76
99
  flex-direction: column;
77
100
  border-bottom: 1px solid var(--ons-color-borders);
78
- @extend .ons-u-pb-xl;
79
- @extend .ons-u-mb-l;
80
- @extend .ons-u-ml-2xs;
81
101
 
82
102
  @include mq('m') {
83
103
  flex-direction: row;
@@ -85,14 +105,16 @@
85
105
  }
86
106
 
87
107
  &:last-child {
88
- border-bottom: 0;
89
108
  @extend .ons-u-mb-no;
90
109
  @extend .ons-u-pb-no;
110
+
111
+ border-bottom: 0;
91
112
  }
92
113
  }
93
114
 
94
115
  &__content-meta {
95
116
  @extend .ons-u-mb-no;
117
+
96
118
  @include mq('m') {
97
119
  flex-basis: 25%;
98
120
  min-width: 16.5rem;
@@ -101,7 +123,5 @@
101
123
 
102
124
  &__content-heading {
103
125
  color: var(--ons-color-black);
104
- @extend .ons-u-fs-r--b;
105
- @extend .ons-u-mb-no;
106
126
  }
107
127
  }