@ons/design-system 65.0.0 → 65.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 (61) hide show
  1. package/components/address-input/autosuggest.address.error.js +1 -1
  2. package/components/address-input/autosuggest.address.js +2 -2
  3. package/components/address-input/autosuggest.address.spec.js +5 -5
  4. package/components/autosuggest/_autosuggest.scss +11 -6
  5. package/components/autosuggest/_macro.njk +32 -31
  6. package/components/autosuggest/_macro.spec.js +18 -18
  7. package/components/autosuggest/autosuggest.spec.js +31 -31
  8. package/components/autosuggest/autosuggest.ui.js +8 -9
  9. package/components/card/_card.scss +14 -0
  10. package/components/card/_macro.njk +7 -8
  11. package/components/checkboxes/example-checkboxes-with-revealed-checkboxes-expanded.njk +88 -0
  12. package/components/checkboxes/example-checkboxes-with-revealed-radios-expanded.njk +70 -0
  13. package/components/checkboxes/example-checkboxes-with-revealed-select-expanded.njk +72 -0
  14. package/components/checkboxes/example-checkboxes-with-revealed-text-input-expanded.njk +60 -0
  15. package/components/content-pagination/_content-pagination.scss +1 -1
  16. package/components/document-list/_macro.njk +5 -7
  17. package/components/document-list/_macro.spec.js +2 -2
  18. package/components/document-list/example-document-list-search-result-featured.njk +1 -1
  19. package/components/document-list/example-document-list-search-results.njk +3 -3
  20. package/components/fieldset/_fieldset.scss +1 -1
  21. package/components/header/_macro.njk +4 -4
  22. package/components/header/example-header-external-with-navigation.njk +5 -5
  23. package/components/header/example-header-external-with-service-links.njk +3 -3
  24. package/components/header/example-header-external-with-sub-navigation.njk +10 -10
  25. package/components/header/example-header-internal.njk +2 -2
  26. package/components/header/example-header-neutral-for-multicoloured-logo.njk +6 -6
  27. package/components/list/_list.scss +5 -2
  28. package/components/list/_macro.njk +22 -10
  29. package/components/list/_macro.spec.js +42 -0
  30. package/components/navigation/_macro.njk +6 -6
  31. package/components/navigation/_macro.spec.js +4 -4
  32. package/components/pagination/_macro.njk +17 -2
  33. package/components/pagination/_pagination.scss +14 -0
  34. package/components/question/example-question-interviewer-note.njk +1 -1
  35. package/components/radios/example-radios-with-clear-button-expanded.njk +98 -0
  36. package/components/radios/example-radios-with-revealed-checkboxes-expanded.njk +70 -0
  37. package/components/radios/example-radios-with-revealed-radios-expanded.njk +69 -0
  38. package/components/radios/example-radios-with-revealed-select-expanded.njk +70 -0
  39. package/components/radios/example-radios-with-revealed-text-input-expanded.njk +81 -0
  40. package/components/relationships/_macro.spec.js +9 -11
  41. package/components/relationships/example-relationships-error.njk +28 -28
  42. package/components/relationships/example-relationships-you.njk +29 -29
  43. package/components/relationships/example-relationships.njk +28 -28
  44. package/components/relationships/relationships.spec.js +13 -13
  45. package/components/reply/_macro.njk +5 -2
  46. package/components/reply/_macro.spec.js +7 -1
  47. package/components/section-navigation/_macro.njk +2 -1
  48. package/components/section-navigation/_macro.spec.js +2 -13
  49. package/components/tabs/_macro.njk +5 -5
  50. package/components/tabs/_macro.spec.js +1 -1
  51. package/components/tabs/example-tabs-details.njk +3 -0
  52. package/components/tabs/example-tabs.njk +0 -1
  53. package/components/textarea/example-textarea-error.njk +4 -4
  54. package/css/main.css +2 -2
  55. package/css/print.css +1 -1
  56. package/js/cookies-settings.js +1 -1
  57. package/package.json +19 -21
  58. package/scripts/main.es5.js +1 -1
  59. package/scripts/main.js +1 -1
  60. package/scss/overrides/hcm.scss +4 -4
  61. package/scss/print.scss +1 -1
@@ -20,13 +20,20 @@
20
20
  {% else %}
21
21
  {% set listEl = 'ul' %}
22
22
  {% endif %}
23
- <{{listEl}} {% if params.id %}id="{{ params.id }}"{% endif %} class="ons-list{% if listEl == 'p' %} ons-list--p{% endif %}{% if params.classes %} {{ params.classes -}}{% endif %}{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-list--{{ variant }}{% endfor %}{% else %} ons-list--{{ params.variants }}{% endif %}{% endif %}{% if otherClasses %} {{ otherClasses -}}{% endif %}"{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
24
- {%- for item in params.itemsList -%}
25
- {% if listLength > 1 or listEl == 'ul' %}
23
+ <{{ listEl }} {% if params.id %}id="{{ params.id }}"{% endif %} class="ons-list{% if listEl == 'p' %} ons-list--p{% endif %}{% if params.classes %} {{ params.classes -}}{% endif %}{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-list--{{ variant }}{% endfor %}{% else %} ons-list--{{ params.variants }}{% endif %}{% endif %}{% if otherClasses %} {{ otherClasses -}}{% endif %}"{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
24
+ {%- for item in params.itemsList -%}
25
+ {% set sublistClasses = item.listClasses if item.listClasses else '' %}
26
+ {% set sublistParams = {
27
+ 'variants': variants,
28
+ 'itemsList': item.itemsList,
29
+ 'classes': sublistClasses
30
+ } %}
31
+ {% if listLength > 1 or listEl == 'ul' %}
26
32
  <li class="ons-list__item{% if item.listClasses %} {{ item.listClasses }}{% endif %}"{% if item.current %} aria-current="true"{% endif %}>
27
- {% endif %}
28
- {% set itemText = item.text %}
29
- {% set itemIconType = item.iconType if item.iconType else iconType %}
33
+ {% endif %}
34
+ {% set itemText = item.text %}
35
+ {% if item.text %}
36
+ {% set itemIconType = item.iconType if item.iconType else iconType %} {% endif %}
30
37
 
31
38
  {# For Craft support we also support title and navigation title #}
32
39
  {% if item.navigationTitle %}
@@ -84,9 +91,14 @@
84
91
  }}
85
92
  {%- endif -%} </span>
86
93
  {%- endif -%}
87
- {% if listLength > 1 or listEl == 'ul' %}
88
- </li>
94
+ {% if item.itemsList %}
95
+ {# Handle nested lists with recursive call for sub layer #}
96
+ {{ onsList(sublistParams) }}
89
97
  {% endif %}
90
- {%- endfor -%}
91
- </{{listEl}}>
98
+ {% if listLength > 1 or listEl == 'ul' %}
99
+ </li>
100
+ {% endif %}
101
+ {%- endfor -%}
102
+ </{{ listEl }}>
103
+
92
104
  {% endmacro %}
@@ -21,6 +21,13 @@ const EXAMPLE_ITEM_NAVIGATION_TITLE = {
21
21
  title: 'Long article title',
22
22
  navigationTitle: 'Nav friendly title',
23
23
  };
24
+ const EXAMPLE_NESTED_LIST_TEXT_ITEMS = {
25
+ itemsList: [
26
+ { text: 'First item' },
27
+ { text: 'Second item' },
28
+ { text: 'Third item', itemsList: [{ text: 'First item' }, { text: 'Second item' }] },
29
+ ],
30
+ };
24
31
 
25
32
  describe('macro: list', () => {
26
33
  describe('list element', () => {
@@ -615,4 +622,39 @@ describe('macro: list', () => {
615
622
  expect($('#first + .ons-list__suffix').length).toBe(1);
616
623
  });
617
624
  });
625
+
626
+ describe('nested list element', () => {
627
+ it('has provided variant style class when one variant is provided', () => {
628
+ const $ = cheerio.load(
629
+ renderComponent('list', {
630
+ ...EXAMPLE_NESTED_LIST_TEXT_ITEMS,
631
+ variants: 'dashed',
632
+ }),
633
+ );
634
+
635
+ expect($('.ons-list--dashed').length).toBe(2);
636
+ });
637
+
638
+ it('has provided variant style classes when multiple variants are provided', () => {
639
+ const $ = cheerio.load(
640
+ renderComponent('list', {
641
+ ...EXAMPLE_NESTED_LIST_TEXT_ITEMS,
642
+ variants: ['dashed', 'inline'],
643
+ }),
644
+ );
645
+
646
+ expect($('.ons-list').hasClass('ons-list--dashed')).toBe(true);
647
+ expect($('.ons-list').hasClass('ons-list--inline')).toBe(true);
648
+ });
649
+
650
+ it('has the expected quantity of <li> elements when a <ol> element is specified', () => {
651
+ const $ = cheerio.load(
652
+ renderComponent('list', {
653
+ ...EXAMPLE_NESTED_LIST_TEXT_ITEMS,
654
+ }),
655
+ );
656
+
657
+ expect($('.ons-list li').length).toBe(5);
658
+ });
659
+ });
618
660
  });
@@ -14,7 +14,7 @@
14
14
  {% endif %}
15
15
  {{ onsAutosuggest({
16
16
  "id": "ons-site-search",
17
- "containerClasses": "ons-autosuggest-input--header",
17
+ "containerClasses": "ons-autosuggest--header",
18
18
  "classes": autosuggestClasses,
19
19
  "label": {
20
20
  "text": params.siteSearchAutosuggest.label,
@@ -42,7 +42,7 @@
42
42
  <ul class="ons-navigation__list">
43
43
  {% for item in params.navigation.itemsList %}
44
44
  <li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
45
- <a class="ons-navigation__link" href="{{ item.url }}" {% if item.id %}id="{{ item.id }}" {% endif %}{% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %}>{{ item.title }}</a>
45
+ <a class="ons-navigation__link" href="{{ item.url }}" {% if item.id %}id="{{ item.id }}" {% endif %}{% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %}>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
46
46
  </li>
47
47
  {% endfor %}
48
48
  </ul>
@@ -55,7 +55,7 @@
55
55
  <ul class="ons-navigation__list ons-navigation__list">
56
56
  {% for item in params.navigation.subNavigation.itemsList %}
57
57
  <li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
58
- <a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}" {% endif %}>{{ item.title }}</a>
58
+ <a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}" {% endif %}>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
59
59
  </li>
60
60
  {% endfor %}
61
61
  </ul>
@@ -68,7 +68,7 @@
68
68
  "type": "button",
69
69
  "variants": ["mobile", "dropdown"],
70
70
  "attributes": {
71
- "aria-label": "Toggle section navigation",
71
+ "aria-label": "Toggle " + params.navigation.currentPageTitle + " menu" if params.navigation.currentPageTitle else "Toggle section menu",
72
72
  "aria-controls": params.navigation.subNavigation.id,
73
73
  "aria-expanded": "false"
74
74
  }
@@ -81,14 +81,14 @@
81
81
  </li>
82
82
  {% for item in params.navigation.subNavigation.itemsList %}
83
83
  <li class="ons-navigation__item {{ ' ons-navigation__item--active' if (item.url == params.navigation.subNavigation.currentPath) or (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
84
- <a class="ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}--mobile" {% endif %}>{{ item.title }}</a>
84
+ <a class="ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}--mobile" {% endif %}>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
85
85
  {% if item.sections %}
86
86
  {% for section in item.sections %}
87
87
  {% if section.sectionTitle %}<h3 class="ons-navigation__list-header">{{ section.sectionTitle }}</h3>{% endif %}
88
88
  <ul class="ons-navigation__list ons-navigation__list--child ons-list--dashed ons-u-ml-s ons-u-mt-xs">
89
89
  {% for child in section.children %}
90
90
  <li class="ons-navigation__item ons-list__item {{ ' ons-navigation__item--active' if (child.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and child.url in params.navigation.currentPath) }}">
91
- <a class="ons-navigation__link ons-navigation__link--section" href="{{ child.url }}" {% if child.ariaLabel %}aria-label="{{ child.ariaLabel }}" {% endif %} {% if child.id %}id="{{ child.id }}" {% endif %}>{{ child.title }}</a>
91
+ <a class="ons-navigation__link ons-navigation__link--section" href="{{ child.url }}" {% if child.ariaLabel %}aria-label="{{ child.ariaLabel }}" {% endif %} {% if child.id %}id="{{ child.id }}" {% endif %}>{% if child.title %}{{ child.title }}{% elif child.text %}{{ child.text }}{% endif %}</a>
92
92
  </li>
93
93
  {% endfor %}
94
94
  </ul>
@@ -10,7 +10,7 @@ const PARAMS = {
10
10
  id: 'main-nav',
11
11
  ariaLabel: 'Main menu',
12
12
  currentPath: ['#1', '/sub-item-1', '/sub-item-2/child-item-1'],
13
- currentPageTitle: 'Main nav item 2',
13
+ currentPageTitle: 'main nav item 2',
14
14
  itemsList: [
15
15
  {
16
16
  title: 'Main nav item 1',
@@ -130,7 +130,7 @@ describe('macro: navigation', () => {
130
130
  accessiblePlaceholder: true,
131
131
  autocomplete: 'off',
132
132
  id: 'ons-site-search',
133
- containerClasses: 'ons-autosuggest-input--header',
133
+ containerClasses: 'ons-autosuggest--header',
134
134
  classes: 'ons-input-search ons-input-search--icon',
135
135
  label: {
136
136
  text: 'Search the design system',
@@ -210,12 +210,12 @@ describe('macro: navigation', () => {
210
210
  faker.renderComponent('navigation', { navigation: PARAMS });
211
211
 
212
212
  expect(buttonSpy.occurrences).toContainEqual({
213
- text: 'Main nav item 2',
213
+ text: 'main nav item 2',
214
214
  classes: 'ons-u-d-no ons-js-sub-navigation-button',
215
215
  variants: ['mobile', 'dropdown'],
216
216
  type: 'button',
217
217
  attributes: {
218
- 'aria-label': 'Toggle section navigation',
218
+ 'aria-label': 'Toggle main nav item 2 menu',
219
219
  'aria-controls': 'sub-nav',
220
220
  'aria-expanded': 'false',
221
221
  },
@@ -1,4 +1,5 @@
1
1
  {% macro onsPagination(params) %}
2
+ {% from "components/icon/_macro.njk" import onsIcon %}
2
3
  {% set currentPageIndex = params.currentPageNumber|int %}
3
4
  {% set totalPages = params.pages | length|int %}
4
5
  {% set position = "Page " ~ currentPageIndex ~ " of " ~ totalPages %}
@@ -13,7 +14,14 @@
13
14
  {% if currentPageIndex != 1 %}
14
15
  {% set prevPageIndex = currentPageIndex - 2 %}
15
16
  <li class="ons-pagination__item ons-pagination__item--previous">
16
- <a href="{{ params.pages[prevPageIndex].url }}" class="ons-pagination__link" rel="prev" aria-label="Go to the previous page (Page {{ currentPageIndex - 1 }})">{{ params.previous | default("Previous") }}</a>
17
+ <a href="{{ params.pages[prevPageIndex].url }}" class="ons-pagination__link ons-pagination__link--no-underline" rel="prev" aria-label="Go to the previous page (Page {{ currentPageIndex - 1 }})">
18
+ {{ onsIcon({
19
+ "iconType": 'arrow-previous',
20
+ "classes": 'ons-u-mr-xs',
21
+ "iconSize": 'm'
22
+ }) }}
23
+ <span class="ons-pagination__link-text">{{ params.previous | default("Previous") }}</span>
24
+ </a>
17
25
  </li>
18
26
  {% endif %}
19
27
  {% if currentPageIndex > 2 %}
@@ -60,7 +68,14 @@
60
68
  {% endif %}
61
69
  {% if totalPages > 1 and totalPages != currentPageIndex %}
62
70
  <li class="ons-pagination__item ons-pagination__item--next">
63
- <a href="{{ params.pages[currentPageIndex].url }}" class="ons-pagination__link" rel="next" aria-label="Go to the next page (Page {{ currentPageIndex + 1 }})">{{ params.next | default("Next") }}</a>
71
+ <a href="{{ params.pages[currentPageIndex].url }}" class="ons-pagination__link ons-pagination__link--no-underline" rel="next" aria-label="Go to the next page (Page {{ currentPageIndex + 1 }})">
72
+ <span class="ons-pagination__link-text">{{ params.next | default("Next") }}</span>
73
+ {{ onsIcon({
74
+ "iconType": 'arrow-next',
75
+ "classes": 'ons-u-ml-xs',
76
+ "iconSize": 'm'
77
+ }) }}
78
+ </a>
64
79
  </li>
65
80
  {% endif %}
66
81
  </ul>
@@ -39,12 +39,26 @@ $pagination-item-width: 2.5rem;
39
39
  min-width: $pagination-item-width;
40
40
  }
41
41
 
42
+ &__link--no-underline {
43
+ text-decoration: none;
44
+ &:hover {
45
+ text-decoration: none;
46
+ }
47
+ }
48
+
42
49
  &__link {
43
50
  border-radius: 3px;
44
51
  box-shadow: none;
45
52
  display: block;
46
53
  padding: $pagination-item-padding;
47
54
 
55
+ &-text {
56
+ @extend .ons-u-fs-r--b;
57
+
58
+ display: inline-block;
59
+ vertical-align: middle;
60
+ }
61
+
48
62
  &:focus {
49
63
  border-radius: 0;
50
64
  }
@@ -25,7 +25,7 @@ layout: ~
25
25
  {% block main %}
26
26
  {% call onsQuestion({
27
27
  "title": "<mark class=\"ons-instruction\">Interviewer note:</mark>Who to interview",
28
- "instruction": "<p>Only interview a person who was usually living at the property on <em>Sunday 21 March 2021</em>.</p><p>If none of those house members are available, you must save and sign out and return to the address to interview one of them at a later date.</p>",
28
+ "instruction": "<p>Only interview a person who was usually living at the property on <strong>Sunday 21 March 2021</strong>.</p><p>If none of those house members are available, you must save and sign out and return to the address to interview one of them at a later date.</p>",
29
29
  "submitButton": {
30
30
  "variants": "timer",
31
31
  "text": "Continue"
@@ -0,0 +1,98 @@
1
+ {% from "components/radios/_macro.njk" import onsRadios %}
2
+ {% from "components/button/_macro.njk" import onsButton %}
3
+ {% from "components/question/_macro.njk" import onsQuestion %}
4
+ {% from "components/panel/_macro.njk" import onsPanel %}
5
+
6
+ {% call onsQuestion({
7
+ "title": "What is your religion?",
8
+ "legendIsQuestionTitle": true
9
+ }) %}
10
+ {{
11
+ onsPanel({
12
+ "body": '<p>This question is <strong>voluntary</strong></p>',
13
+ "classes": 'ons-u-mb-m'
14
+ })
15
+ }}
16
+ <form onsubmit="return false;">
17
+ {{
18
+ onsRadios({
19
+ "dontWrap": true,
20
+ "name": "religion",
21
+ "clearRadios": {
22
+ "text": "Clear selection",
23
+ "name": "clear-radios",
24
+ "ariaClearText": "You can clear your answer using the clear selection button after the radio inputs",
25
+ "ariaClearedText": "You have cleared your answer"
26
+ },
27
+ "radios": [
28
+ {
29
+ "id": "none",
30
+ "label": {
31
+ "text": "No religion"
32
+ },
33
+ "value": "none"
34
+ },
35
+ {
36
+ "id": "christian",
37
+ "label": {
38
+ "text": "Christian",
39
+ "description": "Including Church of England, Catholic, Protestant and all other Christian denominations"
40
+ },
41
+ "value": "christian"
42
+ },
43
+ {
44
+ "id": "buddhist",
45
+ "label": {
46
+ "text": "Buddhist"
47
+ },
48
+ "value": "buddhist"
49
+ },
50
+ {
51
+ "id": "hindu",
52
+ "label": {
53
+ "text": "Hindu"
54
+ },
55
+ "value": "hindu"
56
+ },
57
+ {
58
+ "id": "jewish",
59
+ "label": {
60
+ "text": "Jewish"
61
+ },
62
+ "value": "jewish"
63
+ },
64
+ {
65
+ "id": "muslim",
66
+ "label": {
67
+ "text": "Muslim"
68
+ },
69
+ "value": "muslim"
70
+ },
71
+ {
72
+ "id": "sikh",
73
+ "label": {
74
+ "text": "Sikh"
75
+ },
76
+ "value": "sikh"
77
+ },
78
+ {
79
+ "id": "other-radio",
80
+ "label": {
81
+ "text": "Any other religion"
82
+ },
83
+ "value": "other",
84
+ "checked": true,
85
+ "other": {
86
+ "otherType": "input",
87
+ "id": "other-textbox",
88
+ "name": "other-answer",
89
+ "label": {
90
+ "text": "Enter your religion"
91
+ }
92
+ }
93
+ }
94
+ ]
95
+ })
96
+ }}
97
+ </form>
98
+ {% endcall %}
@@ -0,0 +1,70 @@
1
+ {% from "components/radios/_macro.njk" import onsRadios %}
2
+
3
+ {{
4
+ onsRadios({
5
+ "legend": "How would you like us to contact you?",
6
+ "name": "contact",
7
+ "borderless": true,
8
+ "radios": [
9
+ {
10
+ "id": "post",
11
+ "label": {
12
+ "text": "By post"
13
+ },
14
+ "value": "post"
15
+ },
16
+ {
17
+ "id": "email",
18
+ "label": {
19
+ "text": "By email"
20
+ },
21
+ "value": "email"
22
+ },
23
+ {
24
+ "id": "phone",
25
+ "label": {
26
+ "text": "By phone"
27
+ },
28
+ "value": "phone",
29
+ "checked": true,
30
+ "other": {
31
+ "otherType": "checkboxes",
32
+ "selectAllChildren": true,
33
+ "id": "phone-time",
34
+ "name": "phone-time",
35
+ "legend": "Select preferred times of day",
36
+ "checkboxes": [
37
+ {
38
+ "value": "anytime",
39
+ "id": "anytime",
40
+ "label": {
41
+ "text": "Anytime of day"
42
+ }
43
+ },
44
+ {
45
+ "value": "morning",
46
+ "id": "morning",
47
+ "label": {
48
+ "text": "Morning"
49
+ }
50
+ },
51
+ {
52
+ "value": "afternoon",
53
+ "id": "afternoon",
54
+ "label": {
55
+ "text": "Afternoon"
56
+ }
57
+ },
58
+ {
59
+ "value": "evening",
60
+ "id": "evening",
61
+ "label": {
62
+ "text": "Evening"
63
+ }
64
+ }
65
+ ]
66
+ }
67
+ }
68
+ ]
69
+ })
70
+ }}
@@ -0,0 +1,69 @@
1
+ {% from "components/radios/_macro.njk" import onsRadios %}
2
+
3
+ {{
4
+ onsRadios({
5
+ "legend": "How would you like us to contact you?",
6
+ "name": "contact",
7
+ "borderless": true,
8
+ "radios": [
9
+ {
10
+ "id": "post",
11
+ "label": {
12
+ "text": "By post"
13
+ },
14
+ "value": "post"
15
+ },
16
+ {
17
+ "id": "email",
18
+ "label": {
19
+ "text": "By email"
20
+ },
21
+ "value": "email"
22
+ },
23
+ {
24
+ "id": "phone",
25
+ "label": {
26
+ "text": "By phone"
27
+ },
28
+ "value": "phone",
29
+ "checked": true,
30
+ "other": {
31
+ "otherType": "radios",
32
+ "id": "phone-time",
33
+ "name": "phone-time",
34
+ "legend": "Choose preferred time of day",
35
+ "radios": [
36
+ {
37
+ "value": "anytime",
38
+ "id": "anytime",
39
+ "label": {
40
+ "text": "Anytime of day"
41
+ }
42
+ },
43
+ {
44
+ "value": "morning",
45
+ "id": "morning",
46
+ "label": {
47
+ "text": "Morning"
48
+ }
49
+ },
50
+ {
51
+ "value": "afternoon",
52
+ "id": "afternoon",
53
+ "label": {
54
+ "text": "Afternoon"
55
+ }
56
+ },
57
+ {
58
+ "value": "evening",
59
+ "id": "evening",
60
+ "label": {
61
+ "text": "Evening"
62
+ }
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ ]
68
+ })
69
+ }}
@@ -0,0 +1,70 @@
1
+ {% from "components/question/_macro.njk" import onsQuestion %}
2
+ {% from "components/radios/_macro.njk" import onsRadios %}
3
+
4
+ {% call onsQuestion({
5
+ "title": "How would you like us to contact you?",
6
+ "legendIsQuestionTitle": true
7
+ }) %}
8
+ {{
9
+ onsRadios({
10
+ "dontWrap": true,
11
+ "name": "contact",
12
+ "radios": [
13
+ {
14
+ "id": "post",
15
+ "label": {
16
+ "text": "By post"
17
+ },
18
+ "value": "post"
19
+ },
20
+ {
21
+ "id": "email",
22
+ "label": {
23
+ "text": "By email"
24
+ },
25
+ "value": "email"
26
+ },
27
+ {
28
+ "id": "phone",
29
+ "label": {
30
+ "text": "By phone"
31
+ },
32
+ "value": "phone",
33
+ "checked": true,
34
+ "other": {
35
+ "otherType": "select",
36
+ "id": "phone-time",
37
+ "name": "phone-time",
38
+ "label": {
39
+ "text": "Choose preferred time of day"
40
+ },
41
+ "options": [
42
+ {
43
+ "value": "",
44
+ "text": "Select an option",
45
+ "disabled": true,
46
+ "selected": true
47
+ },
48
+ {
49
+ "value": "anytime",
50
+ "text": "Any time of day"
51
+ },
52
+ {
53
+ "value": "morning",
54
+ "text": "Morning"
55
+ },
56
+ {
57
+ "value": "afternoon",
58
+ "text": "Afternoon"
59
+ },
60
+ {
61
+ "value": "evening",
62
+ "text": "Evening"
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ ]
68
+ })
69
+ }}
70
+ {% endcall %}
@@ -0,0 +1,81 @@
1
+ {% from "components/radios/_macro.njk" import onsRadios %}
2
+ {% from "components/question/_macro.njk" import onsQuestion %}
3
+
4
+ {% call onsQuestion({
5
+ "title": "How do you usually travel to work?",
6
+ "classes": "ons-u-mt-no",
7
+ "legendIsQuestionTitle": true
8
+ }) %}
9
+ {{
10
+ onsRadios({
11
+ "dontWrap": true,
12
+ "name": "travel",
13
+ "radios": [
14
+ {
15
+ "id": "home",
16
+ "label": {
17
+ "text": "Work mainly from home"
18
+ },
19
+ "value": "home"
20
+ },
21
+ {
22
+ "id": "car",
23
+ "label": {
24
+ "text": "Car or van"
25
+ },
26
+ "value": "car"
27
+ },
28
+ {
29
+ "id": "underground",
30
+ "label": {
31
+ "text": "Underground, metro, light rail or tram"
32
+ },
33
+ "value": "underground"
34
+ },
35
+ {
36
+ "id": "train",
37
+ "label": {
38
+ "text": "Train"
39
+ },
40
+ "value": "train"
41
+ },
42
+ {
43
+ "id": "bus",
44
+ "label": {
45
+ "text": "Bus, minibus or coach"
46
+ },
47
+ "value": "bus"
48
+ },
49
+ {
50
+ "id": "bicycle",
51
+ "label": {
52
+ "text": "Bicycle"
53
+ },
54
+ "value": "bicycle"
55
+ },
56
+ {
57
+ "id": "walk",
58
+ "label": {
59
+ "text": "Walk"
60
+ },
61
+ "value": "walk"
62
+ },
63
+ {
64
+ "id": "other-radio",
65
+ "label": {
66
+ "text": "Other"
67
+ },
68
+ "value": "other",
69
+ "checked": true,
70
+ "other": {
71
+ "id": "other-textbox",
72
+ "name": "other-answer",
73
+ "label": {
74
+ "text": "Enter how you travel"
75
+ }
76
+ }
77
+ }
78
+ ]
79
+ })
80
+ }}
81
+ {% endcall %}