@ons/design-system 70.0.9 → 70.0.11

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 (40) hide show
  1. package/components/address-output/example-address-output.njk +11 -0
  2. package/components/document-list/{document-list.scss → _document-list.scss} +4 -4
  3. package/components/header/_macro.spec.js +513 -721
  4. package/components/header/_test_examples.js +157 -0
  5. package/components/label/_label.scss +1 -1
  6. package/components/list/_list.scss +14 -11
  7. package/components/list/_macro.njk +3 -3
  8. package/components/list/_macro.spec.js +3 -6
  9. package/components/list/example-bare-list.njk +21 -0
  10. package/components/list/example-bulleted-list.njk +17 -0
  11. package/components/list/example-dashed-list.njk +20 -0
  12. package/components/list/example-inline-list-with-social-icon-prefix.njk +42 -0
  13. package/components/list/example-inline-list.njk +20 -0
  14. package/components/list/example-list-with-icon-prefix.njk +18 -0
  15. package/components/list/example-list-with-icon-suffix.njk +18 -0
  16. package/components/list/example-nested-list.njk +39 -0
  17. package/components/list/example-numbered-list.njk +17 -0
  18. package/components/list/example-prefixed-list.njk +19 -0
  19. package/components/list/example-suffixed-list.njk +19 -0
  20. package/components/list/example-summary-list.njk +17 -0
  21. package/components/navigation/_macro.njk +1 -1
  22. package/components/navigation/_macro.spec.js +1 -1
  23. package/components/quote/example-quote.njk +7 -0
  24. package/components/related-content/example-related-content-social-media.njk +0 -1
  25. package/components/section-navigation/_macro.njk +1 -1
  26. package/components/section-navigation/example-section-navigation-single-vertical-with-title.njk +23 -0
  27. package/components/summary/_macro.njk +1 -1
  28. package/components/text-indent/example-text-indent.njk +6 -0
  29. package/css/main.css +1 -1
  30. package/img/large/placeholder-card.png +0 -0
  31. package/img/small/placeholder-card.png +0 -0
  32. package/layout/_dsTemplate.njk +1 -1
  33. package/package.json +1 -1
  34. package/scss/main.scss +1 -1
  35. package/scss/utilities/_index.scss +1 -1
  36. package/scss/utilities/{_pad.scss → _padding.scss} +6 -6
  37. package/scss/vars/_colors.scss +1 -2
  38. package/components/back-link/example-back-link.njk +0 -17
  39. package/components/helpers/_grid.scss +0 -6
  40. package/components/helpers/grid.njk +0 -20
@@ -0,0 +1,157 @@
1
+ export {
2
+ EXAMPLE_HEADER_BASIC,
3
+ EXAMPLE_SERVICE_LINKS_CONFIG,
4
+ EXAMPLE_HEADER_SERVICE_LINKS_MULTIPLE,
5
+ EXAMPLE_HEADER_SERVICE_LINKS_SINGLE,
6
+ EXAMPLE_HEADER_LANGUAGE_CONFIG,
7
+ EXAMPLE_HEADER_NAVIGATION_WITH_SUBNAVIGATION_CONFIG,
8
+ EXAMPLE_HEADER_NAVIGATION_WITH_SITESEARCHAUTOSUGGEST,
9
+ };
10
+
11
+ const EXAMPLE_HEADER_BASIC = {
12
+ title: 'Header title',
13
+ };
14
+ const EXAMPLE_SERVICE_LINKS_CONFIG = {
15
+ id: 'service-links',
16
+ ariaLabel: 'Services menu',
17
+ classes: 'custom-class',
18
+ toggleServicesButton: {
19
+ text: 'Menu',
20
+ ariaLabel: 'Toggle services menu',
21
+ },
22
+ };
23
+ const EXAMPLE_HEADER_SERVICE_LINKS_MULTIPLE = {
24
+ ...EXAMPLE_HEADER_BASIC,
25
+ serviceLinks: {
26
+ ...EXAMPLE_SERVICE_LINKS_CONFIG,
27
+ itemsList: [
28
+ {
29
+ title: 'Title 1',
30
+ url: '#1',
31
+ },
32
+ {
33
+ title: 'Title 2',
34
+ url: '#2',
35
+ },
36
+ {
37
+ title: 'Title 3',
38
+ url: '#3',
39
+ },
40
+ ],
41
+ },
42
+ };
43
+ const EXAMPLE_HEADER_SERVICE_LINKS_SINGLE = {
44
+ ...EXAMPLE_HEADER_BASIC,
45
+ serviceLinks: {
46
+ ...EXAMPLE_SERVICE_LINKS_CONFIG,
47
+ itemsList: [
48
+ {
49
+ title: 'Title',
50
+ url: '#0',
51
+ },
52
+ ],
53
+ },
54
+ };
55
+ const EXAMPLE_HEADER_LANGUAGE_CONFIG = {
56
+ language: {
57
+ languages: [
58
+ {
59
+ url: '#0',
60
+ ISOCode: 'en',
61
+ text: 'English',
62
+ buttonAriaLabel: 'Language selector. Current language: English',
63
+ chooseLanguage: 'Choose language',
64
+ current: true,
65
+ },
66
+ {
67
+ url: '#0',
68
+ ISOCode: 'cy',
69
+ text: 'Cymraeg',
70
+ buttonAriaLabel: 'Dewisydd iaith. Iaith gyfredol: Cymraeg',
71
+ chooseLanguage: 'Dewiswch iaith',
72
+ current: false,
73
+ },
74
+ ],
75
+ },
76
+ };
77
+ const EXAMPLE_HEADER_NAVIGATION_WITH_SUBNAVIGATION_CONFIG = {
78
+ navigation: {
79
+ id: 'main-nav',
80
+ ariaLabel: 'Main menu',
81
+ currentPath: '#1',
82
+ currentPageTitle: 'Guidance',
83
+ itemsList: [
84
+ {
85
+ title: 'Home',
86
+ url: '#0',
87
+ },
88
+ {
89
+ title: 'Guidance',
90
+ url: '#1',
91
+ },
92
+ ],
93
+ toggleNavigationButton: {
94
+ text: 'Menu',
95
+ ariaLabel: 'Toggle main menu',
96
+ },
97
+ subNavigation: {
98
+ id: 'sub-nav',
99
+ overviewURL: '#overview',
100
+ overviewText: 'Overview',
101
+ ariaLabel: 'Section menu',
102
+ currentPath: '#1',
103
+ itemsList: [
104
+ {
105
+ title: 'Sub nav item 1',
106
+ url: '#0',
107
+ classes: 'custom-class-sub-item-1',
108
+ id: 'sub-item-1',
109
+ },
110
+ {
111
+ title: 'Sub nav item 2',
112
+ url: '#1',
113
+ classes: 'custom-class-sub-item-2',
114
+ id: 'sub-item-2',
115
+ },
116
+ ],
117
+ },
118
+ },
119
+ };
120
+ const EXAMPLE_HEADER_NAVIGATION_WITH_SITESEARCHAUTOSUGGEST = {
121
+ navigation: {
122
+ id: 'main-nav',
123
+ ariaLabel: 'Main menu',
124
+ currentPath: '#home',
125
+ itemsList: [
126
+ {
127
+ title: 'Home',
128
+ url: '#home',
129
+ },
130
+ {
131
+ title: 'Guidance',
132
+ url: '#0',
133
+ },
134
+ ],
135
+ toggleNavigationButton: {
136
+ text: 'Menu',
137
+ ariaLabel: 'Toggle main menu',
138
+ },
139
+ },
140
+ siteSearchAutosuggest: {
141
+ label: 'label',
142
+ instructions: 'Use up and down keys to navigate.',
143
+ ariaYouHaveSelected: 'You have selected',
144
+ ariaMinChars: 'Enter 3 or more characters for suggestions.',
145
+ minChars: 3,
146
+ ariaResultsLabel: 'Country suggestions',
147
+ ariaOneResult: 'There is one suggestion available.',
148
+ ariaNResults: 'There are {n} suggestions available.',
149
+ ariaLimitedResults: 'Type more characters to improve your search',
150
+ moreResults: 'Continue entering to improve suggestions',
151
+ resultsTitle: 'Suggestions',
152
+ resultsTitleId: 'country-of-birth-suggestions',
153
+ noResults: 'No suggestions found.',
154
+ typeMore: 'Continue entering to get suggestions',
155
+ language: 'en-gb',
156
+ },
157
+ };
@@ -19,7 +19,7 @@
19
19
  &--placeholder {
20
20
  font-size: 1rem;
21
21
  font-weight: $font-weight-regular;
22
- color: var(--ons-color-text-placeholder);
22
+ color: var(--ons-color-placeholder);
23
23
  left: 10px;
24
24
  position: absolute;
25
25
  top: 6px;
@@ -54,23 +54,26 @@
54
54
  margin-left: 0.5rem;
55
55
  }
56
56
 
57
- &__prefix,
58
- &__suffix {
59
- font-family: $font-mono;
60
- }
61
-
62
- &--prefix &,
63
- &--suffix &,
64
57
  &--icons & {
65
58
  &__item {
66
- align-items: flex-start;
67
- display: flex;
59
+ margin-top: 0;
68
60
  }
69
61
  }
70
62
 
71
- &--social & {
72
- &__item {
63
+ &__prefix,
64
+ &__suffix {
65
+ font-family: $font-mono;
66
+ }
67
+
68
+ &--prefix,
69
+ &--suffix,
70
+ &--icons {
71
+ margin-bottom: 0;
72
+ @extend .ons-list--bare;
73
+ .ons-list__item {
74
+ margin-bottom: 0.5rem;
73
75
  align-items: center;
76
+ display: flex;
74
77
  }
75
78
  }
76
79
 
@@ -3,11 +3,11 @@
3
3
  {% set listLength = params.itemsList | length %}
4
4
 
5
5
  {% if params.itemsList[0].prefix %}
6
- {% set otherClasses = 'ons-list--bare ons-list--prefix' %}
6
+ {% set otherClasses = 'ons-list--prefix' %}
7
7
  {% elif params.itemsList[0].suffix %}
8
- {% set otherClasses = 'ons-list--bare ons-list--suffix' %}
8
+ {% set otherClasses = 'ons-list--suffix' %}
9
9
  {% elif params.iconPosition %}
10
- {% set otherClasses = 'ons-list--bare ons-list--icons' %}
10
+ {% set otherClasses = 'ons-list--icons' %}
11
11
  {% set iconType = params.iconType if params.iconType %}
12
12
  {% else %}
13
13
  {% set otherClasses = '' %}
@@ -77,29 +77,27 @@ describe('macro: list', () => {
77
77
  expect($('.ons-list').hasClass('ons-list--inline')).toBe(true);
78
78
  });
79
79
 
80
- it('assumes the "bare" variant with a prefix modifier class when the first list item has a prefix', () => {
80
+ it('assumes a prefix modifier class when the first list item has a prefix', () => {
81
81
  const $ = cheerio.load(
82
82
  renderComponent('list', {
83
83
  itemsList: [{ text: 'Item text', prefix: 'Abc' }],
84
84
  }),
85
85
  );
86
86
 
87
- expect($('.ons-list').hasClass('ons-list--bare')).toBe(true);
88
87
  expect($('.ons-list').hasClass('ons-list--prefix')).toBe(true);
89
88
  });
90
89
 
91
- it('assumes the "bare" variant with a suffix modifier class when the first list item has a suffix', () => {
90
+ it('assumes a suffix modifier class when the first list item has a suffix', () => {
92
91
  const $ = cheerio.load(
93
92
  renderComponent('list', {
94
93
  itemsList: [{ text: 'Item text', suffix: 'Abc' }],
95
94
  }),
96
95
  );
97
96
 
98
- expect($('.ons-list').hasClass('ons-list--bare')).toBe(true);
99
97
  expect($('.ons-list').hasClass('ons-list--suffix')).toBe(true);
100
98
  });
101
99
 
102
- it('assumes the "bare" variant with a icons modifier class when the first list item has an icon', () => {
100
+ it('assumes a icons modifier class when the first list item has an icon', () => {
103
101
  const $ = cheerio.load(
104
102
  renderComponent('list', {
105
103
  ...EXAMPLE_LIST_TEXT_ITEMS,
@@ -108,7 +106,6 @@ describe('macro: list', () => {
108
106
  }),
109
107
  );
110
108
 
111
- expect($('.ons-list').hasClass('ons-list--bare')).toBe(true);
112
109
  expect($('.ons-list').hasClass('ons-list--icons')).toBe(true);
113
110
  });
114
111
 
@@ -0,0 +1,21 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "variants": 'bare',
5
+ "itemsList": [
6
+ {
7
+ "url": '#0',
8
+ "text": 'Who we are'
9
+ },
10
+ {
11
+ "url": '#0',
12
+ "text": 'What we do'
13
+ },
14
+ {
15
+ "url": 'https://goo.gl/maps/ULnVRd16zfFLZWdt7',
16
+ "text": 'Where to find us',
17
+ "external": true
18
+ }
19
+ ]
20
+ })
21
+ }}
@@ -0,0 +1,17 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ <p>You will need to show <strong>one</strong> of the following forms of ID:</p>
3
+ {{
4
+ onsList({
5
+ "itemsList": [
6
+ {
7
+ "text": 'birth certificate'
8
+ },
9
+ {
10
+ "text": 'national insurance number'
11
+ },
12
+ {
13
+ "text": 'passport'
14
+ }
15
+ ]
16
+ })
17
+ }}
@@ -0,0 +1,20 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "variants": 'dashed',
5
+ "itemsList": [
6
+ {
7
+ "text": 'Overview',
8
+ "current": true
9
+ },
10
+ {
11
+ "url": '#0',
12
+ "text": 'About Census 2021'
13
+ },
14
+ {
15
+ "url": '#0',
16
+ "text": 'Why should I take part in the census?'
17
+ }
18
+ ]
19
+ })
20
+ }}
@@ -0,0 +1,42 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "variants": 'inline',
5
+ "iconPosition": 'before',
6
+ "iconSize": 'xxl',
7
+ "itemsList": [
8
+ {
9
+ "url": '#0',
10
+ "text": 'Twitter',
11
+ "iconType": 'twitter',
12
+ "attributes": {
13
+ "rel": 'noreferrer external'
14
+ }
15
+ },
16
+ {
17
+ "url": '#0',
18
+ "text": 'Facebook',
19
+ "iconType": 'facebook',
20
+ "attributes": {
21
+ "rel": 'noreferrer external'
22
+ }
23
+ },
24
+ {
25
+ "url": '#0',
26
+ "text": 'Instagram',
27
+ "iconType": 'instagram',
28
+ "attributes": {
29
+ "rel": 'noreferrer external'
30
+ }
31
+ },
32
+ {
33
+ "url": '#0',
34
+ "text": 'LinkedIn',
35
+ "iconType": 'linkedin',
36
+ "attributes": {
37
+ "rel": 'noreferrer external'
38
+ }
39
+ }
40
+ ]
41
+ })
42
+ }}
@@ -0,0 +1,20 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "variants": ['bare', 'inline'],
5
+ "itemsList": [
6
+ {
7
+ "text": 'Contact us',
8
+ "url": '#0'
9
+ },
10
+ {
11
+ "text": 'Cookies and privacy',
12
+ "url": '#0'
13
+ },
14
+ {
15
+ "text": 'Terms and conditions',
16
+ "url": '#0'
17
+ }
18
+ ]
19
+ })
20
+ }}
@@ -0,0 +1,18 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "iconPosition": "before",
5
+ "iconType": "check",
6
+ "itemsList": [
7
+ {
8
+ "text": "birth certificate"
9
+ },
10
+ {
11
+ "text": "national insurance number"
12
+ },
13
+ {
14
+ "text": "passport"
15
+ }
16
+ ]
17
+ })
18
+ }}
@@ -0,0 +1,18 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "iconPosition": "after",
5
+ "iconType": "check",
6
+ "itemsList": [
7
+ {
8
+ "text": "birth certificate"
9
+ },
10
+ {
11
+ "text": "national insurance number"
12
+ },
13
+ {
14
+ "text": "passport"
15
+ }
16
+ ]
17
+ })
18
+ }}
@@ -0,0 +1,39 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "variants": 'dashed',
5
+ "itemsList": [
6
+ {
7
+ "url": '#0',
8
+ "text": 'Who we are',
9
+ "itemsList": [
10
+ {
11
+ "url": '#0',
12
+ "text": 'Our Mission'
13
+ },
14
+ {
15
+ "url": '#0',
16
+ "text": 'Core Values',
17
+ "itemsList": [
18
+ {
19
+ "url": '#0',
20
+ "text": 'Integrity'
21
+ },
22
+ {
23
+ "url": '#0',
24
+ "text": 'Excellence'
25
+ }]
26
+ }]
27
+ },
28
+ {
29
+ "url": '#0',
30
+ "text": 'What we do'
31
+ },
32
+ {
33
+ "url": 'https://goo.gl/maps/ULnVRd16zfFLZWdt7',
34
+ "text": 'Where to find us',
35
+ "external": true
36
+ }
37
+ ]
38
+ })
39
+ }}
@@ -0,0 +1,17 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "element": 'ol',
5
+ "itemsList": [
6
+ {
7
+ "text": 'Introduction'
8
+ },
9
+ {
10
+ "text": 'Questionnaire'
11
+ },
12
+ {
13
+ "text": 'Summary'
14
+ }
15
+ ]
16
+ })
17
+ }}
@@ -0,0 +1,19 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "itemsList": [
5
+ {
6
+ "text": 'birth certificate',
7
+ "prefix": 'H1'
8
+ },
9
+ {
10
+ "text": 'national insurance number',
11
+ "prefix": 'H2'
12
+ },
13
+ {
14
+ "text": 'passport',
15
+ "prefix": 'H3'
16
+ }
17
+ ]
18
+ })
19
+ }}
@@ -0,0 +1,19 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "itemsList": [
5
+ {
6
+ "text": 'birth certificate',
7
+ "suffix": 'A'
8
+ },
9
+ {
10
+ "text": 'national insurance number',
11
+ "suffix": 'B'
12
+ },
13
+ {
14
+ "text": 'passport',
15
+ "suffix": 'C'
16
+ }
17
+ ]
18
+ })
19
+ }}
@@ -0,0 +1,17 @@
1
+ {% from "components/list/_macro.njk" import onsList %}
2
+ {{
3
+ onsList({
4
+ "variants": "summary",
5
+ "itemsList": [
6
+ {
7
+ "text": 'birth certificate'
8
+ },
9
+ {
10
+ "text": 'national insurance number'
11
+ },
12
+ {
13
+ "text": 'passport'
14
+ }
15
+ ]
16
+ })
17
+ }}
@@ -8,7 +8,7 @@
8
8
  {% if params.siteSearchAutosuggest %}
9
9
  <div class="ons-navigation-search ons-js-navigation-search">
10
10
  {% set autosuggestClasses = "ons-input-search ons-input-search--icon" %}
11
- {% set autosuggestLabelClasses = "ons-u-pl-m" %}
11
+ {% set autosuggestLabelClasses = "ons-u-pl-l" %}
12
12
  {% if params.variants == "neutral" %}
13
13
  {% set autosuggestClasses = autosuggestClasses + ' ons-input-search--dark' %}
14
14
  {% else %}
@@ -138,7 +138,7 @@ describe('macro: navigation', () => {
138
138
  classes: 'ons-input-search ons-input-search--icon',
139
139
  label: {
140
140
  id: 'ons-site-search-label',
141
- classes: 'ons-u-pl-m ons-label--white',
141
+ classes: 'ons-u-pl-l ons-label--white',
142
142
  },
143
143
  },
144
144
  });
@@ -0,0 +1,7 @@
1
+ {% from "components/quote/_macro.njk" import onsQuote %}
2
+ {{-
3
+ onsQuote({
4
+ "text": 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
5
+ "ref": 'A N Other'
6
+ })
7
+ -}}
@@ -7,7 +7,6 @@
7
7
  {
8
8
  "id": 'follow-us',
9
9
  "title": 'Follow us',
10
- "variants": 'social',
11
10
  "iconPosition": 'before',
12
11
  "iconSize": 'xxl',
13
12
  "itemsList": [
@@ -57,7 +57,7 @@
57
57
  {% if params.title %}
58
58
  {{ openingHeadingTag | replace(headingLevel, sectionTitleHeadingLevel | string) | safe }}
59
59
  class="ons-u-fs-r--b
60
- ons-u-mb-s">{{ params.title }}{{ closingHeadingTag | replace(headingLevel, sectionTitleHeadingLevel | string) }}
60
+ ons-u-mb-s">{{ params.title }}{{ closingHeadingTag | replace(headingLevel, sectionTitleHeadingLevel | string) | safe }}
61
61
  {% endif %}
62
62
  <ul class="ons-section-nav__list">
63
63
  {% for item in params.itemsList %}
@@ -0,0 +1,23 @@
1
+ {% from "components/section-navigation/_macro.njk" import onsSectionNavigation %}
2
+ {{
3
+ onsSectionNavigation({
4
+ "id": "section-menu",
5
+ "variants": "vertical",
6
+ "currentPath": "#section-1",
7
+ "title": "Sections title",
8
+ "itemsList": [
9
+ {
10
+ "title": "Section 1",
11
+ "url": "#section-1"
12
+ },
13
+ {
14
+ "title": "Section 2",
15
+ "url": "#0"
16
+ },
17
+ {
18
+ "title": "Section 3",
19
+ "url": "#0"
20
+ }
21
+ ]
22
+ })
23
+ }}
@@ -135,7 +135,7 @@
135
135
 
136
136
  {% if group.summaryLink %}
137
137
  <div
138
- class="ons-summary__link{{ ' ons-u-pt-s' if group.placeholderText or group.rows }}{{ ' ons-u-bt' if group.placeholderText is not defined and group.rows | length > 1 and params.variant != 'card' }}{{ ' ons-u-mb-xl' if not group.last }}"
138
+ class="ons-summary__link{{ ' ons-u-pt-s' if params.variant != 'card' and (group.placeholderText or group.rows) }}{{ ' ons-u-bt' if group.placeholderText is not defined and group.rows | length > 1 and params.variant != 'card' }}{{ ' ons-u-mb-xl' if not group.last }}"
139
139
  >
140
140
  {% set link %}
141
141
  <a
@@ -0,0 +1,6 @@
1
+ {% from "components/text-indent/_macro.njk" import onsTextIndent %}
2
+ {{-
3
+ onsTextIndent({
4
+ text: '<p>Telephone: 0800 141 2021<br>Monday to Friday, 8 am to 7pm<br>Saturday, 8am to 4pm</p>'
5
+ })
6
+ -}}