@ons/design-system 72.10.8 → 72.10.10

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 (66) hide show
  1. package/README.md +9 -5
  2. package/components/accordion/accordion.js +3 -2
  3. package/components/announcement-banner/_announcement-banner.scss +24 -0
  4. package/components/announcement-banner/_macro.njk +33 -0
  5. package/components/announcement-banner/_macro.spec.js +106 -0
  6. package/components/announcement-banner/_test_examples.js +22 -0
  7. package/components/announcement-banner/example-banner-black.njk +12 -0
  8. package/components/announcement-banner/example-banner-red.njk +13 -0
  9. package/components/announcement-banner/example-banner-teal.njk +13 -0
  10. package/components/autosuggest/autosuggest.spec.js +2 -0
  11. package/components/autosuggest/autosuggest.ui.js +12 -7
  12. package/components/breadcrumbs/_breadcrumbs.scss +53 -0
  13. package/components/breadcrumbs/_macro.njk +33 -24
  14. package/components/breadcrumbs/_macro.spec.js +25 -0
  15. package/components/button/_button.scss +29 -1
  16. package/components/chart/_chart.scss +88 -0
  17. package/components/chart/_macro.njk +25 -6
  18. package/components/chart/_macro.spec.js +1178 -640
  19. package/components/chart/bar-chart.js +8 -1
  20. package/components/chart/chart-iframe-resize.js +2 -2
  21. package/components/chart/common-chart-options.js +9 -0
  22. package/components/chart/example-bar-chart-with-axis-min-and-max-values.njk +0 -1
  23. package/components/chart/example-bar-chart-with-point-range-and-reference-line-annotations.njk +4 -4
  24. package/components/chart/example-bar-chart.njk +0 -1
  25. package/components/chart/example-iframe-chart.njk +1 -1
  26. package/components/chart/range-annotations-options.js +1 -1
  27. package/components/download-resources/download-resources.spec.js +2 -0
  28. package/components/duration/example-duration-error-for-single-field.njk +0 -1
  29. package/components/duration/example-duration-error.njk +0 -1
  30. package/components/footer/_macro.spec.js +2 -2
  31. package/components/header/_macro.njk +5 -16
  32. package/components/header/example-header-button-and-navigation.njk +133 -0
  33. package/components/header/example-header-external-with-navigation-and-search.njk +1 -1
  34. package/components/hero/_hero.scss +17 -22
  35. package/components/hero/_macro.njk +1 -1
  36. package/components/hero/_macro.spec.js +1 -1
  37. package/components/hero/example-hero-dark-with-external-breadcrumbs.njk +194 -0
  38. package/components/hero/example-hero-default-with-external-breadcrumbs.njk +201 -0
  39. package/components/hero/example-hero-grey-with-external-breadcrumbs.njk +243 -0
  40. package/components/hero/example-hero-navy-blue-with-external-breadcrumbs.njk +200 -0
  41. package/components/hero/example-hero-pale-blue-with-external-breadcrumbs.njk +201 -0
  42. package/components/icon/_macro.njk +1 -1
  43. package/components/mutually-exclusive/mutually-exclusive.js +3 -1
  44. package/components/navigation/_macro.njk +11 -16
  45. package/components/navigation/_navigation.scss +24 -0
  46. package/components/radios/clear-radios.js +4 -2
  47. package/components/relationships/relationships.js +4 -2
  48. package/components/table/_macro.njk +107 -112
  49. package/components/table/_macro.spec.js +35 -44
  50. package/components/table/_table.scss +0 -12
  51. package/components/table/example-table-sortable.njk +1 -1
  52. package/components/tabs/example-tabs-details.njk +1 -1
  53. package/components/textarea/_macro.njk +1 -0
  54. package/components/textarea/_macro.spec.js +1 -0
  55. package/components/timeout-panel/timeout-panel.spec.js +1 -1
  56. package/components/video/video.js +2 -0
  57. package/css/main.css +1 -1
  58. package/js/timeout.js +9 -6
  59. package/layout/_template.njk +13 -0
  60. package/package.json +6 -6
  61. package/scripts/main.es5.js +4 -2
  62. package/scripts/main.js +4 -2
  63. package/scss/main.scss +1 -0
  64. package/scss/vars/_colors.scss +3 -0
  65. package/scss/vars/_forms.scss +11 -0
  66. package/components/table/example-table-scrollable.njk +0 -158
@@ -7,6 +7,28 @@
7
7
  overflow: visible !important;
8
8
  }
9
9
 
10
+ @media (forced-colors: active) {
11
+ .highcharts-plot-band {
12
+ fill: var(--ons-color-grey-75); /* Forces the color used for text in high contrast mode */
13
+ }
14
+ .highcharts-annotation-label text,
15
+ .highcharts-plot-line-label,
16
+ .highcharts-plot-band-label {
17
+ fill: CanvasText !important; /* Forces the color used for text in high contrast mode */
18
+ }
19
+
20
+ .highcharts-annotation-label-box {
21
+ fill: Canvas; /* Sets the background to match system background */
22
+ stroke: CanvasText; /* Ensures border is visible in contrast mode */
23
+ }
24
+ }
25
+
26
+ &__container:focus {
27
+ box-shadow: 0 0 0 3px var(--ons-color-black);
28
+ outline: 4px solid var(--ons-color-focus);
29
+ outline-offset: 2px;
30
+ }
31
+
10
32
  &__download-title {
11
33
  @extend .ons-u-pt-l;
12
34
  @extend .ons-u-fs-r--b;
@@ -104,6 +126,7 @@
104
126
 
105
127
  &__iframe {
106
128
  width: 100%;
129
+ aspect-ratio: 16 / 9; // Default aspect ratio
107
130
 
108
131
  @media (scripting: none) {
109
132
  // Approximately matches the aspect ratio of the fallback image inside the iframe
@@ -118,6 +141,8 @@
118
141
  }
119
142
  }
120
143
 
144
+ @include iframe-aspect-ratio('ons-chart__iframe--{x}');
145
+
121
146
  // This is a workaround to position the axis title to the left
122
147
  .highcharts-axis-title {
123
148
  width: 100%;
@@ -170,6 +195,69 @@
170
195
  border-left: 1px solid var(--ons-color-grey-100);
171
196
  }
172
197
 
198
+ @media (forced-colors: active) {
199
+ .ons-chart__boxplot-legend-item--uncertainty,
200
+ .highcharts-boxplot-box {
201
+ background-color: SelectedItem;
202
+ fill: SelectedItem;
203
+ }
204
+
205
+ .ons-chart__boxplot-legend-item--estimate,
206
+ .highcharts-boxplot-median {
207
+ background-color: WindowText;
208
+ stroke: WindowText;
209
+ }
210
+ .highcharts-color-0,
211
+ .highcharts-color-0 .highcharts-area,
212
+ .highcharts-legend-item.highcharts-color-0 rect {
213
+ fill: #007faa;
214
+ }
215
+ .highcharts-color-1,
216
+ .highcharts-color-1 .highcharts-area,
217
+ .highcharts-legend-item.highcharts-color-1 rect {
218
+ fill: #a6f0ff;
219
+ }
220
+ .highcharts-color-2,
221
+ .highcharts-color-2 .highcharts-area,
222
+ .highcharts-legend-item.highcharts-color-2 rect {
223
+ fill: #70d49e;
224
+ }
225
+ .highcharts-color-3,
226
+ .highcharts-color-3 .highcharts-area,
227
+ .highcharts-legend-item.highcharts-color-3 rect {
228
+ fill: #e898a5;
229
+ }
230
+ .highcharts-color-4,
231
+ .highcharts-color-4 .highcharts-area,
232
+ .highcharts-legend-item.highcharts-color-4 rect {
233
+ fill: #dadfe1;
234
+ }
235
+ .highcharts-color-5,
236
+ .highcharts-color-5 .highcharts-area,
237
+ .highcharts-legend-item.highcharts-color-5 rect {
238
+ fill: #f9db72;
239
+ }
240
+ .highcharts-color-6,
241
+ .highcharts-color-6 .highcharts-area,
242
+ .highcharts-legend-item.highcharts-color-6 rect {
243
+ fill: #f45b5b;
244
+ }
245
+ .highcharts-color-7,
246
+ .highcharts-color-7 .highcharts-area,
247
+ .highcharts-legend-item.highcharts-color-7 rect {
248
+ fill: #1e824c;
249
+ }
250
+ .highcharts-color-8,
251
+ .highcharts-color-8 .highcharts-area,
252
+ .highcharts-legend-item.highcharts-color-8 rect {
253
+ fill: #e7934c;
254
+ }
255
+ .highcharts-color-9,
256
+ .highcharts-color-9 .highcharts-area,
257
+ .highcharts-legend-item.highcharts-color-9 rect {
258
+ fill: #a0618b;
259
+ }
260
+ }
173
261
  // Allow last label to overflow
174
262
  .highcharts-container {
175
263
  overflow: visible !important;
@@ -7,6 +7,7 @@
7
7
  {% set supportedChartTypesWithScatter = ['columnrange'] %}
8
8
  {% set supportedChartTypesWithXAxisMinAndMax = ['scatter'] %}
9
9
  {% set supportedChartTypesWithYAxisMinAndMax = ['line', 'bar', 'column', 'scatter', 'area', 'columnrange', 'boxplot'] %}
10
+ {% set supportedAspectRatios = ['16-9', '4-3', '21-9', '1-1', '3-2', '9-16'] %}
10
11
  {% set headingLevel = params.headingLevel | default(2) %}
11
12
  {% set openingTitleTag = "<h" ~ headingLevel %}
12
13
  {% set closingTitleTag = "</h" ~ headingLevel ~ ">" %}
@@ -15,6 +16,10 @@
15
16
  {% set openingDownloadTitleTag = "<h" ~ (headingLevel + 2) %}
16
17
  {% set closingDownloadTitleTag = "</h" ~ (headingLevel + 2) ~ ">" %}
17
18
  {% set audioDescriptionId = "chart-audio-description-" ~ params.id %}
19
+ {% set instructionsId = "chart-instructions-" ~ params.id %}
20
+ {% set iframeAspectRatio = params.iframeAspectRatio if params.iframeAspectRatio in supportedAspectRatios else '16-9' %}
21
+ {% set instructions = params.instructions | default('Use the Tab key to move focus into the chart. Once inside, use the arrow keys to navigate between data points. As you move, tooltips will be announced to describe each point. Touch device users, explore by touch or with swipe gestures.') %}
22
+
18
23
  <div
19
24
  {% if not params.iframeUrl %}
20
25
  data-highcharts-base-chart data-highcharts-type="{{ params.chartType }}" data-highcharts-theme="{{ params.theme }}"
@@ -60,12 +65,16 @@
60
65
 
61
66
  {% if params.iframeUrl %}
62
67
  <div
63
- class="ons-chart__iframe-wrapper{% if params.fallbackImageUrl %} ons-chart__non-js-hide{% endif %}"
68
+ class="ons-chart__iframe-wrapper{{ ' ons-chart__non-js-hide' if params.fallbackImageUrl else '' }}"
64
69
  id="{{ params.id }}"
65
- data-url="{{ params.iframeUrl }}"
66
- data-title="{{ params.title }}"
67
70
  >
68
- <iframe src="{{ params.iframeUrl }}" title="{{ params.title }}" class="ons-chart__iframe"></iframe>
71
+ <iframe
72
+ src="{{ params.iframeUrl }}"
73
+ title="{{ params.title }}"
74
+ class="ons-chart__iframe ons-chart__iframe--{{ iframeAspectRatio }}"
75
+ frameborder="0"
76
+ scrolling="no"
77
+ ></iframe>
69
78
  </div>
70
79
  {% else %}
71
80
  {% if params.chartType == 'boxplot' and (params.estimateLineLabel or params.uncertaintyRangeLabel) and params.legend == true %}
@@ -85,7 +94,17 @@
85
94
  </div>
86
95
  {% endif %}
87
96
  {% if params.chartType in supportedChartTypes %}
88
- <div data-highcharts-chart class="ons-chart__chart"></div>
97
+ <div
98
+ data-highcharts-chart-container
99
+ class="ons-chart__container"
100
+ tabindex="0"
101
+ role="region"
102
+ aria-label="chart container"
103
+ aria-describedby="{{ instructionsId }}"
104
+ >
105
+ <div id="{{ instructionsId }}" class="ons-u-vh">{{ instructions }}</div>
106
+ <div data-highcharts-chart class="ons-chart__chart"></div>
107
+ </div>
89
108
  {% else %}
90
109
  <p data-invalid-chart-type data-unsupported-chart-text>
91
110
  <b>{{ '"' + params.chartType + '" - ' + (params.unsupportedChartText or 'chart type is not supported') }}</b>
@@ -237,7 +256,7 @@
237
256
  }
238
257
  %}
239
258
 
240
- <!-- Set scripts to pass the config values as json to the javascript -->
259
+ <!-- Set scripts to pass the config values as json to the JavaScript -->
241
260
  <!-- prettier-ignore-start -->
242
261
  <script type="application/json" data-highcharts-config--{{ params.id }}>
243
262
  {{ config | tojson }}