@ons/design-system 54.0.0 → 55.1.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 (69) hide show
  1. package/components/autosuggest/_autosuggest.scss +4 -4
  2. package/components/autosuggest/autosuggest.spec.js +12 -2
  3. package/components/autosuggest/autosuggest.ui.js +4 -7
  4. package/components/browser-banner/_macro.njk +1 -1
  5. package/components/browser-banner/_macro.spec.js +31 -0
  6. package/components/button/_button.scss +28 -7
  7. package/components/button/_macro.njk +1 -1
  8. package/components/button/_macro.spec.js +2 -2
  9. package/components/checkboxes/_checkbox.scss +50 -17
  10. package/components/collapsible/_collapsible.scss +2 -1
  11. package/components/document-list/document-list.scss +2 -0
  12. package/components/download-resources/download-resources.js +19 -0
  13. package/components/download-resources/download-resources.spec.js +95 -0
  14. package/components/external-link/_macro.njk +1 -1
  15. package/components/external-link/_macro.spec.js +2 -2
  16. package/components/fieldset/_fieldset.scss +11 -1
  17. package/components/fieldset/_macro.njk +9 -8
  18. package/components/fieldset/_macro.spec.js +27 -5
  19. package/components/footer/_footer.scss +1 -0
  20. package/components/footer/_macro.njk +1 -1
  21. package/components/footer/_macro.spec.js +18 -0
  22. package/components/header/_header.scss +7 -2
  23. package/components/header/_macro.njk +34 -8
  24. package/components/header/_macro.spec.js +82 -14
  25. package/components/hero/_macro.njk +1 -1
  26. package/components/hero/_macro.spec.js +1 -1
  27. package/components/icons/_macro.njk +1 -1
  28. package/components/input/_input-type.scss +37 -3
  29. package/components/input/_input.scss +28 -9
  30. package/components/input/_macro.njk +15 -17
  31. package/components/label/_label.scss +1 -1
  32. package/components/label/_macro.njk +27 -15
  33. package/components/label/_macro.spec.js +31 -0
  34. package/components/lists/_macro.njk +1 -1
  35. package/components/lists/_macro.spec.js +2 -2
  36. package/components/message/_message.scss +1 -0
  37. package/components/modal/_macro.njk +2 -2
  38. package/components/modal/_modal.scss +10 -9
  39. package/components/navigation/_macro.njk +1 -2
  40. package/components/navigation/_macro.spec.js +0 -1
  41. package/components/pagination/_pagination.scss +1 -0
  42. package/components/panel/_macro.njk +6 -9
  43. package/components/panel/_macro.spec.js +23 -20
  44. package/components/panel/_panel.scss +13 -5
  45. package/components/phase-banner/_macro.njk +1 -1
  46. package/components/phase-banner/_macro.spec.js +31 -0
  47. package/components/phase-banner/_phase-banner.scss +1 -0
  48. package/components/radios/_radio.scss +16 -4
  49. package/components/relationships/_relationships.scss +2 -2
  50. package/components/reply/_macro.njk +2 -2
  51. package/components/skip-to-content/_skip.scss +2 -1
  52. package/components/table/_macro.njk +3 -2
  53. package/components/table/_macro.spec.js +0 -27
  54. package/components/table/_table.scss +15 -7
  55. package/components/table/sortable-table.js +1 -0
  56. package/components/tabs/_tabs.scss +57 -34
  57. package/components/tabs/tabs.js +4 -2
  58. package/components/upload/_upload.scss +2 -2
  59. package/css/census.css +1 -1
  60. package/css/ids.css +1 -1
  61. package/css/main.css +1 -1
  62. package/layout/_template.njk +25 -12
  63. package/package.json +1 -1
  64. package/scripts/main.es5.js +1 -1
  65. package/scripts/main.js +1 -1
  66. package/scss/base/_global.scss +1 -0
  67. package/scss/overrides/hcm.scss +205 -46
  68. package/scss/patternlib.scss +1 -56
  69. package/scss/vars/_colors.scss +2 -1
@@ -34,6 +34,7 @@ hr {
34
34
  box-shadow: 0 -2px $color-focus, 0 4px $color-text-link-focus;
35
35
  color: $color-text-link-focus;
36
36
  outline: 3px solid transparent;
37
+ outline-offset: 1px;
37
38
  text-decoration: none;
38
39
  }
39
40
 
@@ -2,80 +2,239 @@
2
2
  @media screen and (-ms-high-contrast: active), (forced-colors: active) {
3
3
  // Brightness makes all images black, except transparent parts, which remain transparent
4
4
  // Then, invert(1) makes the black parts white
5
- .ons-header__logo,
6
5
  .ons-footer__ogl-img,
7
6
  .ons-quote .ons-svg-icon,
8
- .ons-collapsible__icon .ons-svg-icon,
9
7
  .ons-footer img {
10
8
  filter: brightness(0) invert(1);
11
9
  }
12
10
 
13
- // IE11 fallback
14
- .ons-collapsible__icon .ons-svg-icon,
15
- .ons-breadcrumb__item .ons-svg-icon,
16
- .ons-panel .ons-svg-icon,
17
- .ons-list--icons .ons-svg-icon {
18
- fill: currentColor;
11
+ // Panels – add border to replace backgrounds
12
+ .ons-panel {
13
+ border-color: currentColor;
14
+ border-left-width: 8px !important;
19
15
  }
20
16
 
21
- // Matches icon with the link colour
22
- .ons-external-link {
23
- svg {
17
+ // Adds some style adjustments to the focused item to make it obvious something is selected
18
+ .ons-autosuggest-input {
19
+ &__results {
20
+ border: 1px solid Highlight !important;
21
+ }
22
+
23
+ .ons-autosuggest-input__option {
24
+ &:focus,
25
+ &:hover,
26
+ &:hover .ons-autosuggest-input__category,
27
+ &--focused,
28
+ &--focused .ons-autosuggest-input__category {
29
+ background: Highlight !important;
30
+ color: HighlightText !important;
31
+ forced-color-adjust: none;
32
+ }
33
+ }
34
+ }
35
+
36
+ // Select - Overrides custom background image icon
37
+ .ons-input--select {
38
+ background: $color-input-bg
39
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='ons-svg-icon' viewBox='0 0 12 8'%3E%3Cpath fill='%23fff' d='M1.5.3 6 5.4 10.5.3c.2-.2.4-.2.6 0l.7.7c.1.2.1.4 0 .5L6.3 7.7c-.2.2-.4.2-.6 0L.2 1.6C.1 1.4.1 1.2.2 1L.9.3c.2-.1.4-.1.6 0z'/%3E%3C/svg%3E")
40
+ no-repeat center right 10px;
41
+ background-size: 1rem;
42
+ }
43
+
44
+ // I would have approached the mark differently, but without changing the existing approach this fixes it
45
+ .ons-timeline__item::before {
46
+ border: 2px solid currentColor;
47
+ }
48
+
49
+ // Element icons – matches icon with the link colour
50
+ .ons-collapsible,
51
+ .ons-breadcrumb__item,
52
+ .ons-panel,
53
+ .ons-btn__inner,
54
+ .ons-external-link,
55
+ .ons-list--icons {
56
+ & .ons-svg-icon {
24
57
  fill: currentColor !important;
58
+ forced-color-adjust: auto;
25
59
  }
26
60
  }
27
61
 
28
- // Adds a border to container error warning panel
29
- .ons-panel--error {
30
- border: 1px solid currentColor;
62
+ // Logos
63
+ .ons-header__org-logo,
64
+ .ons-header__title-logo,
65
+ .ons-footer {
66
+ & .ons-svg-logo {
67
+ fill: currentColor !important;
68
+ forced-color-adjust: auto;
69
+ }
70
+ }
71
+
72
+ // Hero pre title
73
+ .ons-hero__pre-title {
74
+ filter: brightness(0) invert(1);
75
+ }
76
+
77
+ // Buttons - Overrides adjustment to make button shadow selectable
78
+ .ons-btn {
79
+ &::after {
80
+ bottom: 0 !important;
81
+ }
82
+ }
83
+
84
+ .ons-input,
85
+ .ons-btn .ons-btn__inner,
86
+ .ons-tab--row {
87
+ &:focus,
88
+ &:focus-visible {
89
+ // Focus states – To better match the focus states of native controls
90
+ outline-color: Highlight;
91
+ }
92
+ }
93
+
94
+ // Tabs – prevent tab border colour change
95
+ .ons-tabs__list--row::after {
96
+ bottom: 1px;
97
+ forced-color-adjust: none;
98
+ }
99
+
100
+ .ons-tab--row[aria-selected='true'] {
101
+ border-color: ButtonText !important;
102
+ color: ButtonText;
103
+ }
104
+
105
+ // Navigation and section nav – item border
106
+ .ons-section-nav:not(.ons-section-nav--vertical) .ons-section-nav__item,
107
+ .ons-navigation__item {
108
+ border-color: canvas;
109
+ }
110
+
111
+ .ons-section-nav:not(.ons-section-nav--vertical) .ons-section-nav__item--active,
112
+ .ons-navigation__item--active {
113
+ border-color: ButtonText !important;
114
+ color: ButtonText;
115
+ }
116
+
117
+ // Add borders to separate banners with no backgrounds
118
+ .ons-skip-link,
119
+ .ons-browser-banner,
120
+ .ons-cookies-banner,
121
+ .ons-header,
122
+ .ons-header__top,
123
+ .ons-hero,
124
+ .ons-phase-banner {
125
+ border-bottom: 1px solid currentColor;
126
+ }
127
+
128
+ .ons-footer {
129
+ border-top: 1px solid currentColor;
130
+ }
31
131
 
32
- .ons-panel__header {
132
+ @include mq(m) {
133
+ .ons-header__main {
33
134
  border-bottom: 1px solid currentColor;
34
135
  }
35
136
  }
36
137
 
37
- // Adds some style adjustments to the focused item to make it obvious something is selected
38
- .ons-js-autosuggest .ons-autosuggest-input__option--focused {
39
- padding-left: 1.5rem;
40
- text-decoration: underline;
138
+ .ons-navigation--sub {
139
+ border-top: 1px solid currentColor;
41
140
  }
42
141
 
43
- .ons-radio__input:checked + .ons-radio__label {
44
- position: relative;
142
+ // Search – override focus state background image
143
+ .ons-input-search--icon:focus,
144
+ .ons-input-search--icon:active,
145
+ .ons-input-search--icon:valid:not(:placeholder-shown) {
146
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='%23ffffff'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath d='M11.86 10.23 8.62 6.99a4.63 4.63 0 1 0-6.34 1.64 4.55 4.55 0 0 0 2.36.64 4.65 4.65 0 0 0 2.33-.65l3.24 3.23a.46.46 0 0 0 .65 0l1-1a.48.48 0 0 0 0-.62Zm-5-3.32a3.28 3.28 0 0 1-2.31.93 3.22 3.22 0 1 1 2.35-.93Z'/%3E%3C/svg%3E");
147
+ }
45
148
 
46
- // These off pixels are not nice, but due to the way the form controls have been built I have had no choice
47
- // I would strongly revisit doing the checkboxes and radios again and fix these non-whole pixel values
48
- &::after {
49
- border: 6px solid currentColor;
50
- border-radius: 50%;
51
- content: '';
52
- height: 12.5px;
53
- left: 16px;
54
- position: absolute;
55
- top: 18.5px;
56
- width: 12.5px;
57
- z-index: 1;
149
+ // Pagination current page state
150
+ .ons-pagination {
151
+ &__item--current &__link {
152
+ color: ButtonText;
153
+ outline-color: ButtonText !important;
58
154
  }
59
155
  }
60
156
 
61
- // Had to do this without messing with the existing SVG
62
- .ons-input--select {
63
- background-image: url('data:image/svg+xml;base64,PHN2ZyBpZD0iY2hldnJvbi1kb3duIiBjbGFzcz0ic3ZnLWljb24iIHZpZXdCb3g9IjAgMCAxMiA4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogICAgPHBhdGggZmlsbD0iY3VycmVudENvbG9yIiBkPSJNMS4yIDBMNiA1LjQgMTAuOCAwIDEyIDEuMyA2IDggMCAxLjN6Ii8+Cjwvc3ZnPgo=');
64
- background-size: 12px 8px;
157
+ // Radios and Checkboxes – disabled and checked
158
+ .ons-checkbox__input {
159
+ border-color: canvastext;
160
+
161
+ &:disabled {
162
+ border-color: grayText;
163
+ }
164
+ &:disabled:checked::after {
165
+ border-color: grayText;
166
+ }
167
+ &:disabled + .ons-checkbox__label,
168
+ &:disabled:checked + .ons-checkbox__label {
169
+ color: grayText;
170
+
171
+ &::before {
172
+ border-color: grayText;
173
+ outline-color: grayText;
174
+ }
175
+ }
176
+
177
+ &:checked:not(:disabled):not(:visited),
178
+ &:checked:not(:disabled):not(:visited)::after {
179
+ border-color: Highlight;
180
+ }
181
+
182
+ &:checked + .ons-checkbox__label {
183
+ &::before {
184
+ border-color: Highlight;
185
+ outline-color: Highlight;
186
+ }
187
+ }
65
188
  }
66
189
 
67
- // I would have approached the mark differently, but without changing the existing approach this fixes it
68
- .ons-timeline__item::before {
69
- border: 2px solid currentColor;
190
+ // Colour swatch prevent colour adjustment
191
+ .ons-patternlib-swatch__color {
192
+ forced-color-adjust: none;
70
193
  }
71
194
 
72
- // Buttons
73
- .ons-btn__inner .ons-svg-icon {
74
- fill: currentColor !important;
195
+ // Highlighting
196
+ h1 em,
197
+ .ons-highlight {
198
+ background-color: mark;
199
+ color: marktext;
75
200
  }
76
201
 
77
- // Hero pre title
78
- .ons-hero__pre-title {
79
- filter: brightness(0) invert(1);
202
+ // Errors
203
+ .ons-panel--error {
204
+ border-color: mark;
205
+ outline-color: mark;
206
+
207
+ & .ons-panel__header {
208
+ border-bottom: 1px solid mark;
209
+ }
210
+ }
211
+
212
+ .ons-input {
213
+ &--error:not(:focus) {
214
+ border-color: mark;
215
+ outline-color: mark;
216
+
217
+ & + .ons-input-type__type,
218
+ & + .ons-input-type__type[title] {
219
+ border-color: mark;
220
+ }
221
+
222
+ & + .ons-input-type__type::after {
223
+ outline-color: mark;
224
+ }
225
+ }
226
+ }
227
+
228
+ // Feedback – Remove speech bubble border because hcm doesn't support transparent borders
229
+ .ons-feedback::before,
230
+ .ons-feedback::after {
231
+ content: none;
232
+ }
233
+
234
+ // Message – indicate sent vs received
235
+ .ons-message {
236
+ &--sent {
237
+ outline-color: mark;
238
+ }
80
239
  }
81
240
  }
@@ -86,62 +86,6 @@
86
86
  }
87
87
  }
88
88
 
89
- .ons-table-scrollable {
90
- position: relative;
91
- ::-webkit-scrollbar {
92
- height: 7px;
93
- }
94
- ::-webkit-scrollbar-thumb {
95
- background: $color-grey-75;
96
- border-radius: 20px;
97
- }
98
- &--on {
99
- th,
100
- td {
101
- white-space: nowrap;
102
- }
103
- }
104
- &__content {
105
- overflow: visible;
106
- overflow-x: scroll;
107
- width: 100%;
108
- &:focus {
109
- outline: 3px solid $color-focus;
110
- outline-offset: 3px;
111
- }
112
- th,
113
- td {
114
- @include mq(xxs, m) {
115
- white-space: nowrap;
116
- }
117
- }
118
- .ons-table__right-shadow,
119
- .ons-table__left-shadow {
120
- height: 100%;
121
- position: absolute;
122
- top: 0;
123
- width: 5px;
124
- z-index: 200;
125
-
126
- &.ons-with-transition {
127
- transition: box-shadow 0.4s ease-out;
128
- }
129
- }
130
- .ons-table__right-shadow {
131
- right: 0;
132
- &.ons-visible {
133
- box-shadow: inset -1px 0 0 0 #bfc1c3, inset -5px 0 0 0 rgba(191, 193, 195, 0.4);
134
- }
135
- }
136
- .ons-table__left-shadow {
137
- left: 0;
138
- &.ons-visible {
139
- box-shadow: inset 1px 0 0 0 #bfc1c3, inset -5px 0 0 0 rgba(191, 193, 195, 0.4);
140
- }
141
- }
142
- }
143
- }
144
-
145
89
  &__content,
146
90
  &__sub-nav {
147
91
  > {
@@ -210,6 +154,7 @@
210
154
  font-weight: 700;
211
155
  letter-spacing: 0.1rem;
212
156
  margin-right: 0.5rem;
157
+ outline: 2px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
213
158
  padding: 0.3rem 0.5rem;
214
159
  text-transform: uppercase;
215
160
  }
@@ -92,7 +92,8 @@ $color-placeholder: $color-grey-15 !default;
92
92
  // Form elements
93
93
  $color-button: $color-leaf-green !default;
94
94
  $color-button-secondary: $color-grey-15 !default;
95
- $color-input: $color-black !default;
95
+ $color-input-border: $color-black !default;
96
+ $color-input-bg: $color-white !default;
96
97
 
97
98
  // Panels and status
98
99
  $color-info: $color-ocean-blue !default;