@madgex/design-system 1.61.1 → 1.62.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/coverage/cobertura-coverage.xml +18 -11
- package/coverage/components/accordion/accordion.js.html +1 -1
- package/coverage/components/accordion/index.html +1 -1
- package/coverage/components/inputs/combobox/combobox.js.html +1 -1
- package/coverage/components/inputs/combobox/index.html +1 -1
- package/coverage/components/inputs/combobox/vue-components/Combobox.vue.html +1 -1
- package/coverage/components/inputs/combobox/vue-components/ListBoxOption.vue.html +25 -7
- package/coverage/components/inputs/combobox/vue-components/index.html +14 -14
- package/coverage/components/inputs/file-upload/file-upload.js.html +1 -1
- package/coverage/components/inputs/file-upload/index.html +1 -1
- package/coverage/components/inputs/textarea/character-count.js.html +1 -1
- package/coverage/components/inputs/textarea/index.html +1 -1
- package/coverage/components/modal/index.html +1 -1
- package/coverage/components/modal/modal.js.html +1 -1
- package/coverage/components/notification/index.html +1 -1
- package/coverage/components/notification/notification.js.html +1 -1
- package/coverage/components/popover/index.html +1 -1
- package/coverage/components/popover/popover.js.html +1 -1
- package/coverage/components/switch-state/index.html +1 -1
- package/coverage/components/switch-state/switch-state.js.html +1 -1
- package/coverage/components/tabs/index.html +1 -1
- package/coverage/components/tabs/tabs.js.html +1 -1
- package/coverage/index.html +19 -19
- package/coverage/js/common.js.html +1 -1
- package/coverage/js/fractal-scripts/combobox.js.html +1 -1
- package/coverage/js/fractal-scripts/index.html +1 -1
- package/coverage/js/fractal-scripts/notification.js.html +1 -1
- package/coverage/js/fractal-scripts/switch-state.js.html +1 -1
- package/coverage/js/index-fractal.js.html +1 -1
- package/coverage/js/index-polyfills.js.html +1 -1
- package/coverage/js/index-vue.js.html +1 -1
- package/coverage/js/index.html +1 -1
- package/coverage/js/index.js.html +1 -1
- package/coverage/js/polyfills/arrayPrototypeFind.js.html +1 -1
- package/coverage/js/polyfills/closest.js.html +1 -1
- package/coverage/js/polyfills/index.html +1 -1
- package/coverage/js/polyfills/objectAssign.js.html +1 -1
- package/coverage/js/polyfills/remove.js.html +1 -1
- package/coverage/tokens/_config.js.html +1 -1
- package/coverage/tokens/index.html +1 -1
- package/dist/_tokens/css/_tokens.css +1 -1
- package/dist/_tokens/js/_tokens-module.js +1 -1
- package/dist/_tokens/scss/_tokens.scss +1 -1
- package/dist/assets/icons.json +1 -1
- package/dist/js/index.js +4 -4
- package/package.json +1 -1
- package/src/components/accordion/_template.njk +12 -12
- package/src/components/accordion/accordion.config.js +4 -0
- package/src/components/button/_template.njk +14 -10
- package/src/components/button/button.config.js +9 -0
- package/src/components/button/button.njk +2 -1
- package/src/components/card/_template.njk +2 -2
- package/src/components/card/card.config.js +3 -0
- package/src/components/card/card.njk +2 -1
- package/src/components/inputs/checkbox/_template.njk +27 -27
- package/src/components/inputs/combobox/_template.njk +11 -12
- package/src/components/inputs/combobox/vue-components/ListBoxOption.vue +6 -0
- package/src/components/inputs/file-upload/_template.njk +28 -28
- package/src/components/inputs/input/_template.njk +3 -3
- package/src/components/inputs/radio/_template.njk +4 -4
- package/src/components/inputs/select/_template.njk +7 -7
- package/src/components/inputs/textarea/_template.njk +4 -4
- package/src/components/pagination/_template.njk +1 -1
- package/src/components/pagination/pagination.config.js +5 -0
- package/src/components/pagination/pagination.njk +2 -1
- package/src/components/pagination-numbers/_template.njk +1 -1
- package/src/components/pagination-numbers/pagination-numbers.config.js +9 -0
- package/src/components/pagination-numbers/pagination-numbers.njk +2 -1
- package/src/components/section-title/_template.njk +14 -14
- package/src/components/switch-state/_template.njk +5 -5
- package/src/components/switch-state/switch-state.config.js +2 -0
- package/src/components/switch-state/switch-state.njk +2 -1
- package/src/components/tabs/_template.njk +40 -36
package/package.json
CHANGED
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
{% if params.content %}
|
|
4
4
|
{%- set triggerHtmlTag %}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
{%- if params.triggerHtmlTag -%}
|
|
6
|
+
{{params.triggerHtmlTag}}
|
|
7
|
+
{%- else -%}
|
|
8
8
|
p
|
|
9
9
|
{%- endif -%}
|
|
10
10
|
{% endset -%}
|
|
11
11
|
{%- set collapseIcon -%}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
{%- if params.collapseIcon -%}
|
|
13
|
+
{{params.collapseIcon}}
|
|
14
|
+
{%- else -%}
|
|
15
15
|
chevron-up
|
|
16
16
|
{%- endif -%}
|
|
17
17
|
{% endset -%}
|
|
18
18
|
{%- set expandIcon %}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
{%- if params.expandIcon -%}
|
|
20
|
+
{{params.expandIcon}}
|
|
21
|
+
{%- else -%}
|
|
22
22
|
chevron-down
|
|
23
23
|
{% endif -%}
|
|
24
24
|
{% endset -%}
|
|
25
|
-
<{{triggerHtmlTag}} id="accordion-trigger-{{params.id}}" class="mds-accordion-trigger{%if params.triggerNoJsHidden %} mds-display-none{% endif %}" {% if params.breakpoint %}data-bp="{{params.breakpoint}}"{% endif %}{% if params.isExpanded %}data-expanded="{{params.isExpanded}}"{% endif %} data-test="accordion-trigger">
|
|
25
|
+
<{{triggerHtmlTag}} id="accordion-trigger-{{params.id}}" class="mds-accordion-trigger{%if params.triggerNoJsHidden %} mds-display-none{% endif %}" {% if params.breakpoint %}data-bp="{{params.breakpoint}}"{% endif %}{% if params.isExpanded %}data-expanded="{{params.isExpanded}}"{% endif %} data-test="accordion-trigger-{{params.id}}">
|
|
26
26
|
<span {% if params.triggerClasses %}class="{{params.triggerClasses}}"{% endif %}>
|
|
27
27
|
{% if params.leftAligned %}
|
|
28
28
|
{{- MdsIcon({ iconName: collapseIcon, classes: 'mds-icon--before mds-accordion-trigger__icon-collapse'}) -}}
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
</{{triggerHtmlTag}}>
|
|
40
40
|
{% if params.useFieldset %}
|
|
41
41
|
{# used in nested checkboxes #}
|
|
42
|
-
<fieldset class="mds-accordion-content" data-test="accordion-content">
|
|
42
|
+
<fieldset class="mds-accordion-content" data-test="accordion-content-{{params.id}}">
|
|
43
43
|
<legend class="mds-visually-hidden">{{params.triggerLabel}}</legend>
|
|
44
44
|
{{params.content | safe}}
|
|
45
45
|
</fieldset>
|
|
46
46
|
{% else %}
|
|
47
47
|
{# using aria-label instead of aria-labelledby to avoid getting `triggerLabelActive` as label for the content #}
|
|
48
|
-
<div class="mds-accordion-content" {% if not params.triggerNoJsHidden %}aria-label="{{ params.triggerLabel }}" {% endif %}data-test="accordion-content">{{params.content | safe}}</div>
|
|
48
|
+
<div class="mds-accordion-content" {% if not params.triggerNoJsHidden %}aria-label="{{ params.triggerLabel }}" {% endif %}data-test="accordion-content-{{params.id}}">{{params.content | safe}}</div>
|
|
49
49
|
{% endif %}
|
|
50
50
|
{% endif %}
|
|
@@ -13,6 +13,7 @@ module.exports = {
|
|
|
13
13
|
triggerNoJsHidden: true,
|
|
14
14
|
content:
|
|
15
15
|
'<dl class="mds-list mds-list--definition mds-list--border"><dt class="mds-list__key">Hours</dt><dd class="mds-list__value">Full time</dd><dt class="mds-list__key">Contract</dt><dd class="mds-list__value">Permanent</dd><dt class="mds-list__key">Industry</dt><dd class="mds-list__value">Accountant, Manager</dd></dl>',
|
|
16
|
+
id: 'taxonomy',
|
|
16
17
|
},
|
|
17
18
|
},
|
|
18
19
|
{
|
|
@@ -27,6 +28,7 @@ module.exports = {
|
|
|
27
28
|
leftAligned: true,
|
|
28
29
|
content:
|
|
29
30
|
'<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ligula erat, dignissim non sollicitudin ut, sagittis a sapien. Quisque eget arcu sed nulla tincidunt eleifend. Maecenas sit amet velit elit. Maecenas elementum venenatis sapien sit amet elementum. Pellentesque id mauris quis tortor suscipit posuere. Donec eu consectetur tortor. Mauris id scelerisque quam. Sed scelerisque ut est quis sollicitudin. Etiam semper tempor erat, sed rhoncus ex malesuada non. Donec eu pellentesque odio. Vestibulum et suscipit risus, luctus semper nunc. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam eu est ac libero blandit egestas ac id tellus. Suspendisse pulvinar viverra ex, a varius ligula commodo at. Vivamus dignissim neque vitae est ultrices lobortis. Cras vel pulvinar erat.</p>',
|
|
31
|
+
id: 'altIcons',
|
|
30
32
|
},
|
|
31
33
|
},
|
|
32
34
|
{
|
|
@@ -39,6 +41,7 @@ module.exports = {
|
|
|
39
41
|
triggerClasses: 'mds-font-great-primer',
|
|
40
42
|
content:
|
|
41
43
|
'<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ligula erat, dignissim non sollicitudin ut, sagittis a sapien. Quisque eget arcu sed nulla tincidunt eleifend. Maecenas sit amet velit elit. Maecenas elementum venenatis sapien sit amet elementum. Pellentesque id mauris quis tortor suscipit posuere. Donec eu consectetur tortor. Mauris id scelerisque quam. Sed scelerisque ut est quis sollicitudin. Etiam semper tempor erat, sed rhoncus ex malesuada non. Donec eu pellentesque odio. Vestibulum et suscipit risus, luctus semper nunc. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam eu est ac libero blandit egestas ac id tellus. Suspendisse pulvinar viverra ex, a varius ligula commodo at. Vivamus dignissim neque vitae est ultrices lobortis. Cras vel pulvinar erat.</p>',
|
|
44
|
+
id: 'collapsed',
|
|
42
45
|
},
|
|
43
46
|
},
|
|
44
47
|
{
|
|
@@ -51,6 +54,7 @@ module.exports = {
|
|
|
51
54
|
breakpoint: tokens.size.breakpoint.md.original.value,
|
|
52
55
|
content:
|
|
53
56
|
'<dl class="mds-list mds-list--definition mds-list--border"><dt class="mds-list__key">Hours</dt><dd class="mds-list__value">Full time</dd><dt class="mds-list__key">Contract</dt><dd class="mds-list__value">Permanent</dd><dt class="mds-list__key">Industry</dt><dd class="mds-list__value">Accountant, Manager</dd></dl>',
|
|
57
|
+
id: 'mobile',
|
|
54
58
|
},
|
|
55
59
|
},
|
|
56
60
|
],
|
|
@@ -12,24 +12,28 @@
|
|
|
12
12
|
|
|
13
13
|
{#- Define common attributes that we can use across all element types #}
|
|
14
14
|
|
|
15
|
-
{%- set commonAttributes %} class="mds-button{% if params.classes %}
|
|
15
|
+
{%- set commonAttributes %} class="mds-button{% if params.classes %}
|
|
16
|
+
{{ params.classes }}
|
|
17
|
+
{% endif %}
|
|
18
|
+
{% if params.disabled %} mds-button--disabled{% endif %}"{% for attribute, value in params.attributes %}{{attribute}}="{{value}}"{% endfor %} data-test="button-{{params.id}}"{% endset %}
|
|
16
19
|
|
|
17
20
|
{#- Define common attributes we can use for both button and input types #}
|
|
18
21
|
|
|
19
|
-
{%- set buttonAttributes %}
|
|
22
|
+
{%- set buttonAttributes %}
|
|
23
|
+
{% if params.name %} name="{{ params.name }}"{% endif %} type="{{ params.type if params.type else 'submit' }}"{% if params.disabled %} disabled="disabled" aria-disabled="true"{% endif %}{% endset %}
|
|
20
24
|
|
|
21
25
|
{#- Actually create a button... or a link! #}
|
|
22
26
|
|
|
23
27
|
{%- if element == 'a' %}
|
|
24
|
-
<a href="{{ params.href if params.href else '#' }}" role="button" draggable="false" {{- commonAttributes | safe }}>
|
|
25
|
-
|
|
26
|
-
</a>
|
|
28
|
+
<a href="{{ params.href if params.href else '#' }}" role="button" draggable="false" {{- commonAttributes | safe }}>
|
|
29
|
+
{{ params.html | safe if params.html else params.text }}
|
|
30
|
+
</a>
|
|
27
31
|
|
|
28
32
|
{%- elseif element == 'button' %}
|
|
29
|
-
<button {%- if params.value %} value="{{ params.value }}"{% endif %} {{- buttonAttributes | safe }} {{- commonAttributes | safe }}>
|
|
30
|
-
|
|
31
|
-
</button>
|
|
33
|
+
<button {%- if params.value %} value="{{ params.value }}"{% endif %} {{- buttonAttributes | safe }} {{- commonAttributes | safe }}>
|
|
34
|
+
{{ params.html | safe if params.html else params.text }}
|
|
35
|
+
</button>
|
|
32
36
|
|
|
33
37
|
{%- elseif element == 'input' %}
|
|
34
|
-
<input value="{{ params.text }}" {{- buttonAttributes | safe }} {{- commonAttributes | safe }}>
|
|
35
|
-
{%- endif %}
|
|
38
|
+
<input value="{{ params.text }}" {{- buttonAttributes | safe }} {{- commonAttributes | safe }}>
|
|
39
|
+
{%- endif %}
|
|
@@ -3,6 +3,7 @@ module.exports = {
|
|
|
3
3
|
status: 'wip',
|
|
4
4
|
context: {
|
|
5
5
|
text: 'Button 1',
|
|
6
|
+
id: 'default',
|
|
6
7
|
},
|
|
7
8
|
variants: [
|
|
8
9
|
{
|
|
@@ -10,6 +11,7 @@ module.exports = {
|
|
|
10
11
|
context: {
|
|
11
12
|
href: 'http://madgex.com',
|
|
12
13
|
text: 'Link button 1',
|
|
14
|
+
id: 'link-1',
|
|
13
15
|
},
|
|
14
16
|
},
|
|
15
17
|
{
|
|
@@ -18,6 +20,7 @@ module.exports = {
|
|
|
18
20
|
href: 'http://madgex.com',
|
|
19
21
|
text: 'Link Plain button 2',
|
|
20
22
|
classes: 'mds-button--plain',
|
|
23
|
+
id: 'link-2',
|
|
21
24
|
},
|
|
22
25
|
},
|
|
23
26
|
{
|
|
@@ -25,6 +28,7 @@ module.exports = {
|
|
|
25
28
|
context: {
|
|
26
29
|
element: 'input',
|
|
27
30
|
text: 'Input button 3',
|
|
31
|
+
id: 'link-3',
|
|
28
32
|
},
|
|
29
33
|
},
|
|
30
34
|
{
|
|
@@ -32,6 +36,7 @@ module.exports = {
|
|
|
32
36
|
context: {
|
|
33
37
|
text: 'Plain button',
|
|
34
38
|
classes: 'mds-button--plain',
|
|
39
|
+
id: 'plain',
|
|
35
40
|
},
|
|
36
41
|
},
|
|
37
42
|
{
|
|
@@ -39,6 +44,7 @@ module.exports = {
|
|
|
39
44
|
context: {
|
|
40
45
|
text: 'Small button',
|
|
41
46
|
classes: 'mds-button--small',
|
|
47
|
+
id: 'small',
|
|
42
48
|
},
|
|
43
49
|
},
|
|
44
50
|
{
|
|
@@ -46,6 +52,7 @@ module.exports = {
|
|
|
46
52
|
context: {
|
|
47
53
|
text: 'Large button',
|
|
48
54
|
classes: 'mds-button--large',
|
|
55
|
+
id: 'large',
|
|
49
56
|
},
|
|
50
57
|
},
|
|
51
58
|
{
|
|
@@ -53,6 +60,7 @@ module.exports = {
|
|
|
53
60
|
context: {
|
|
54
61
|
text: 'Full width example',
|
|
55
62
|
classes: 'mds-width-full mds-width-md-auto',
|
|
63
|
+
id: 'full',
|
|
56
64
|
},
|
|
57
65
|
},
|
|
58
66
|
{
|
|
@@ -60,6 +68,7 @@ module.exports = {
|
|
|
60
68
|
context: {
|
|
61
69
|
text: 'Neutral',
|
|
62
70
|
classes: 'mds-button--neutral',
|
|
71
|
+
id: 'neutral',
|
|
63
72
|
},
|
|
64
73
|
},
|
|
65
74
|
],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{% if params.inList %}
|
|
2
|
-
|
|
2
|
+
<li class="mds-card mds-card--list-item{% if params.classes %} {{ params.classes }}{% endif %}" data-test="card-{{params.id}}">{{ params.content | safe }}</li>
|
|
3
3
|
{% else %}
|
|
4
|
-
|
|
4
|
+
<div class="mds-card{% if params.classes %} {{ params.classes }}{% endif %}" data-test="card-{{params.id}}">{{ params.content | safe }}</div>
|
|
5
5
|
{% endif %}
|
|
@@ -6,6 +6,7 @@ module.exports = {
|
|
|
6
6
|
inList: false,
|
|
7
7
|
classes: '',
|
|
8
8
|
content: '<h4>Card Title</h4><p>paragraph</p>',
|
|
9
|
+
id: 'default',
|
|
9
10
|
},
|
|
10
11
|
variants: [
|
|
11
12
|
{
|
|
@@ -15,6 +16,7 @@ module.exports = {
|
|
|
15
16
|
inList: true,
|
|
16
17
|
classes: '',
|
|
17
18
|
content: '<h4>Card used in list (li instead of div)</h4><p>paragraph</p>',
|
|
19
|
+
id: 'in-list',
|
|
18
20
|
},
|
|
19
21
|
},
|
|
20
22
|
{
|
|
@@ -24,6 +26,7 @@ module.exports = {
|
|
|
24
26
|
inList: false,
|
|
25
27
|
classes: 'mds-card--highlighted',
|
|
26
28
|
content: '<h4>Card Title</h4><p>paragraph</p>',
|
|
29
|
+
id: 'with-background',
|
|
27
30
|
},
|
|
28
31
|
},
|
|
29
32
|
],
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
{% if checkboxParams.options and checkboxParams.options.length %}
|
|
14
14
|
{% for option in checkboxParams.options %}
|
|
15
15
|
{%- set optionId -%}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
{%- if option.id -%}{#
|
|
17
|
+
#}{{ option.id }}{#
|
|
18
|
+
#}{% else %}{#
|
|
19
19
|
#}{{ checkboxParams.name }}-{{ option.value }}{#
|
|
20
|
-
|
|
20
|
+
#}{% endif -%}
|
|
21
21
|
{%- endset -%}
|
|
22
22
|
{%- set isSelected = false -%}
|
|
23
23
|
{%- set accordionIsExpanded = false -%}
|
|
@@ -29,43 +29,43 @@
|
|
|
29
29
|
{% set selectedOptions = [selectedOptions] %}
|
|
30
30
|
{% endif %}
|
|
31
31
|
{% for selectedOption in selectedOptions %}
|
|
32
|
-
{% if selectedOption == option.value
|
|
32
|
+
{% if selectedOption == option.value %}
|
|
33
33
|
{%- set isSelected = true -%}
|
|
34
34
|
{% endif %}
|
|
35
35
|
{% for nestedOption in option.options %}
|
|
36
|
-
{% if selectedOption == nestedOption.value
|
|
36
|
+
{% if selectedOption == nestedOption.value %}
|
|
37
37
|
{%- set accordionIsExpanded = true -%}
|
|
38
38
|
{% endif %}
|
|
39
39
|
{% endfor %}
|
|
40
40
|
{% endfor %}
|
|
41
41
|
{% endif %}
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
<div class="mds-form-check{% if option.classes %} {{option.classes}}{% endif %}">
|
|
43
|
+
<input
|
|
44
44
|
type="checkbox"
|
|
45
45
|
class="mds-form-check__input"
|
|
46
46
|
name="{{ checkboxParams.name }}"
|
|
47
47
|
id="{{ optionId }}"
|
|
48
48
|
{% if checkboxParams.disabled %}disabled="disabled"{% endif %}
|
|
49
49
|
{% if isSelected == true %}checked="checked"{% endif %}
|
|
50
|
-
value="{{ option.value }}"
|
|
51
|
-
|
|
50
|
+
value="{{ option.value }}"
|
|
51
|
+
/>{#
|
|
52
52
|
# Avoid extra space created by line breaks #
|
|
53
53
|
#}<label class="mds-form-check__label" for="{{ optionId }}">{#
|
|
54
54
|
#}{{ option.labelText }}{#
|
|
55
55
|
#}</label>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
{% if option.options and option.options.length %}
|
|
57
|
+
{%- set triggerLabel %}Select options under {{ option.labelText | safe }}{% endset -%}
|
|
58
|
+
{%- set accordionContent %}
|
|
59
|
+
<div class="mds-form-check__nested-container">
|
|
60
|
+
{{ createCheckboxes({
|
|
61
61
|
options: option.options,
|
|
62
62
|
selectedOptions: checkboxParams.selectedOptions,
|
|
63
63
|
name: checkboxParams.name,
|
|
64
64
|
disabled: checkboxParams.disabled
|
|
65
65
|
}) }}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
</div>
|
|
67
|
+
{% endset -%}
|
|
68
|
+
{{ MdsAccordion({
|
|
69
69
|
id: optionId,
|
|
70
70
|
triggerHtmlTag: 'div',
|
|
71
71
|
triggerLabel: triggerLabel,
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
useFieldset: true,
|
|
78
78
|
isExpanded: accordionIsExpanded
|
|
79
79
|
}) }}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
{% endif %}
|
|
81
|
+
</div>
|
|
82
|
+
{% endfor %}
|
|
83
83
|
{% endif %}
|
|
84
84
|
{% endmacro %}
|
|
85
85
|
|
|
@@ -97,11 +97,11 @@
|
|
|
97
97
|
{% endif %}
|
|
98
98
|
{% endif %}
|
|
99
99
|
|
|
100
|
-
<div class="mds-form-element mds-form-element--checkbox{% if params.state %} mds-form-element--{{params.state}}{% endif %}{% if params.classes %} {{params.classes}}{% endif %}" id="{{params.id}}" data-test="checkbox">
|
|
100
|
+
<div class="mds-form-element mds-form-element--checkbox{% if params.state %} mds-form-element--{{params.state}}{% endif %}{% if params.classes %} {{params.classes}}{% endif %}" id="{{params.id}}" data-test="checkbox-{{params.id}}">
|
|
101
101
|
{# no need for fieldset and legend if there is only one checkbox #}
|
|
102
102
|
{% if params.options.length > 1 %}
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
<fieldset>
|
|
104
|
+
{{ MdsInputLabel({
|
|
105
105
|
element: 'legend',
|
|
106
106
|
labelText: params.labelText,
|
|
107
107
|
hideLabel: params.hideLabel,
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
optional: params.optional,
|
|
110
110
|
tooltipMessage: params.tooltipMessage
|
|
111
111
|
}) }}
|
|
112
|
-
|
|
112
|
+
{% endif %}
|
|
113
113
|
{{ MdsInputMessages({
|
|
114
114
|
id: params.id,
|
|
115
115
|
helpText: params.helpText,
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
disabled: params.disabled
|
|
124
124
|
}) }}
|
|
125
125
|
</div>
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
{% if params.options.length > 1 %}
|
|
127
|
+
</fieldset>
|
|
128
128
|
{% endif %}
|
|
129
129
|
</div>
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
{% from "../_message/_macro.njk" import MdsInputMessages %}
|
|
3
3
|
|
|
4
4
|
{%- set comboboxId %}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
{%- if params.id -%}
|
|
6
|
+
{{ params.id }}
|
|
7
|
+
{%- else -%}
|
|
8
|
+
{#
|
|
9
9
|
if the id is missing it will be constructed using:
|
|
10
10
|
[component name]-[item labelText]-[index]
|
|
11
11
|
e.g. period-next-week-2
|
|
12
12
|
#}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{%- endif -%}
|
|
13
|
+
{%- if params.name -%}{{ params.name | lower | trim | replace(' ', '-')}}{%- else -%}{{ params.labelText | lower | trim | replace(' ', '-') }}{%- endif -%}
|
|
14
|
+
{%- endif -%}
|
|
16
15
|
{% endset -%}
|
|
17
16
|
|
|
18
17
|
{% if params.name %}
|
|
@@ -22,15 +21,15 @@
|
|
|
22
21
|
{% endif %}
|
|
23
22
|
|
|
24
23
|
{%- set placeholder %}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
{%- if params.placeholder -%}
|
|
25
|
+
{{ params.placeholder }}
|
|
26
|
+
{%- else -%}
|
|
28
27
|
Please select
|
|
29
28
|
{%- endif -%}
|
|
30
29
|
{% endset -%}
|
|
31
30
|
|
|
32
31
|
{%- if comboboxId -%}
|
|
33
|
-
<div class="mds-form-element mds-form-element--combobox js-mds-combobox{% if params.classes %} {{params.classes}}{% endif %}{% if params.state %} mds-form-element--{{params.state}}{% endif %}" data-combobox-id="{{ comboboxId }}" data-test="combobox" data-type="{{ params.type }}">
|
|
32
|
+
<div class="mds-form-element mds-form-element--combobox js-mds-combobox{% if params.classes %} {{params.classes}}{% endif %}{% if params.state %} mds-form-element--{{params.state}}{% endif %}" data-combobox-id="{{ comboboxId }}" data-test="combobox-{{comboboxId}}" data-type="{{ params.type }}">
|
|
34
33
|
{{ MdsInputLabel({
|
|
35
34
|
labelText: params.labelText,
|
|
36
35
|
hideLabel: params.hideLabel,
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
{%- endif -%}
|
|
55
54
|
</select>
|
|
56
55
|
{% elseif params.fallbackTo === 'input' %}
|
|
57
|
-
|
|
56
|
+
<input class="mds-form-control" type="text" name="{{ comboboxName }}" autocomplete="off" id="{{ comboboxId }}" value="{{ params.value|default('') }}" placeholder="{{ placeholder }}"/>
|
|
58
57
|
{% endif %}
|
|
59
58
|
</div>
|
|
60
59
|
{# Leave the custom element at the bottom so it has access to the above elements on render #}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<li
|
|
3
|
+
ref="list-item"
|
|
3
4
|
class="mds-combobox__option"
|
|
4
5
|
role="option"
|
|
5
6
|
:class="{ 'mds-combobox__option--focused': focused }"
|
|
@@ -30,6 +31,11 @@ export default {
|
|
|
30
31
|
searchValue(newSearchValue) {
|
|
31
32
|
return newSearchValue;
|
|
32
33
|
},
|
|
34
|
+
focused(value) {
|
|
35
|
+
if (value) {
|
|
36
|
+
this.$refs['list-item'].scrollIntoView(false);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
33
39
|
},
|
|
34
40
|
methods: {
|
|
35
41
|
highlightOption() {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
{% endif %}
|
|
17
17
|
|
|
18
18
|
{% set removeButtonText -%}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
{{- params.removeButtonText -}}
|
|
20
|
+
{{-
|
|
21
21
|
MdsIcon({
|
|
22
22
|
iconName: 'cross',
|
|
23
23
|
classes: 'mds-icon--after'
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
-}}
|
|
26
26
|
{%- endset %}
|
|
27
27
|
|
|
28
|
-
<div class="mds-form-element mds-form-element--file{% if params.state %} mds-form-element--{{params.state}}{% endif %}{% if params.classes %} {{params.classes}}{% endif %}{% if params.value %} mds-form-element--selected-file{% endif %}" id="{{ params.id }}-container" data-test="input">
|
|
29
|
-
|
|
28
|
+
<div class="mds-form-element mds-form-element--file{% if params.state %} mds-form-element--{{params.state}}{% endif %}{% if params.classes %} {{params.classes}}{% endif %}{% if params.value %} mds-form-element--selected-file{% endif %}" id="{{ params.id }}-container" data-test="input-{{ params.id }}">
|
|
29
|
+
{{ MdsInputLabel({
|
|
30
30
|
labelText: params.labelText,
|
|
31
31
|
hideLabel: params.hideLabel,
|
|
32
32
|
id: params.id,
|
|
33
33
|
optional: params.optional,
|
|
34
34
|
tooltipMessage: params.tooltipMessage
|
|
35
35
|
}) }}
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
{% if params.value %}<p class="mds-js-visually-hidden">{% if params.selectedFileText %}{{ params.selectedFileText }}{% else %}Use {{ params.value }} or upload a different file{% endif %}</p>{% endif %}
|
|
37
|
+
{{ MdsInputMessages({
|
|
38
38
|
id: params.id,
|
|
39
39
|
helpText: params.helpText,
|
|
40
40
|
validationError: params.validationError
|
|
41
41
|
}) }}
|
|
42
42
|
<div class="mds-file-upload">
|
|
43
43
|
<div class="mds-file-upload__input">
|
|
44
|
-
|
|
44
|
+
<input
|
|
45
45
|
class="mds-form-control"
|
|
46
46
|
type="file"
|
|
47
47
|
name="{{ name }}"
|
|
@@ -52,46 +52,46 @@
|
|
|
52
52
|
{% if params.disabled %}
|
|
53
53
|
disabled="disabled"
|
|
54
54
|
{% endif %}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
/>
|
|
56
|
+
<div class="mds-file-upload__input-controls" aria-hidden="true">
|
|
57
|
+
<div class="mds-file-upload__selection-state">
|
|
58
|
+
<div class="mds-file-upload__prompt">
|
|
59
|
+
{{
|
|
60
60
|
MdsIcon({
|
|
61
61
|
iconName: 'upload',
|
|
62
62
|
classes: 'mds-icon--md mds-icon--before'
|
|
63
63
|
})
|
|
64
64
|
}}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
<span>
|
|
66
|
+
{{ params.defaultFileText }}
|
|
67
|
+
</span>
|
|
68
|
+
</div>
|
|
69
|
+
{# The "button" is actually a label referencing the input but it looks like a button so using this for the name of the class #}
|
|
70
|
+
<div class="mds-file-upload__browse-button mds-text-align-center">
|
|
71
|
+
{{ MdsInputLabel({
|
|
72
72
|
labelText: buttonText,
|
|
73
73
|
id: params.id
|
|
74
74
|
}) }}
|
|
75
|
-
</div>
|
|
76
75
|
</div>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
</div>
|
|
77
|
+
<div class="mds-file-upload__selected-state">
|
|
78
|
+
<div class="mds-file-upload__file-name-container">
|
|
79
|
+
{{- MdsIcon({
|
|
80
80
|
iconName: 'check',
|
|
81
81
|
classes: 'mds-icon--md',
|
|
82
82
|
hasContainer: true,
|
|
83
83
|
containerClasses: 'mds-icon-container--circle mds-icon-container--success mds-icon-container--before'
|
|
84
84
|
})
|
|
85
85
|
-}}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
<span class="mds-file-upload__file-name">{% if params.value %}{{ params.value }}{% endif %}</span>
|
|
87
|
+
</div>
|
|
88
|
+
{{ MdsButton({
|
|
89
89
|
html: removeButtonText,
|
|
90
90
|
classes: 'mds-button--plain mds-button--small mds-file-upload__remove-button',
|
|
91
91
|
type: 'button'
|
|
92
92
|
}) }}
|
|
93
|
-
</div>
|
|
94
93
|
</div>
|
|
95
|
-
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
96
|
</div>
|
|
97
97
|
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{% set name = params.id %}
|
|
8
8
|
{% endif %}
|
|
9
9
|
|
|
10
|
-
<div class="mds-form-element mds-form-element--input{% if params.state %} mds-form-element--{{params.state}}{% endif %}{% if params.classes %} {{params.classes}}{% endif %}" id="{{ params.id }}-container" data-test="input">
|
|
10
|
+
<div class="mds-form-element mds-form-element--input{% if params.state %} mds-form-element--{{params.state}}{% endif %}{% if params.classes %} {{params.classes}}{% endif %}" id="{{ params.id }}-container" data-test="input-{{ params.id }}">
|
|
11
11
|
{{ MdsInputLabel({
|
|
12
12
|
labelText: params.labelText,
|
|
13
13
|
hideLabel: params.hideLabel,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
helpText: params.helpText,
|
|
21
21
|
validationError: params.validationError
|
|
22
22
|
}) }}
|
|
23
|
-
|
|
23
|
+
<input
|
|
24
24
|
class="mds-form-control"
|
|
25
25
|
type="{{ params.type }}"
|
|
26
26
|
name="{{ name }}"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
{% if params.value %}
|
|
38
38
|
value="{{params.value}}"
|
|
39
39
|
{% endif %}
|
|
40
|
-
|
|
40
|
+
/>
|
|
41
41
|
</div>
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
{%- set name = params.id -%}
|
|
8
8
|
{%- endif -%}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
<div class="mds-form-element mds-form-element--radio{% if params.classes %} {{params.classes}}{% endif %}" id="{{params.id}}" data-test="radio">
|
|
10
|
+
<div class="mds-form-element mds-form-element--radio{% if params.classes %} {{params.classes}}{% endif %}" id="{{params.id}}" data-test="radio-{{params.id}}">
|
|
12
11
|
<fieldset>
|
|
13
12
|
{{ MdsInputLabel({
|
|
14
13
|
element: 'legend',
|
|
@@ -33,11 +32,12 @@
|
|
|
33
32
|
{% if params.disabled %}disabled="disabled"{% endif %}
|
|
34
33
|
{% if params.value == radio.value %}checked="checked"{% endif %}
|
|
35
34
|
value="{{radio.value}}"
|
|
36
|
-
|
|
35
|
+
/>
|
|
36
|
+
{#
|
|
37
37
|
# Avoid extra space created by line breaks #
|
|
38
38
|
#}<label class="mds-form-check__label" for="{{radio.id}}">{#
|
|
39
39
|
#}{{radio.labelText}}{#
|
|
40
|
-
|
|
40
|
+
#}</label>
|
|
41
41
|
</div>
|
|
42
42
|
{% endfor %}
|
|
43
43
|
</fieldset>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
{%- if params.classes %} {{params.classes}}{% endif -%}
|
|
13
13
|
{%- if params.state %} mds-form-element--{{params.state}}{% endif -%}"
|
|
14
14
|
id="{{ params.id }}-container"
|
|
15
|
-
data-test="select"
|
|
15
|
+
data-test="select-{{ params.id }}"
|
|
16
16
|
>
|
|
17
17
|
{{ MdsInputLabel({
|
|
18
18
|
labelText: params.labelText,
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
{% endif -%}
|
|
38
38
|
class="mds-form-control"
|
|
39
39
|
>
|
|
40
|
-
|
|
40
|
+
<option
|
|
41
41
|
disabled="disabled"
|
|
42
42
|
{%- if not params.value %} selected="selected"{% endif -%}
|
|
43
43
|
>
|
|
44
44
|
Please select
|
|
45
45
|
</option>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
{%- for option in params.options %}
|
|
47
|
+
<option value="{{option.value}}" {%- if option.value == params.value %}selected="selected"{% endif -%}>
|
|
48
|
+
{{option.labelText}}
|
|
49
|
+
</option>
|
|
50
|
+
{% endfor -%}
|
|
51
51
|
</select>
|
|
52
52
|
</div>
|