@ons/design-system 66.0.2 → 67.0.1

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 (46) hide show
  1. package/README.md +3 -2
  2. package/components/accordion/_macro.spec.js +2 -8
  3. package/components/accordion/accordion.dom.js +2 -2
  4. package/components/accordion/accordion.spec.js +22 -19
  5. package/components/accordion/example-accordion-open.njk +3 -3
  6. package/components/card/_card.scss +1 -1
  7. package/components/checkboxes/_macro.njk +1 -1
  8. package/components/checkboxes/example-checkboxes-with-revealed-checkboxes-expanded.njk +1 -1
  9. package/components/checkboxes/example-checkboxes-with-revealed-checkboxes.njk +1 -1
  10. package/components/cookies-banner/_macro.njk +1 -1
  11. package/components/cookies-banner/_macro.spec.js +1 -1
  12. package/components/details/_details.scss +66 -57
  13. package/components/details/_macro.njk +5 -5
  14. package/components/details/_macro.spec.js +3 -10
  15. package/components/details/details.dom.js +1 -1
  16. package/components/details/details.js +13 -1
  17. package/components/details/details.spec.js +43 -11
  18. package/components/details/example-details-with-warning.njk +1 -2
  19. package/components/footer/_macro.njk +1 -1
  20. package/components/header/_header.scss +4 -0
  21. package/components/header/_macro.njk +17 -17
  22. package/components/header/_macro.spec.js +128 -5
  23. package/components/header/example-header-external-with-navigation-and-search.njk +57 -0
  24. package/components/input/_input-type.scss +2 -2
  25. package/components/input/_macro.njk +1 -1
  26. package/components/input/_macro.spec.js +4 -16
  27. package/components/input/input.dom.js +11 -0
  28. package/components/input/input.js +14 -0
  29. package/components/input/input.spec.js +28 -0
  30. package/components/label/_macro.njk +2 -2
  31. package/components/navigation/_macro.njk +3 -1
  32. package/components/related-content/_macro.njk +28 -30
  33. package/components/section-navigation/_macro.njk +68 -55
  34. package/components/section-navigation/_section-navigation.scss +20 -2
  35. package/components/video/_macro.njk +11 -11
  36. package/css/main.css +1 -1
  37. package/css/print.css +1 -1
  38. package/js/main.js +1 -0
  39. package/layout/_template.njk +29 -30
  40. package/package.json +1 -1
  41. package/scripts/main.es5.js +1 -1
  42. package/scripts/main.js +1 -1
  43. package/scss/objects/_page.scss +3 -5
  44. package/scss/print.scss +28 -5
  45. package/components/collapsible/_macro.njk +0 -22
  46. package/components/collapsible/_macro.spec.js +0 -151
@@ -21,13 +21,11 @@
21
21
  @include mq(xxs, m) {
22
22
  margin-top: 1.5rem;
23
23
  }
24
-
25
24
  }
26
25
 
27
- // Adjust margin-top when .ons-page__main contains .ons-panel--error */
28
- .ons-breadcrumbs ~ .ons-grid .ons-grid__col .ons-page__main:has(.ons-panel--error){
29
- margin-top: 1rem;
30
-
26
+ // Adjust margin-top when .ons-page__main contains .ons-panel--error
27
+ .ons-breadcrumbs ~ .ons-grid .ons-grid__col .ons-page__main:has(.ons-panel--error) {
28
+ margin-top: 1rem;
31
29
  }
32
30
 
33
31
  .ons-page__body {
package/scss/print.scss CHANGED
@@ -45,11 +45,6 @@ a::after {
45
45
  }
46
46
  }
47
47
 
48
- details,
49
- details > summary {
50
- display: block !important;
51
- }
52
-
53
48
  .ons-hero {
54
49
  print-color-adjust: exact;
55
50
  }
@@ -68,3 +63,31 @@ h6,
68
63
  p {
69
64
  break-inside: avoid;
70
65
  }
66
+
67
+ .ons-details {
68
+ &--initialised & {
69
+ &__heading {
70
+ padding: 0;
71
+ margin: 0 0 1rem;
72
+ }
73
+
74
+ &__title {
75
+ color: var(--ons-color-black);
76
+ font-size: 24px;
77
+ }
78
+
79
+ &__icon {
80
+ display: none;
81
+ }
82
+
83
+ &__content {
84
+ display: block;
85
+ }
86
+ }
87
+
88
+ &--accordion & {
89
+ &__heading {
90
+ padding-top: 1rem;
91
+ }
92
+ }
93
+ }
@@ -1,22 +0,0 @@
1
- {# OnsCollapsible has been superceded by onsDetails and will be deprecated in due course. Please upgrade to use onsDetails. Configuration is unchanged, only the component name and classes have changed name. #}
2
- {% macro onsCollapsible(params) %}
3
- {% from "components/details/_macro.njk" import onsDetails %}
4
-
5
- {% set content = caller() if caller else params.content | safe %}
6
-
7
- {{
8
- onsDetails({
9
- "id": params.id,
10
- "classes": params.classes,
11
- "attributes": params.attributes,
12
- "headingAttributes": params.headingAttributes,
13
- "contentAttributes": params.contentAttributes,
14
- "title": params.title,
15
- "titleTag": params.titleTag,
16
- "content": content,
17
- "saveState": params.saveState,
18
- "open": params.open
19
- })
20
- }}
21
-
22
- {% endmacro %}
@@ -1,151 +0,0 @@
1
- /** @jest-environment jsdom */
2
-
3
- import * as cheerio from 'cheerio';
4
-
5
- import axe from '../../tests/helpers/axe';
6
- import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
7
-
8
- const EXAMPLE_COLLAPSIBLE_BASIC = {
9
- id: 'collapsible-id',
10
- title: 'Title for collapsible',
11
- content: 'Content for collapsible',
12
- };
13
-
14
- describe('macro: collapsible', () => {
15
- it('passes jest-axe checks', async () => {
16
- const $ = cheerio.load(renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
17
-
18
- const results = await axe($.html());
19
- expect(results).toHaveNoViolations();
20
- });
21
-
22
- it('has the provided `id` attribute', () => {
23
- const $ = cheerio.load(renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
24
-
25
- expect($('.ons-details').attr('id')).toBe('collapsible-id');
26
- });
27
-
28
- it('has additionally provided style classes', () => {
29
- const $ = cheerio.load(
30
- renderComponent('collapsible', {
31
- ...EXAMPLE_COLLAPSIBLE_BASIC,
32
- classes: 'extra-class another-extra-class',
33
- }),
34
- );
35
-
36
- expect($('.ons-details').hasClass('extra-class')).toBe(true);
37
- expect($('.ons-details').hasClass('another-extra-class')).toBe(true);
38
- });
39
-
40
- it('has provided title text', () => {
41
- const $ = cheerio.load(renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
42
-
43
- const titleText = $('.ons-details__title')
44
- .first()
45
- .text()
46
- .trim();
47
- expect(titleText).toBe('Title for collapsible');
48
- });
49
-
50
- it('has title with provided tag override', () => {
51
- const $ = cheerio.load(
52
- renderComponent('collapsible', {
53
- ...EXAMPLE_COLLAPSIBLE_BASIC,
54
- titleTag: 'h4',
55
- }),
56
- );
57
-
58
- const titleTag = $('.ons-details__title')[0].tagName;
59
- expect(titleTag).toBe('h4');
60
- });
61
-
62
- it('has provided content text', () => {
63
- const $ = cheerio.load(renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
64
-
65
- const titleText = $('.ons-details__content')
66
- .text()
67
- .trim();
68
- expect(titleText).toEqual(expect.stringContaining('Content for collapsible'));
69
- });
70
-
71
- it('has additionally provided `attributes`', () => {
72
- const $ = cheerio.load(
73
- renderComponent('collapsible', {
74
- ...EXAMPLE_COLLAPSIBLE_BASIC,
75
- attributes: {
76
- a: 123,
77
- b: 456,
78
- },
79
- }),
80
- );
81
- expect($('.ons-details').attr('a')).toBe('123');
82
- expect($('.ons-details').attr('b')).toBe('456');
83
- });
84
-
85
- it('has the correct data attribute when `saveState` is provided', () => {
86
- const $ = cheerio.load(
87
- renderComponent('collapsible', {
88
- ...EXAMPLE_COLLAPSIBLE_BASIC,
89
- saveState: true,
90
- }),
91
- );
92
- expect($('.ons-details').attr('data-save-state')).toBe('true');
93
- });
94
-
95
- it('has the correct data attribute when `open` is provided', () => {
96
- const $ = cheerio.load(
97
- renderComponent('collapsible', {
98
- ...EXAMPLE_COLLAPSIBLE_BASIC,
99
- open: true,
100
- }),
101
- );
102
- expect($('.ons-details').attr('data-open')).toBe('true');
103
- });
104
-
105
- it('has additionally provided `headingAttributes`', () => {
106
- const $ = cheerio.load(
107
- renderComponent('collapsible', {
108
- ...EXAMPLE_COLLAPSIBLE_BASIC,
109
- headingAttributes: {
110
- a: 123,
111
- b: 456,
112
- },
113
- }),
114
- );
115
-
116
- expect($('.ons-details__heading').attr('a')).toBe('123');
117
- expect($('.ons-details__heading').attr('b')).toBe('456');
118
- });
119
-
120
- it('has additionally provided `contentAttributes`', () => {
121
- const $ = cheerio.load(
122
- renderComponent('collapsible', {
123
- ...EXAMPLE_COLLAPSIBLE_BASIC,
124
- contentAttributes: {
125
- a: 123,
126
- b: 456,
127
- },
128
- }),
129
- );
130
-
131
- expect($('.ons-details__content').attr('a')).toBe('123');
132
- expect($('.ons-details__content').attr('b')).toBe('456');
133
- });
134
-
135
- it('has `chevron` icon', () => {
136
- const faker = templateFaker();
137
- const iconsSpy = faker.spy('icon');
138
- faker.renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC);
139
-
140
- expect(iconsSpy.occurrences[0].iconType).toBe('chevron');
141
- });
142
-
143
- it('calls with content', () => {
144
- const $ = cheerio.load(renderComponent('collapsible', { EXAMPLE_COLLAPSIBLE_BASIC }, 'Example content...'));
145
-
146
- const content = $('.ons-details__content')
147
- .text()
148
- .trim();
149
- expect(content).toEqual(expect.stringContaining('Example content...'));
150
- });
151
- });