@ons/design-system 55.1.0 → 56.0.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.
- package/components/access-code/_macro.njk +3 -3
- package/components/accordion/_macro.njk +1 -1
- package/components/address-input/_macro.njk +7 -7
- package/components/address-output/_macro.njk +7 -7
- package/components/autosuggest/_macro.njk +19 -19
- package/components/breadcrumbs/_macro.njk +3 -3
- package/components/button/_button.scss +49 -51
- package/components/button/_macro.njk +61 -35
- package/components/button/_macro.spec.js +24 -24
- package/components/button/button.spec.js +11 -11
- package/components/call-to-action/_macro.njk +1 -1
- package/components/card/_macro.njk +10 -10
- package/components/checkboxes/_checkbox-macro.njk +9 -9
- package/components/checkboxes/_macro.njk +10 -10
- package/components/checkboxes/checkbox-with-fieldset.js +6 -5
- package/components/checkboxes/checkboxes.dom.js +6 -9
- package/components/code-highlight/_macro.njk +1 -1
- package/components/collapsible/_macro.njk +7 -7
- package/components/date-input/_macro.njk +5 -5
- package/components/document-list/_macro.njk +29 -29
- package/components/duration/_macro.njk +9 -9
- package/components/duration/_macro.spec.js +0 -3
- package/components/error/_macro.njk +1 -1
- package/components/external-link/_macro.njk +1 -1
- package/components/feedback/_macro.njk +2 -2
- package/components/field/_macro.njk +5 -5
- package/components/fieldset/_fieldset.scss +5 -0
- package/components/fieldset/_macro.njk +8 -8
- package/components/footer/_macro.njk +19 -23
- package/components/footer/_macro.spec.js +0 -6
- package/components/header/_macro.njk +39 -41
- package/components/header/_macro.spec.js +4 -8
- package/components/hero/_macro.njk +15 -15
- package/components/icons/_macro.njk +2 -2
- package/components/images/_macro.njk +3 -3
- package/components/input/_input-type.scss +4 -0
- package/components/input/_macro.njk +41 -34
- package/components/input/_macro.spec.js +66 -59
- package/components/label/_macro.njk +1 -1
- package/components/language-selector/_macro.njk +1 -1
- package/components/lists/_macro.njk +22 -22
- package/components/message/_macro.njk +6 -6
- package/components/message-list/_macro.njk +1 -1
- package/components/metadata/_macro.njk +2 -2
- package/components/modal/_macro.njk +4 -4
- package/components/mutually-exclusive/_macro.njk +1 -1
- package/components/mutually-exclusive/mutually-exclusive.js +3 -1
- package/components/navigation/_macro.njk +11 -10
- package/components/navigation/_macro.spec.js +3 -2
- package/components/pagination/_macro.njk +3 -3
- package/components/panel/_macro.njk +37 -39
- package/components/panel/_macro.spec.js +1 -13
- package/components/promotional-banner/_macro.njk +2 -2
- package/components/question/_macro.njk +20 -20
- package/components/question/_macro.spec.js +2 -2
- package/components/question/_question.scss +1 -1
- package/components/quote/_macro.njk +2 -2
- package/components/radios/_macro.njk +8 -8
- package/components/radios/check-radios.js +5 -1
- package/components/related-content/_macro.njk +2 -2
- package/components/relationships/_macro.njk +4 -3
- package/components/search/_macro.njk +12 -2
- package/components/search/_macro.spec.js +27 -2
- package/components/section-navigation/_macro.njk +2 -2
- package/components/select/_macro.njk +8 -8
- package/components/share-page/_macro.njk +2 -2
- package/components/status/_macro.njk +2 -2
- package/components/summary/_macro.njk +25 -25
- package/components/table/_macro.njk +10 -10
- package/components/table-of-contents/_macro.njk +4 -4
- package/components/textarea/_macro.njk +8 -8
- package/components/timeline/_macro.njk +1 -1
- package/components/video/_macro.njk +1 -1
- package/css/census.css +1 -1
- package/css/ids.css +1 -1
- package/css/main.css +1 -1
- package/layout/_template.njk +35 -35
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/patternlib.scss +2 -2
|
@@ -57,33 +57,33 @@ describe('macro: button', () => {
|
|
|
57
57
|
expect($('.ons-btn').hasClass('ons-btn--variant-b')).toBe(true);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
it('has download variant style class when `
|
|
60
|
+
it('has download variant style class when `variants` contains `download`', () => {
|
|
61
61
|
const $ = cheerio.load(
|
|
62
62
|
renderComponent('button', {
|
|
63
63
|
url: 'http://example.com',
|
|
64
|
-
|
|
64
|
+
variants: 'download',
|
|
65
65
|
}),
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
expect($('.ons-btn').hasClass('ons-btn--download')).toBe(true);
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
it('has `download` icon when `
|
|
71
|
+
it('has `download` icon when `variants` contains "download"', () => {
|
|
72
72
|
const faker = templateFaker();
|
|
73
73
|
const iconsSpy = faker.spy('icons');
|
|
74
74
|
|
|
75
75
|
faker.renderComponent('button', {
|
|
76
76
|
url: 'http://example.com',
|
|
77
|
-
|
|
77
|
+
variants: 'download',
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
expect(iconsSpy.occurrences[0].iconType).toBe('download');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
it('has provided variant style classes when `
|
|
83
|
+
it('has provided variant style classes when `variants` contains "print"', () => {
|
|
84
84
|
const $ = cheerio.load(
|
|
85
85
|
renderComponent('button', {
|
|
86
|
-
|
|
86
|
+
variants: 'print',
|
|
87
87
|
}),
|
|
88
88
|
);
|
|
89
89
|
|
|
@@ -92,22 +92,22 @@ describe('macro: button', () => {
|
|
|
92
92
|
expect($('.ons-btn').hasClass('ons-js-print-btn')).toBe(true);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
it('has `print` icon when `
|
|
95
|
+
it('has `print` icon when `variants` contains "print"', () => {
|
|
96
96
|
const faker = templateFaker();
|
|
97
97
|
const iconsSpy = faker.spy('icons');
|
|
98
98
|
|
|
99
99
|
faker.renderComponent('button', {
|
|
100
100
|
url: 'http://example.com',
|
|
101
|
-
|
|
101
|
+
variants: 'print',
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
expect(iconsSpy.occurrences[0].iconType).toBe('print');
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
it('has provided variant style classes when `
|
|
107
|
+
it('has provided variant style classes when `variants` contains "loader"', () => {
|
|
108
108
|
const $ = cheerio.load(
|
|
109
109
|
renderComponent('button', {
|
|
110
|
-
|
|
110
|
+
variants: 'loader',
|
|
111
111
|
}),
|
|
112
112
|
);
|
|
113
113
|
|
|
@@ -116,32 +116,32 @@ describe('macro: button', () => {
|
|
|
116
116
|
expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true);
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
it('has `loader` icon when `
|
|
119
|
+
it('has `loader` icon when `variants` contains "loader"', () => {
|
|
120
120
|
const faker = templateFaker();
|
|
121
121
|
const iconsSpy = faker.spy('icons');
|
|
122
122
|
|
|
123
123
|
faker.renderComponent('button', {
|
|
124
|
-
|
|
124
|
+
variants: 'loader',
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
expect(iconsSpy.occurrences[0].iconType).toBe('loader');
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
it('has `chevron` icon when `
|
|
130
|
+
it('has `chevron` icon when `variants` contains "mobile"', () => {
|
|
131
131
|
const faker = templateFaker();
|
|
132
132
|
const iconsSpy = faker.spy('icons');
|
|
133
133
|
|
|
134
134
|
faker.renderComponent('button', {
|
|
135
|
-
|
|
135
|
+
variants: 'mobile',
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
expect(iconsSpy.occurrences[0].iconType).toBe('chevron');
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
-
it('has provided variant style classes when `
|
|
141
|
+
it('has provided variant style classes when `variants` contains "timer"', () => {
|
|
142
142
|
const $ = cheerio.load(
|
|
143
143
|
renderComponent('button', {
|
|
144
|
-
|
|
144
|
+
variants: 'timer',
|
|
145
145
|
}),
|
|
146
146
|
);
|
|
147
147
|
|
|
@@ -259,11 +259,11 @@ describe('macro: button', () => {
|
|
|
259
259
|
expect($('button').attr('type')).toBe('special-type');
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
-
it('has the provided `type` attribute even if
|
|
262
|
+
it('has the provided `type` attribute even if print variant is provided', () => {
|
|
263
263
|
const $ = cheerio.load(
|
|
264
264
|
renderComponent('button', {
|
|
265
265
|
type: 'special-type',
|
|
266
|
-
|
|
266
|
+
variants: 'print',
|
|
267
267
|
}),
|
|
268
268
|
);
|
|
269
269
|
|
|
@@ -276,10 +276,10 @@ describe('macro: button', () => {
|
|
|
276
276
|
expect($('button').attr('type')).toBe('submit');
|
|
277
277
|
});
|
|
278
278
|
|
|
279
|
-
it('defaults to being a "button" when `type` is not provided and `
|
|
279
|
+
it('defaults to being a "button" when `type` is not provided and `variants` contains "print"', () => {
|
|
280
280
|
const $ = cheerio.load(
|
|
281
281
|
renderComponent('button', {
|
|
282
|
-
|
|
282
|
+
variants: 'print',
|
|
283
283
|
}),
|
|
284
284
|
);
|
|
285
285
|
|
|
@@ -422,20 +422,20 @@ describe('macro: button', () => {
|
|
|
422
422
|
expect($('.ons-btn__new-window-description').text()).toBe(' (custom opens in a new window text)');
|
|
423
423
|
});
|
|
424
424
|
|
|
425
|
-
it('has the `download` attribute when `
|
|
425
|
+
it('has the `download` attribute when `variants` contains "download"', () => {
|
|
426
426
|
const $ = cheerio.load(
|
|
427
427
|
renderComponent('button', {
|
|
428
|
-
|
|
428
|
+
variants: 'download',
|
|
429
429
|
}),
|
|
430
430
|
);
|
|
431
431
|
|
|
432
432
|
expect($('.ons-btn').attr('download')).toBeDefined();
|
|
433
433
|
});
|
|
434
434
|
|
|
435
|
-
it('does not have the `download` attribute when `
|
|
435
|
+
it('does not have the `download` attribute when `variants` contains "download" and `removeDownloadAttribute` is `true`', () => {
|
|
436
436
|
const $ = cheerio.load(
|
|
437
437
|
renderComponent('button', {
|
|
438
|
-
|
|
438
|
+
variants: 'download',
|
|
439
439
|
removeDownloadAttribute: true,
|
|
440
440
|
}),
|
|
441
441
|
);
|
|
@@ -56,7 +56,7 @@ describe('script: button', () => {
|
|
|
56
56
|
renderComponent('button', {
|
|
57
57
|
id: 'test-button',
|
|
58
58
|
text: 'Submit',
|
|
59
|
-
|
|
59
|
+
variants: 'loader',
|
|
60
60
|
}),
|
|
61
61
|
);
|
|
62
62
|
|
|
@@ -72,7 +72,7 @@ describe('script: button', () => {
|
|
|
72
72
|
renderComponent('button', {
|
|
73
73
|
id: 'test-button',
|
|
74
74
|
text: 'Submit',
|
|
75
|
-
|
|
75
|
+
variants: 'loader',
|
|
76
76
|
}),
|
|
77
77
|
);
|
|
78
78
|
|
|
@@ -86,7 +86,7 @@ describe('script: button', () => {
|
|
|
86
86
|
renderComponent('button', {
|
|
87
87
|
id: 'test-button',
|
|
88
88
|
text: 'Submit',
|
|
89
|
-
|
|
89
|
+
variants: 'loader',
|
|
90
90
|
}),
|
|
91
91
|
);
|
|
92
92
|
|
|
@@ -104,7 +104,7 @@ describe('script: button', () => {
|
|
|
104
104
|
${renderComponent('button', {
|
|
105
105
|
id: 'test-button',
|
|
106
106
|
text: 'Submit',
|
|
107
|
-
|
|
107
|
+
variants: 'loader',
|
|
108
108
|
})}
|
|
109
109
|
</form>
|
|
110
110
|
`,
|
|
@@ -124,7 +124,7 @@ describe('script: button', () => {
|
|
|
124
124
|
${renderComponent('button', {
|
|
125
125
|
id: 'test-button',
|
|
126
126
|
text: 'Submit',
|
|
127
|
-
|
|
127
|
+
variants: 'loader',
|
|
128
128
|
})}
|
|
129
129
|
</form>
|
|
130
130
|
`,
|
|
@@ -142,7 +142,7 @@ describe('script: button', () => {
|
|
|
142
142
|
${renderComponent('button', {
|
|
143
143
|
id: 'test-button',
|
|
144
144
|
text: 'Submit',
|
|
145
|
-
|
|
145
|
+
variants: 'loader',
|
|
146
146
|
})}
|
|
147
147
|
</form>
|
|
148
148
|
`,
|
|
@@ -161,7 +161,7 @@ describe('script: button', () => {
|
|
|
161
161
|
'/test',
|
|
162
162
|
renderComponent('button', {
|
|
163
163
|
id: 'test-button',
|
|
164
|
-
|
|
164
|
+
variants: 'timer',
|
|
165
165
|
text: 'Submit',
|
|
166
166
|
}),
|
|
167
167
|
);
|
|
@@ -186,7 +186,7 @@ describe('script: button', () => {
|
|
|
186
186
|
'/test',
|
|
187
187
|
renderComponent('button', {
|
|
188
188
|
id: 'test-button',
|
|
189
|
-
|
|
189
|
+
variants: 'timer',
|
|
190
190
|
text: 'Submit',
|
|
191
191
|
}),
|
|
192
192
|
);
|
|
@@ -213,7 +213,7 @@ describe('script: button', () => {
|
|
|
213
213
|
<form>
|
|
214
214
|
${renderComponent('button', {
|
|
215
215
|
id: 'test-button',
|
|
216
|
-
|
|
216
|
+
variants: 'timer',
|
|
217
217
|
text: 'Submit',
|
|
218
218
|
})}
|
|
219
219
|
</form>
|
|
@@ -242,7 +242,7 @@ describe('script: button', () => {
|
|
|
242
242
|
<form>
|
|
243
243
|
${renderComponent('button', {
|
|
244
244
|
id: 'test-button',
|
|
245
|
-
|
|
245
|
+
variants: 'timer',
|
|
246
246
|
text: 'Submit',
|
|
247
247
|
})}
|
|
248
248
|
</form>
|
|
@@ -273,7 +273,7 @@ describe('script: button', () => {
|
|
|
273
273
|
id: 'test-button',
|
|
274
274
|
type: 'button',
|
|
275
275
|
text: 'Print this page',
|
|
276
|
-
|
|
276
|
+
variants: 'print',
|
|
277
277
|
}),
|
|
278
278
|
);
|
|
279
279
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<div class="ons-grid ons-grid--flex ons-grid--vertical-center ons-grid--no-wrap@s">
|
|
6
6
|
<div class="ons-grid__col ons-col-auto ons-u-flex-shrink@s">
|
|
7
7
|
<h2 class="ons-call-to-action__heading ons-u-fs-r--b ons-u-di">{{ params.headingText }}</h2>
|
|
8
|
-
{% if params.paragraphText
|
|
8
|
+
{% if params.paragraphText %}
|
|
9
9
|
<p class="ons-call-to-action__text ons-u-di">{{ params.paragraphText }}</p>
|
|
10
10
|
{% endif %}
|
|
11
11
|
</div>
|
|
@@ -6,31 +6,31 @@
|
|
|
6
6
|
|
|
7
7
|
<div class="ons-card" aria-describedBy="{{ params.textId }}">
|
|
8
8
|
|
|
9
|
-
{%- if params.image
|
|
10
|
-
{%- if params.url
|
|
9
|
+
{%- if params.image -%}
|
|
10
|
+
{%- if params.url -%}
|
|
11
11
|
<a href="{{ params.url }}" class="ons-card__link ons-u-db">
|
|
12
12
|
{%- endif -%}
|
|
13
|
-
{% if params.image.smallSrc
|
|
14
|
-
<img class="ons-card__image ons-u-mb-s" height="200" width="303"{% if params.image.largeSrc
|
|
15
|
-
{% elif params.image == true or params.image.placeholderURL
|
|
16
|
-
<img class="ons-card__image ons-u-mb-s" height="100" width="303" srcset="{{ params.image.placeholderURL if params.image.placeholderURL
|
|
13
|
+
{% if params.image.smallSrc %}
|
|
14
|
+
<img class="ons-card__image ons-u-mb-s" height="200" width="303"{% if params.image.largeSrc %} srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %} src="{{ params.image.smallSrc }}" alt="{{ params.image.alt }}" loading="lazy">
|
|
15
|
+
{% elif params.image == true or params.image.placeholderURL %}
|
|
16
|
+
<img class="ons-card__image ons-u-mb-s" height="100" width="303" srcset="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png 1x, {{ params.image.placeholderURL if params.image.placeholderURL }}/img/large/placeholder-card.png 2x" src="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png" alt="" loading="lazy">
|
|
17
17
|
{% endif %}
|
|
18
18
|
|
|
19
19
|
<h{{ titleSize }} class="ons-card__title {{ params.titleClasses | default('ons-u-fs-m')}}" id="{{ params.id }}">
|
|
20
20
|
{{ params.title }}
|
|
21
21
|
</h{{ titleSize }}>
|
|
22
|
-
{%- if params.url
|
|
22
|
+
{%- if params.url -%}
|
|
23
23
|
</a>
|
|
24
24
|
{%- endif -%}
|
|
25
25
|
|
|
26
26
|
{%- else -%}
|
|
27
27
|
|
|
28
28
|
<h{{ titleSize }} class="ons-card__title {{ params.titleClasses | default('ons-u-fs-m') }}" id="{{ params.id }}">
|
|
29
|
-
{%- if params.url
|
|
29
|
+
{%- if params.url -%}
|
|
30
30
|
<a class="ons-card__link" href="{{ params.url }}">
|
|
31
31
|
{%- endif -%}
|
|
32
32
|
{{ params.title }}
|
|
33
|
-
{%- if params.url
|
|
33
|
+
{%- if params.url -%}
|
|
34
34
|
</a>
|
|
35
35
|
{%- endif -%}
|
|
36
36
|
</h{{ titleSize }}>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
<p id="{{ params.textId }}">{{ params.text }}</p>
|
|
41
41
|
|
|
42
|
-
{% if params.itemsList
|
|
42
|
+
{% if params.itemsList -%}
|
|
43
43
|
{{
|
|
44
44
|
onsList({
|
|
45
45
|
"variants": 'dashed',
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{% macro onsCheckbox(params) %}
|
|
2
2
|
{% from "components/label/_macro.njk" import onsLabel %}
|
|
3
3
|
|
|
4
|
-
<span class="ons-checkbox{% if params.hideLabel
|
|
4
|
+
<span class="ons-checkbox{% if params.hideLabel == true %} ons-checkbox--no-label{% endif %}{{ ' ' + params.classes if params.classes else '' }}">
|
|
5
5
|
<input
|
|
6
6
|
type="checkbox"
|
|
7
7
|
id="{{ params.id }}"
|
|
8
|
-
class="ons-checkbox__input ons-js-checkbox{{ ' ' + params.inputClasses if params.inputClasses
|
|
8
|
+
class="ons-checkbox__input ons-js-checkbox{{ ' ' + params.inputClasses if params.inputClasses else '' }}"
|
|
9
9
|
value="{{ params.value }}"
|
|
10
|
-
{% if params.disabled
|
|
11
|
-
{% if params.name
|
|
12
|
-
{% if params.checked
|
|
13
|
-
{% if params.other
|
|
14
|
-
{% if params.attributes
|
|
15
|
-
{% if params.deselectMessage
|
|
10
|
+
{% if params.disabled == true %}disabled aria-disabled="true"{%endif %}
|
|
11
|
+
{% if params.name %} name="{{ params.name }}"{% endif %}
|
|
12
|
+
{% if params.checked %} checked{% endif %}
|
|
13
|
+
{% if params.other and not params.other.open %} aria-controls="{{ params.id }}-other-wrap" aria-haspopup="true"{% endif %}
|
|
14
|
+
{% 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 %}
|
|
15
|
+
{% if params.deselectMessage %} data-deselect-message="{{ params.deselectMessage }}"{% endif %}
|
|
16
16
|
>
|
|
17
17
|
|
|
18
18
|
{{ onsLabel({
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"description": params.label.description
|
|
25
25
|
}) }}
|
|
26
26
|
|
|
27
|
-
{% if params.other
|
|
27
|
+
{% if params.other %}
|
|
28
28
|
{% set otherType = params.other.otherType | default('input') %}
|
|
29
29
|
<span class="ons-checkbox__other{{ ' ons-checkbox__other--open' if params.other.open }}" id="{{ params.id }}-other-wrap">
|
|
30
30
|
{% if otherType == "input" %}
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
<p class="ons-checkboxes__label{{ " " + params.checkboxesLabelClasses if params.checkboxesLabelClasses }}">{{ params.checkboxesLabel }}</p>
|
|
9
9
|
{% set hasOther = false %}
|
|
10
10
|
{% for checkbox in params.checkboxes %}
|
|
11
|
-
{% if checkbox.other
|
|
11
|
+
{% if checkbox.other %}
|
|
12
12
|
{% set hasOther = true %}
|
|
13
13
|
{% endif %}
|
|
14
14
|
{% endfor %}
|
|
15
|
-
{% if hasOther == false and params.autoSelect
|
|
15
|
+
{% if hasOther == false and params.autoSelect and params.autoSelect.selectAllText %}
|
|
16
16
|
{% set btnClasses = ['small', 'secondary'] %}
|
|
17
|
-
{% if params.borderlessParent
|
|
17
|
+
{% if params.borderlessParent == false %}
|
|
18
18
|
{% set btnClasses = ['small', 'secondary', 'ghost-dark'] %}
|
|
19
19
|
{% endif %}
|
|
20
20
|
{{
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
{% for checkbox in params.checkboxes %}
|
|
34
34
|
{% set childIsChecked = false %}
|
|
35
35
|
{% set labelHTML = checkbox.label.text %}
|
|
36
|
-
{% if params.mutuallyExclusive
|
|
36
|
+
{% if params.mutuallyExclusive %}
|
|
37
37
|
{% set exclusiveClass = ' ons-js-exclusive-group-item' %}
|
|
38
38
|
{% endif %}
|
|
39
|
-
{% if params.borderless
|
|
39
|
+
{% if params.borderless %}
|
|
40
40
|
{% set borderless = " ons-checkbox--no-border" %}
|
|
41
41
|
{% endif %}
|
|
42
|
-
{% if checkbox.other
|
|
42
|
+
{% if checkbox.other %}
|
|
43
43
|
{% set otherClass = " ons-js-other" %}
|
|
44
|
-
{% if checkbox.other.selectAllChildren
|
|
44
|
+
{% if checkbox.other.selectAllChildren == true %}
|
|
45
45
|
{% set otherClass = otherClass + " ons-js-select-all-children" %}
|
|
46
46
|
{% endif %}
|
|
47
47
|
{% for otherCheckbox in checkbox.other.checkboxes %}
|
|
48
|
-
{% if otherCheckbox.checked
|
|
48
|
+
{% if otherCheckbox.checked %}
|
|
49
49
|
{% set childIsChecked = true %}
|
|
50
50
|
{% endif %}
|
|
51
51
|
{% endfor %}
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"attributes": checkbox.attributes
|
|
70
70
|
} %}
|
|
71
71
|
|
|
72
|
-
{% if checkbox.other
|
|
72
|
+
{% if checkbox.other %}
|
|
73
73
|
{% set config = config | setAttributes({
|
|
74
74
|
"other": {
|
|
75
75
|
"open": checkbox.other.open | default(false),
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
</div>
|
|
104
104
|
{% endset %}
|
|
105
105
|
|
|
106
|
-
{% if params.mutuallyExclusive
|
|
106
|
+
{% if params.mutuallyExclusive %}
|
|
107
107
|
{% call onsMutuallyExclusive({
|
|
108
108
|
"id": params.id,
|
|
109
109
|
"classes": params.classes,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export default class CheckboxWithFieldset {
|
|
2
|
-
constructor(fieldset,
|
|
2
|
+
constructor(fieldset, checkboxes) {
|
|
3
3
|
this.fieldset = fieldset;
|
|
4
|
-
this.
|
|
4
|
+
this.checkboxes = checkboxes;
|
|
5
|
+
this.fieldsetParent = fieldset.closest('.ons-checkbox');
|
|
6
|
+
this.selectAllChildrenInput = this.fieldsetParent.querySelector('.ons-js-select-all-children');
|
|
5
7
|
this.childInputs = [...this.fieldset.querySelectorAll('input')];
|
|
6
|
-
this.selectAllChildrenInput = this.inputs.find(input => input.classList.contains('ons-js-select-all-children'));
|
|
7
8
|
|
|
8
9
|
if (this.selectAllChildrenInput) {
|
|
9
10
|
this.selectAllChildrenInput.addEventListener('change', this.checkChildInputsOnSelect.bind(this));
|
|
10
11
|
} else {
|
|
11
|
-
this.
|
|
12
|
+
this.checkboxes.forEach(checkbox => checkbox.addEventListener('change', this.uncheckChildInputsOnDeselect.bind(this)));
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -19,7 +20,7 @@ export default class CheckboxWithFieldset {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
uncheckChildInputsOnDeselect() {
|
|
22
|
-
const isOther = this.
|
|
23
|
+
const isOther = this.checkboxes.find(checkbox => checkbox.classList.contains('ons-js-other'));
|
|
23
24
|
if (isOther && isOther.checked === false) {
|
|
24
25
|
this.childInputs.forEach(input => {
|
|
25
26
|
input.checked = false;
|
|
@@ -15,16 +15,13 @@ domready(async () => {
|
|
|
15
15
|
new CheckCheckbox(checkboxInput, openOther);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const
|
|
21
|
-
const otherFieldset = other.parentNode.querySelector('.ons-js-other-fieldset');
|
|
18
|
+
const otherFieldsets = [...document.querySelectorAll('.ons-js-other-fieldset')];
|
|
19
|
+
if (otherFieldsets) {
|
|
20
|
+
const CheckboxWithInnerFieldset = (await import('./checkbox-with-fieldset')).default;
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
new CheckboxWithInnerFieldset(otherFieldset, checkboxes, selectAllChildrenInput);
|
|
27
|
-
}
|
|
22
|
+
otherFieldsets.forEach(otherFieldset => {
|
|
23
|
+
new CheckboxWithInnerFieldset(otherFieldset, checkboxes);
|
|
24
|
+
});
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
const autoSelectButtons = [...document.querySelectorAll('.ons-js-auto-selector')];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{% macro onsCodeHighlight(params) %}
|
|
2
2
|
<pre class="ons-patternlib-example__pre">{#
|
|
3
|
-
#}<code class="ons-patternlib-example__code ons-language-{{ params.language if params.language
|
|
3
|
+
#}<code class="ons-patternlib-example__code ons-language-{{ params.language if params.language else 'markup' }}">{{ params.code }}</code>{#
|
|
4
4
|
#}</pre>
|
|
5
5
|
{% endmacro %}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{% macro onsCollapsible(params) %}
|
|
2
2
|
<details
|
|
3
3
|
id="{{ params.id }}"
|
|
4
|
-
class="ons-collapsible ons-js-collapsible{% if params.isAccordion
|
|
5
|
-
{% if params.group
|
|
6
|
-
{% if params.attributes
|
|
7
|
-
{% if params.saveState
|
|
8
|
-
{% if params.open
|
|
4
|
+
class="ons-collapsible ons-js-collapsible{% if params.isAccordion %} ons-collapsible--accordion{% endif %}{% if params.classes %} {{ params.classes }}{% endif %}"
|
|
5
|
+
{% if params.group %} data-group="{{ params.group }}"{% endif %}
|
|
6
|
+
{% 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 %}
|
|
7
|
+
{% if params.saveState %} data-save-state="true"{% endif %}
|
|
8
|
+
{% if params.open %} data-open="true"{% endif %}
|
|
9
9
|
>
|
|
10
10
|
<summary
|
|
11
11
|
class="ons-collapsible__heading ons-js-collapsible-heading"
|
|
12
|
-
{% if params.headingAttributes
|
|
12
|
+
{% if params.headingAttributes %}{% for attribute, value in (params.headingAttributes.items() if params.headingAttributes is mapping and params.headingAttributes.items else params.headingAttributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
13
13
|
>
|
|
14
14
|
{% set titleTag = params.titleTag | default("h2") %}
|
|
15
15
|
<{{ titleTag }} class="ons-collapsible__title">{{ params.title }}</{{ titleTag }}>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}}</span>
|
|
23
23
|
</summary>
|
|
24
24
|
<div id="{{ params.id }}-content" class="ons-collapsible__content ons-js-collapsible-content"
|
|
25
|
-
{% if params.contentAttributes
|
|
25
|
+
{% if params.contentAttributes %}{% for attribute, value in (params.contentAttributes.items() if params.contentAttributes is mapping and params.contentAttributes.items else params.contentAttributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
26
26
|
>
|
|
27
27
|
{{ params.content | safe }}{{ caller() if caller }}
|
|
28
28
|
</div>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
{%- endif -%}
|
|
22
22
|
|
|
23
23
|
{% set fields %}
|
|
24
|
-
{% if params.day
|
|
24
|
+
{% if params.day %}
|
|
25
25
|
{{ onsInput({
|
|
26
26
|
"id": params.id + "-day",
|
|
27
27
|
"type": "number",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}) }}
|
|
42
42
|
{% endif %}
|
|
43
43
|
|
|
44
|
-
{% if params.month
|
|
44
|
+
{% if params.month %}
|
|
45
45
|
{{ onsInput({
|
|
46
46
|
"id": params.id + "-month",
|
|
47
47
|
"type": "number",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
}) }}
|
|
62
62
|
{% endif %}
|
|
63
63
|
|
|
64
|
-
{% if params.year
|
|
64
|
+
{% if params.year %}
|
|
65
65
|
{{ onsInput({
|
|
66
66
|
"id": params.id + "-year",
|
|
67
67
|
"type": "number",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
{% endset %}
|
|
91
91
|
{% endif %}
|
|
92
92
|
|
|
93
|
-
{% if params.mutuallyExclusive
|
|
93
|
+
{% if params.mutuallyExclusive %}
|
|
94
94
|
{% call onsMutuallyExclusive({
|
|
95
95
|
"id": params.id,
|
|
96
96
|
"legend": params.legendOrLabel,
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
{{ fields | safe }}
|
|
110
110
|
{% endcall %}
|
|
111
111
|
{% elif numberOfFields == 1 %}
|
|
112
|
-
{% if params.error
|
|
112
|
+
{% if params.error %}
|
|
113
113
|
{% call onsError(params.error) %}
|
|
114
114
|
{{ fields | safe }}
|
|
115
115
|
{% endcall %}
|